From ed5bc4ade6fcaee31c98ed6934b22e7bcddaec66 Mon Sep 17 00:00:00 2001 From: Timo Betcke Date: Wed, 11 Dec 2024 10:01:11 +0000 Subject: [PATCH] Fixed MPI dependencies --- Cargo.toml | 10 +++++++++- src/sparse/sparse_mat/tools.rs | 9 +++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) 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],