diff --git a/Cargo.toml b/Cargo.toml index 4dd959cd..c577ffcf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,4 @@ [features] -mpi = ["dep:mpi", "ndelement/mpi", "ndgrid/mpi"] sleef = ["rlst/sleef", "green-kernels/sleef", "ndelement/sleef", "ndgrid/sleef"] strict = [] default = ["sleef"] @@ -28,13 +27,13 @@ crate-type = ["lib", "cdylib"] [dependencies] bempp-quadrature = { version = "0.1.0" } itertools = "0.13.*" -mpi = { version = "0.8.*", optional = true } +mpi = { version = "0.8.*"} num = "0.4" -ndelement = { git="https://github.com/bempp/ndelement.git", default-features = false } -ndgrid = { git="https://github.com/bempp/ndgrid.git", default-features = false } +ndelement = { git="https://github.com/bempp/ndelement.git", features = ["mpi"]} +ndgrid = { git="https://github.com/bempp/ndgrid.git", features = ["mpi"] } rayon = "1.9" -rlst = { git = "https://github.com/linalg-rs/rlst.git", default-features = false } -green-kernels = { git = "https://github.com/bempp/green-kernels.git", default-features = false } +rlst = { git = "https://github.com/linalg-rs/rlst.git", features = ["mpi"] } +green-kernels = { git = "https://github.com/bempp/green-kernels.git", features = ["mpi"] } c-api-tools = { version = "0.1.0" } [dev-dependencies] diff --git a/examples/test_parallel_assembly.rs b/examples/test_parallel_assembly.rs index ed6f7cae..8c184af3 100644 --- a/examples/test_parallel_assembly.rs +++ b/examples/test_parallel_assembly.rs @@ -1,39 +1,30 @@ //? mpirun -n {{NPROCESSES}} --features "mpi" -#[cfg(feature = "mpi")] use approx::assert_relative_eq; -#[cfg(feature = "mpi")] use bempp::{ boundary_assemblers::BoundaryAssemblerOptions, function::{FunctionSpace, ParallelFunctionSpace, SerialFunctionSpace}, laplace, }; -#[cfg(feature = "mpi")] use itertools::izip; -#[cfg(feature = "mpi")] use mpi::{ collective::CommunicatorCollectives, environment::Universe, request::WaitGuard, traits::{Communicator, Destination, Source}, }; -#[cfg(feature = "mpi")] use ndelement::{ ciarlet::{CiarletElement, LagrangeElementFamily}, types::{Continuity, ReferenceCellType}, }; -#[cfg(feature = "mpi")] use ndgrid::{ grid::parallel::ParallelGrid, traits::{Builder, Entity, Grid, ParallelBuilder}, SingleElementGrid, SingleElementGridBuilder, }; -#[cfg(feature = "mpi")] use rlst::{CsrMatrix, Shape}; -#[cfg(feature = "mpi")] use std::collections::{hash_map::Entry, HashMap}; -#[cfg(feature = "mpi")] fn create_single_element_grid_data(b: &mut SingleElementGridBuilder, n: usize) { for y in 0..n { for x in 0..n { @@ -54,7 +45,6 @@ fn create_single_element_grid_data(b: &mut SingleElementGridBuilder, n: usi } } -#[cfg(feature = "mpi")] fn example_single_element_grid( comm: &C, n: usize, @@ -71,14 +61,12 @@ fn example_single_element_grid( } } -#[cfg(feature = "mpi")] fn example_single_element_grid_serial(n: usize) -> SingleElementGrid> { let mut b = SingleElementGridBuilder::::new(3, (ReferenceCellType::Quadrilateral, 1)); create_single_element_grid_data(&mut b, n); b.create_grid() } -#[cfg(feature = "mpi")] fn test_parallel_assembly_single_element_grid( comm: &C, degree: usize, @@ -231,7 +219,6 @@ fn test_parallel_assembly_single_element_grid( } } -#[cfg(feature = "mpi")] fn main() { let universe: Universe = mpi::initialize().unwrap(); let world = universe.world(); @@ -252,6 +239,3 @@ fn main() { world.barrier(); } } - -#[cfg(not(feature = "mpi"))] -fn main() {} diff --git a/src/boundary_evaluators.rs b/src/boundary_evaluators.rs new file mode 100644 index 00000000..e69de29b diff --git a/src/function.rs b/src/function.rs index 65c8666d..5a1bd283 100644 --- a/src/function.rs +++ b/src/function.rs @@ -2,11 +2,9 @@ mod function_space; -#[cfg(feature = "mpi")] pub use function_space::ParallelFunctionSpace; pub use function_space::SerialFunctionSpace; -#[cfg(feature = "mpi")] use mpi::traits::Communicator; use ndelement::{traits::FiniteElement, types::ReferenceCellType}; use ndgrid::{traits::Grid, types::Ownership}; @@ -66,7 +64,6 @@ pub trait FunctionSpace { fn ownership(&self, local_dof_index: usize) -> Ownership; } -#[cfg(feature = "mpi")] /// A function space in parallel pub trait MPIFunctionSpace: FunctionSpace { /// MPI communicator diff --git a/src/function/function_space.rs b/src/function/function_space.rs index 9f6f2d66..22f3e9e5 100644 --- a/src/function/function_space.rs +++ b/src/function/function_space.rs @@ -1,11 +1,9 @@ //! Function space mod common; -#[cfg(feature = "mpi")] mod parallel; mod serial; use common::assign_dofs; -#[cfg(feature = "mpi")] pub use parallel::ParallelFunctionSpace; pub use serial::SerialFunctionSpace;