Skip to content

Commit 7da718f

Browse files
magnusuMETgauteh
authored andcommitted
Force ndarray 0.15 to have rayon feature enabled
1 parent b1abf36 commit 7da718f

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

Cargo.lock

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ hdf5-sys = { package = "hdf5-metno-sys", version = "0.9.1" }
3636
log = "0.4"
3737
rayon = "1.10"
3838
ndarray = { version = "0.16", features = [ "rayon" ] }
39+
# Remove when https://github.com/PyO3/rust-numpy/pull/439 is addressed
40+
ndarray_0_15 = { package = "ndarray", version = "0.15", features = ["rayon"] }
3941
pyo3 = { version = "0.21", optional = true, features = ["anyhow", "auto-initialize", "abi3-py39"] }
4042
numpy = { version = "0.21.0", optional = true }
4143
netcdf = { version = "0.10.4", optional = true }

src/python/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl Dataset {
164164
let arr = arr.downcast::<PyArrayDyn<T>>().unwrap();
165165

166166
let mut v = unsafe { arr.as_array_mut() };
167-
v.mapv_inplace(|v| if v == cond { fv } else { v });
167+
v.par_mapv_inplace(|v| if v == cond { fv } else { v });
168168
}
169169
}
170170

0 commit comments

Comments
 (0)