Skip to content

Commit d52d724

Browse files
mhovdmartinjrobins
andauthored
chore: Bump faer to v23.2 (#182)
* Bump faer to 23.2 Faer is finally back in active development! * Use traits from faer over faer_traits * WASM support Manually including the `wasm_js` feature of the `getrandom` crate * Add rustflags * Trying again * Add the platform crate * Bump faer-traits * Attempt to fix wasm target with latest faer This excludes rayon as a feature in faer when the target is wasm * Avoid pulling faer from workspace * match faer versions * move common default features to workspace --------- Co-authored-by: martinjrobins <[email protected]>
1 parent 35b2bf9 commit d52d724

File tree

6 files changed

+28
-9
lines changed

6 files changed

+28
-9
lines changed

.cargo/config.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[net]
2-
git-fetch-with-cli = true
2+
git-fetch-with-cli = true
3+
4+
[target.wasm32-unknown-unknown]
5+
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ repository = "https://github.com/martinjrobins/diffsol"
1313

1414
[workspace.dependencies]
1515
nalgebra = "0.34.0"
16-
faer = "0.22.6"
16+
faer = { version = "0.23.2", default-features = false, features = [
17+
"std",
18+
"sparse-linalg",
19+
"rand",
20+
"npy",
21+
] }
1722
cudarc = { version = "0.16.4", default-features = false }
1823

1924
plotly = { version = "0.12.1" }

diffsol/Cargo.toml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,19 @@ diffsl-llvm18 = ["diffsl/llvm18-1", "diffsl", "diffsl-llvm"]
2828

2929
[dependencies]
3030
nalgebra = { workspace = true }
31-
faer = { workspace = true }
3231
nalgebra-sparse = { version = "0.10", features = ["io"] }
3332
num-traits = "0.2.17"
3433
serde = { version = "1.0.219", features = ["derive"] }
35-
diffsl = { package = "diffsl", version = "0.5.4", optional = true, features = ["rayon"] }
34+
diffsl = { package = "diffsl", version = "0.5.4", optional = true, features = [
35+
"rayon",
36+
] }
3637
petgraph = "0.8.1"
3738
suitesparse_sys = { version = "0.1.3", optional = true }
3839
thiserror = "2.0.12"
39-
faer-traits = "0.22.1"
40+
faer-traits = "0.23.2"
4041
cudarc = { workspace = true, optional = true, default-features = false, features = [
41-
"cuda-version-from-build-system", "cusolver",
42+
"cuda-version-from-build-system",
43+
"cusolver",
4244
"dynamic-linking",
4345
"std",
4446
"cublas",
@@ -49,6 +51,12 @@ cudarc = { workspace = true, optional = true, default-features = false, features
4951
"nvrtc",
5052
] }
5153

54+
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
55+
faer = { workspace = true, features = [ "rayon" ] }
56+
57+
[target.'cfg(target_arch = "wasm32")'.dependencies]
58+
faer = { workspace = true }
59+
5260
[dev-dependencies]
5361
insta = { version = "1.43.1", features = ["yaml"] }
5462
criterion = { version = "0.5.1" }
@@ -64,4 +72,3 @@ harness = false
6472

6573
[package.metadata.docs.rs]
6674
features = ["diffsl-llvm15", "diffsl-cranelift"]
67-

diffsol/src/scalar/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ pub mod cuda;
99
use crate::vector::VectorView;
1010
pub trait Scalar:
1111
nalgebra::Scalar
12-
+ faer_traits::ComplexField
13-
+ faer_traits::RealField
12+
+ faer::traits::ComplexField
13+
+ faer::traits::RealField
1414
+ nalgebra::SimdRealField
1515
+ nalgebra::ComplexField<RealField = Self>
1616
+ num_traits::Signed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[target.wasm32-unknown-unknown]
2+
rustflags = ['--cfg', 'getrandom_backend="wasm_js"']

examples/population-dynamics-wasm-yew/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ diffsol = { path = "../../diffsol", features = [] }
1313
nalgebra = { workspace = true }
1414
yew-plotly = "0.3.0"
1515
web-sys = "0.3.77"
16+
getrandom = { version = "0.3", features = ["wasm_js"] }
17+
platform = "1.0.2"

0 commit comments

Comments
 (0)