Skip to content

Commit 5128a6e

Browse files
committed
Updated rlst
1 parent 24f1d74 commit 5128a6e

File tree

12 files changed

+501
-499
lines changed

12 files changed

+501
-499
lines changed

Cargo.toml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
nightly = ["pulp/nightly"]
33
# Treat warnings as a build error.
44
strict = []
5-
sleef = ["rlst/sleef"]
6-
default = []
7-
mpi = ["dep:mpi", "dep:bempp-distributed-tools", "rlst/mpi"]
5+
default = ["mpi"]
6+
mpi = ["dep:mpi", "rlst/mpi"]
87

98

109
[package]
@@ -28,23 +27,21 @@ crate-type = ["lib", "staticlib", "cdylib"]
2827
paste = "1.*"
2928
libc = "0.2"
3029
approx = { version = "0.5", features = ["num-complex"] }
31-
rayon = "1.9"
30+
rayon = "1.11"
3231
num = "0.4"
3332
num_cpus = "1"
3433
rlst = { git = "https://github.com/linalg-rs/rlst.git" }
35-
# rlst = { path = "../rlst", features = ["mpi"] }
36-
rand = "0.8.5"
37-
itertools = { version = "0.13.0", default-features = false }
34+
rand = "0.9"
35+
itertools = { version = "0.14", default-features = false }
3836
coe-rs = "0.1.2"
39-
pulp = { version = "0.21" }
40-
bytemuck = "1.16.0"
37+
pulp = { version = "0.22" }
38+
bytemuck = "1.24.0"
4139
hexf = "0.2.1"
42-
mpi = { version = "0.8.*", optional = true }
43-
bempp-distributed-tools = { git = "https://github.com/bempp/distributed_tools.git", optional = true }
40+
mpi = { git = "https://github.com/rsmpi/rsmpi.git", optional = true }
4441

4542
[dev-dependencies]
46-
criterion = { version = "0.5.1", features = ["html_reports"] }
47-
rand_chacha = "0.3"
43+
criterion = { version = "0.7", features = ["html_reports"] }
44+
rand_chacha = "0.9"
4845

4946
[package.metadata.docs.rs]
5047
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
@@ -53,12 +50,12 @@ cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
5350
wildcard_imports = "forbid"
5451

5552
[target.aarch64-apple-darwin.dev-dependencies]
56-
blas-src = { version = "0.10", features = ["accelerate"]}
57-
lapack-src = { version = "0.10", features = ["accelerate"]}
53+
blas-src = { version = "0.14", features = ["accelerate"]}
54+
lapack-src = { version = "0.13", features = ["accelerate"]}
5855

5956
[target.x86_64-unknown-linux-gnu.dev-dependencies]
60-
blas-src = { version = "0.10", features = ["blis"]}
61-
lapack-src = { version = "0.10", features = ["netlib"]}
57+
blas-src = { version = "0.14", features = ["blis"]}
58+
lapack-src = { version = "0.13", features = ["netlib"]}
6259

6360

6461
[[bench]]

benches/helmholtz_c32.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,39 @@ use criterion::{criterion_group, criterion_main, Criterion};
33
extern crate blas_src;
44
extern crate lapack_src;
55

6-
use rlst::prelude::*;
7-
86
use green_kernels::helmholtz_3d::Helmholtz3dKernel;
97
use green_kernels::traits::Kernel;
108
use green_kernels::types::GreenKernelEvalType;
119

1210
use rand::SeedableRng;
11+
use rlst::c32;
12+
use rlst::rlst_dynamic_array;
1313

1414
const NPOINTS: usize = 1000;
1515

1616
pub fn helmholtz_c32_test_standard(c: &mut Criterion) {
1717
let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0);
1818

19-
let mut sources = rlst_dynamic_array2!(f32, [3, NPOINTS]);
20-
let mut targets = rlst_dynamic_array2!(f32, [3, NPOINTS]);
19+
let mut sources = rlst_dynamic_array!(f32, [3, NPOINTS]);
20+
let mut targets = rlst_dynamic_array!(f32, [3, NPOINTS]);
2121

22-
let mut charges = rlst_dynamic_array1!(c32, [NPOINTS]);
22+
let mut charges = rlst_dynamic_array!(c32, [NPOINTS]);
2323

