Skip to content

Commit

Permalink
update to use tensor rlst branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mscroggs committed Nov 22, 2023
1 parent 85c5cfb commit e19af34
Show file tree
Hide file tree
Showing 36 changed files with 661 additions and 624 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
members = [
"bem",
"element",
"fmm",
"field",
# "fmm",
# "field",
"grid",
"hyksort",
"quadrature",
Expand All @@ -19,8 +19,8 @@ resolver = "2"
default-members = [
"bem",
"element",
"fmm",
"field",
# "fmm",
# "field",
"grid",
"hyksort",
"quadrature",
Expand Down
9 changes: 5 additions & 4 deletions bem/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ itertools = "0.10"
mpi = { version = "0.6.*", optional = true }
num = "0.4"
rayon = "1.7"
rlst = { git = "https://github.com/linalg-rs/rlst.git" }
rlst-blis-src = { git = "https://github.com/linalg-rs/rlst.git" }
rlst-dense = { git = "https://github.com/linalg-rs/rlst.git" }
rlst-algorithms = { git = "https://github.com/linalg-rs/rlst.git" }
rlst = { git = "https://github.com/linalg-rs/rlst.git", branch="tensor" }
rlst-blis-src = { git = "https://github.com/linalg-rs/rlst.git", branch="tensor" }
rlst-dense = { git = "https://github.com/linalg-rs/rlst.git", branch="tensor" }
rlst-common = { git = "https://github.com/linalg-rs/rlst.git", branch="tensor" }
rlst-algorithms = { git = "https://github.com/linalg-rs/rlst.git", branch="tensor" }

[dev-dependencies]
criterion = { version = "0.3", features = ["html_reports"]}
Expand Down
11 changes: 6 additions & 5 deletions bem/benches/assembly_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn full_assembly_benchmark(c: &mut Criterion) {
);

let space = SerialFunctionSpace::new(&grid, &element);
let mut matrix = zero_matrix((space.dofmap().global_size(), space.dofmap().global_size()));
let mut matrix = zero_matrix([space.dofmap().global_size(), space.dofmap().global_size()]);

group.bench_function(
&format!(
Expand Down Expand Up @@ -62,7 +62,7 @@ pub fn assembly_parts_benchmark(c: &mut Criterion) {
);

let space = SerialFunctionSpace::new(&grid, &element);
let mut matrix = zero_matrix((space.dofmap().global_size(), space.dofmap().global_size()));
let mut matrix = zero_matrix([space.dofmap().global_size(), space.dofmap().global_size()]);

let colouring = space.compute_cell_colouring();

Expand Down Expand Up @@ -130,7 +130,7 @@ pub fn cl_benchmark(c: &mut Criterion) {
);

let space = SerialFunctionSpace::new(&grid, &element);
let mut matrix = zero_matrix((space.dofmap().global_size(), space.dofmap().global_size()));
let mut matrix = zero_matrix([space.dofmap().global_size(), space.dofmap().global_size()]);

/*
group.bench_function(
Expand Down Expand Up @@ -181,5 +181,6 @@ pub fn cl_benchmark(c: &mut Criterion) {

// criterion_group!(benches, full_assembly_benchmark, assembly_parts_benchmark);
criterion_group!(benches, assembly_parts_benchmark);
criterion_group!(cl_benches, cl_benchmark);
criterion_main!(benches, cl_benches);
//criterion_group!(cl_benches, cl_benchmark);
criterion_main!(benches);
//criterion_main!(benches, cl_benches);
2 changes: 1 addition & 1 deletion bem/examples/assemble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn main() {
space0.dofmap().global_size()
);
let mut matrix =
zero_matrix::<f64>((space1.dofmap().global_size(), space0.dofmap().global_size()));
zero_matrix::<f64>([space1.dofmap().global_size(), space0.dofmap().global_size()]);

println!("Assembling dense matrix (complex)");
assemble_batched(
Expand Down
22 changes: 11 additions & 11 deletions bem/src/assembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ mod test {
use bempp_traits::element::{Continuity, ElementFamily};
// use num::complex::Complex;
use bempp_traits::bem::FunctionSpace;
use rlst_dense::RandomAccessByRef;
use rlst_common::traits::RandomAccessByRef;

#[test]
fn test_laplace_single_layer() {
Expand All @@ -118,7 +118,7 @@ mod test {
let space1 = SerialFunctionSpace::new(&grid, &element1);

let mut matrix =
zero_matrix::<f64>((space1.dofmap().global_size(), space0.dofmap().global_size()));
zero_matrix::<f64>([space1.dofmap().global_size(), space0.dofmap().global_size()]);
batched::assemble(
&mut matrix,
&Laplace3dKernel::new(),
Expand All @@ -129,7 +129,7 @@ mod test {
);

let mut matrix2 =
zero_matrix::<f64>((space1.dofmap().global_size(), space0.dofmap().global_size()));
zero_matrix::<f64>([space1.dofmap().global_size(), space0.dofmap().global_size()]);

assemble_batched(
&mut matrix2,
Expand All @@ -142,8 +142,8 @@ mod test {
for i in 0..space1.dofmap().global_size() {
for j in 0..space0.dofmap().global_size() {
assert_relative_eq!(
*matrix.get(i, j).unwrap(),
*matrix2.get(i, j).unwrap(),
*matrix.get([i, j]).unwrap(),
*matrix2.get([i, j]).unwrap(),
epsilon = 0.0001
);
}
Expand All @@ -163,7 +163,7 @@ mod test {
let colouring = space.compute_cell_colouring();

let mut matrix =
zero_matrix::<f64>((space.dofmap().global_size(), space.dofmap().global_size()));
zero_matrix::<f64>([space.dofmap().global_size(), space.dofmap().global_size()]);
batched::assemble_nonsingular::<16, 16>(
&mut matrix,
&laplace_3d::Laplace3dKernel::new(),
Expand All @@ -176,7 +176,7 @@ mod test {
128,
);
let mut matrix2 =
zero_matrix::<f64>((space.dofmap().global_size(), space.dofmap().global_size()));
zero_matrix::<f64>([space.dofmap().global_size(), space.dofmap().global_size()]);
cl_kernel::assemble(
&mut matrix,
&Laplace3dKernel::new(),
Expand All @@ -188,16 +188,16 @@ mod test {

for i in 0..5 {
for j in 0..5 {
println!("{} {}", *matrix.get(i, j).unwrap(),
*matrix2.get(i, j).unwrap());
println!("{} {}", *matrix.get([i, j]).unwrap(),
*matrix2.get([i, j]).unwrap());
}
println!();
}
for i in 0..space.dofmap().global_size() {
for j in 0..space.dofmap().global_size() {
assert_relative_eq!(
*matrix.get(i, j).unwrap(),
*matrix2.get(i, j).unwrap(),
*matrix.get([i, j]).unwrap(),
*matrix2.get([i, j]).unwrap(),
epsilon = 0.0001
);
}
Expand Down
Loading

0 comments on commit e19af34

Please sign in to comment.