diff --git a/Cargo.toml b/Cargo.toml index c2cf972..32ce3e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,7 @@ git2 = "0.19" [features] strict = [] -default = ["mpi"] +default = [] mpi = ["dep:mpi", "dep:mpi-sys"] suitesparse = [] disable_system_blas_lapack = [] @@ -97,3 +97,11 @@ required-features = ["mpi"] [[example]] name = "mpi_scatter_vector" required-features = ["mpi"] + +[[example]] +name = "distributed_csr_matmul" +required-features = ["mpi"] + +[[example]] +name = "cg_distributed" +required-features = ["mpi"] diff --git a/src/sparse/sparse_mat/tools.rs b/src/sparse/sparse_mat/tools.rs index 76da8aa..8e9aebb 100644 --- a/src/sparse/sparse_mat/tools.rs +++ b/src/sparse/sparse_mat/tools.rs @@ -1,7 +1,11 @@ //! Tools for sparse matrix handling use itertools::{izip, Itertools}; -use mpi::datatype::{Partition, PartitionMut}; -use mpi::traits::{CommunicatorCollectives, Equivalence}; + +#[cfg(feature = "mpi")] +use { + mpi::datatype::{Partition, PartitionMut}, + mpi::traits::{CommunicatorCollectives, Equivalence}, +}; use crate::dense::types::RlstScalar; use crate::sparse::sparse_mat::SparseMatType; @@ -154,6 +158,7 @@ pub fn sort_to_bins(sorted_keys: &[T], bins: &[T]) -> Vec { bin_counts } +#[cfg(feature = "mpi")] /// Redistribute an array via an all_to_all_varcount operation. pub fn redistribute( arr: &[T],