24-
let mut result = rlst_dynamic_array1!(c32, [NPOINTS]);
24+
let mut result = rlst_dynamic_array!(c32, [NPOINTS]);
2525

2626
sources.fill_from_equally_distributed(&mut rng);
27-
targets.fill_from(sources.r());
27+
targets.fill_from(&sources);
2828

2929
charges.fill_from_standard_normal(&mut rng);
3030

3131
c.bench_function("Helmholtz evaluate c32", |b| {
3232
b.iter(|| {
3333
Helmholtz3dKernel::<c32>::new(1.0).evaluate_st(
3434
GreenKernelEvalType::Value,
35-
sources.data(),
36-
targets.data(),
37-
charges.data(),
38-
result.data_mut(),
35+
sources.data().unwrap(),
36+
targets.data().unwrap(),
37+
charges.data().unwrap(),
38+
result.data_mut().unwrap(),
3939
);
4040
})
4141
});

benches/helmholtz_c64.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use criterion::{criterion_group, criterion_main, Criterion};
33
extern crate blas_src;
44
extern crate lapack_src;
55

6-
use rlst::prelude::*;
6+
use rlst::c64;
7+
use rlst::rlst_dynamic_array;
78

89
use green_kernels::helmholtz_3d::Helmholtz3dKernel;
910
use green_kernels::traits::Kernel;
@@ -16,26 +17,26 @@ const NPOINTS: usize = 1000;
1617
pub fn helmholtz_c64_test_standard(c: &mut Criterion) {
1718
let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0);
1819

19-
let mut sources = rlst_dynamic_array2!(f64, [3, NPOINTS]);
20-
let mut targets = rlst_dynamic_array2!(f64, [3, NPOINTS]);
20+
let mut sources = rlst_dynamic_array!(f64, [3, NPOINTS]);
21+
let mut targets = rlst_dynamic_array!(f64, [3, NPOINTS]);
2122

22-
let mut charges = rlst_dynamic_array1!(c64, [NPOINTS]);
23+
let mut charges = rlst_dynamic_array!(c64, [NPOINTS]);
2324

24-
let mut result = rlst_dynamic_array1!(c64, [NPOINTS]);
25+
let mut result = rlst_dynamic_array!(c64, [NPOINTS]);
2526

2627
sources.fill_from_equally_distributed(&mut rng);
27-
targets.fill_from(sources.r());
28+
targets.fill_from(&sources);
2829

2930
charges.fill_from_standard_normal(&mut rng);
3031

3132
c.bench_function("Helmholtz evaluate c64", |b| {
3233
b.iter(|| {
3334
Helmholtz3dKernel::<c64>::new(1.0).evaluate_st(
3435
GreenKernelEvalType::Value,
35-
sources.data(),
36-
targets.data(),
37-
charges.data(),
38-
result.data_mut(),
36+
sources.data().unwrap(),
37+
targets.data().unwrap(),
38+
charges.data().unwrap(),
39+
result.data_mut().unwrap(),
3940
);
4041
})
4142
});

benches/laplace_f32.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,38 @@ use criterion::{criterion_group, criterion_main, Criterion};
33
extern crate blas_src;
44
extern crate lapack_src;
55

6-
use rlst::prelude::*;
7-
86
use green_kernels::laplace_3d::Laplace3dKernel;
97
use green_kernels::traits::Kernel;
108
use green_kernels::types::GreenKernelEvalType;
119

1210
use rand::SeedableRng;
11+
use rlst::rlst_dynamic_array;
1312

1413
const NPOINTS: usize = 1000;
1514

1615
pub fn laplace_f32_test_standard(c: &mut Criterion) {
1716
let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0);
1817

19-
let mut sources = rlst_dynamic_array2!(f32, [3, NPOINTS]);
20-
let mut targets = rlst_dynamic_array2!(f32, [3, NPOINTS]);
18+
let mut sources = rlst_dynamic_array!(f32, [3, NPOINTS]);
19+
let mut targets = rlst_dynamic_array!(f32, [3, NPOINTS]);
2120

22-
let mut charges = rlst_dynamic_array1!(f32, [NPOINTS]);
21+
let mut charges = rlst_dynamic_array!(f32, [NPOINTS]);
2322

24-
let mut result = rlst_dynamic_array1!(f32, [NPOINTS]);
23+
let mut result = rlst_dynamic_array!(f32, [NPOINTS]);
2524

2625
sources.fill_from_equally_distributed(&mut rng);
27-
targets.fill_from(sources.r());
26+
targets.fill_from(&sources);
2827

2928
charges.fill_from_standard_normal(&mut rng);
3029

3130
c.bench_function("Laplace evaluate f32", |b| {
3231
b.iter(|| {
3332
Laplace3dKernel::<f32>::new().evaluate_st(
3433
GreenKernelEvalType::Value,
35-
sources.data(),
36-
targets.data(),
37-
charges.data(),
38-
result.data_mut(),
34+
sources.data().unwrap(),
35+
targets.data().unwrap(),
36+
charges.data().unwrap(),
37+
result.data_mut().unwrap(),
3938
);
4039
})
4140
});

benches/laplace_f64.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,38 @@ use criterion::{criterion_group, criterion_main, Criterion};
33
extern crate blas_src;
44
extern crate lapack_src;
55

6-
use rlst::prelude::*;
7-
86
use green_kernels::laplace_3d::Laplace3dKernel;
97
use green_kernels::traits::Kernel;
108
use green_kernels::types::GreenKernelEvalType;
119

1210
use rand::SeedableRng;
11+
use rlst::rlst_dynamic_array;
1312

1413
const NPOINTS: usize = 1000;
1514

1615
pub fn laplace_f64_test_standard(c: &mut Criterion) {
1716
let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0);
1817

19-
let mut sources = rlst_dynamic_array2!(f64, [3, NPOINTS]);
20-
let mut targets = rlst_dynamic_array2!(f64, [3, NPOINTS]);
18+
let mut sources = rlst_dynamic_array!(f64, [3, NPOINTS]);
19+
let mut targets = rlst_dynamic_array!(f64, [3, NPOINTS]);
2120

22-
let mut charges = rlst_dynamic_array1!(f64, [NPOINTS]);
21+
let mut charges = rlst_dynamic_array!(f64, [NPOINTS]);
2322

24-
let mut result = rlst_dynamic_array1!(f64, [NPOINTS]);
23+
let mut result = rlst_dynamic_array!(f64, [NPOINTS]);
2524

2625
sources.fill_from_equally_distributed(&mut rng);
27-
targets.fill_from(sources.r());
26+
targets.fill_from(&sources);
2827

2928
charges.fill_from_standard_normal(&mut rng);
3029

3130
c.bench_function("Laplace f64 evaluate", |b| {
3231
b.iter(|| {
3332
Laplace3dKernel::<f64>::new().evaluate_st(
3433
GreenKernelEvalType::Value,
35-
sources.data(),
36-
targets.data(),
37-
charges.data(),
38-
result.data_mut(),
34+
sources.data().unwrap(),
35+
targets.data().unwrap(),
36+
charges.data().unwrap(),
37+
result.data_mut().unwrap(),
3938
);
4039
})
4140
});

examples/evaluate_distributed.rs

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
//! Distributed evaluation of sources and targets.
22
3-
use green_kernels::traits::*;
4-
use green_kernels::{laplace_3d::Laplace3dKernel, types::GreenKernelEvalType};
3+
use green_kernels::{
4+
laplace_3d::Laplace3dKernel,
5+
traits::{DistributedKernelEvaluator, Kernel},
6+
types::GreenKernelEvalType,
7+
};
58
use mpi::traits::{Communicator, Root};
69
use rand::prelude::*;
710
use rand_chacha::ChaCha8Rng;
8-
use rlst::prelude::*;
9-
use rlst::{assert_array_relative_eq, rlst_dynamic_array1, RawAccess, RawAccessMut};
11+
use rlst::{assert_array_relative_eq, rlst_dynamic_array};
1012

1113
fn main() {
1214
// Create the MPI communicator
@@ -24,23 +26,23 @@ fn main() {
2426
// Create a Laplace kernel.
2527
let kernel = Laplace3dKernel::<f64>::default();
2628

27-
let mut sources = rlst_dynamic_array1!(f64, [3 * n_sources]);
28-
let mut targets = rlst_dynamic_array1!(f64, [3 * n_targets]);
29-
let mut charges = rlst_dynamic_array1!(f64, [n_sources]);
29+
let mut sources = rlst_dynamic_array!(f64, [3 * n_sources]);
30+
let mut targets = rlst_dynamic_array!(f64, [3 * n_targets]);
31+
let mut charges = rlst_dynamic_array!(f64, [n_sources]);
3032

3133
sources.fill_from_equally_distributed(&mut rng);
3234
targets.fill_from_equally_distributed(&mut rng);
3335
charges.fill_from_equally_distributed(&mut rng);
3436

3537
// Create the result vector.
36-
let mut result = rlst_dynamic_array1!(f64, [n_targets]);
38+
let mut result = rlst_dynamic_array!(f64, [n_targets]);
3739

3840
kernel.evaluate_distributed(
3941
GreenKernelEvalType::Value,
40-
sources.data(),
41-
targets.data(),
42-
charges.data(),
43-
result.data_mut(),
42+
sources.data().unwrap(),
43+
targets.data().unwrap(),
44+
charges.data().unwrap(),
45+
result.data_mut().unwrap(),
4446
false,
4547
&world,
4648
);
@@ -50,51 +52,51 @@ fn main() {
5052
if world.rank() != 0 {
5153
let root_process = world.process_at_rank(0);
5254

53-
root_process.gather_into(sources.data());
54-
root_process.gather_into(targets.data());
55-
root_process.gather_into(charges.data());
56-
root_process.gather_into(result.data());
55+
root_process.gather_into(sources.data().unwrap());
56+
root_process.gather_into(targets.data().unwrap());
57+
root_process.gather_into(charges.data().unwrap());
58+
root_process.gather_into(result.data().unwrap());
5759
} else {
5860
let sources = {
59-
let mut tmp = rlst_dynamic_array1!(f64, [3 * n_sources * world.size() as usize]);
61+
let mut tmp = rlst_dynamic_array!(f64, [3 * n_sources * world.size() as usize]);
6062
world
6163
.this_process()
62-
.gather_into_root(sources.data(), tmp.data_mut());
64+
.gather_into_root(sources.data().unwrap(), tmp.data_mut().unwrap());
6365
tmp
6466
};
6567

6668
let targets = {
67-
let mut tmp = rlst_dynamic_array1!(f64, [3 * n_targets * world.size() as usize]);
69+
let mut tmp = rlst_dynamic_array!(f64, [3 * n_targets * world.size() as usize]);
6870
world
6971
.this_process()
70-
.gather_into_root(targets.data(), tmp.data_mut());
72+
.gather_into_root(targets.data().unwrap(), tmp.data_mut().unwrap());
7173
tmp
7274
};
7375

7476
let charges = {
75-
let mut tmp = rlst_dynamic_array1!(f64, [n_sources * world.size() as usize]);
77+
let mut tmp = rlst_dynamic_array!(f64, [n_sources * world.size() as usize]);
7678
world
7779
.this_process()
78-
.gather_into_root(charges.data(), tmp.data_mut());
80+
.gather_into_root(charges.data().unwrap(), tmp.data_mut().unwrap());
7981
tmp
8082
};
8183

8284
let result = {
83-
let mut tmp = rlst_dynamic_array1!(f64, [n_targets * world.size() as usize]);
85+
let mut tmp = rlst_dynamic_array!(f64, [n_targets * world.size() as usize]);
8486
world
8587
.this_process()
86-
.gather_into_root(result.data(), tmp.data_mut());
88+
.gather_into_root(result.data().unwrap(), tmp.data_mut().unwrap());
8789
tmp
8890
};
8991

90-
let mut expected = rlst_dynamic_array1!(f64, [n_targets * world.size() as usize]);
92+
let mut expected = rlst_dynamic_array!(f64, [n_targets * world.size() as usize]);
9193

9294
kernel.evaluate_mt(
9395
GreenKernelEvalType::Value,
94-
sources.data(),
95-
targets.data(),
96-
charges.data(),
97-
expected.data_mut(),
96+
sources.data().unwrap(),
97+
targets.data().unwrap(),
98+
charges.data().unwrap(),
99+
expected.data_mut().unwrap(),
98100
);
99101

100102
assert_array_relative_eq!(result, expected, 1e-13);

0 commit comments

Comments
 (0)