Skip to content

Commit

Permalink
MPI is now a default dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
tbetcke committed Dec 18, 2024
1 parent 77578ae commit ab50fdf
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 27 deletions.
11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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]
Expand Down
16 changes: 0 additions & 16 deletions examples/test_parallel_assembly.rs
Original file line number Diff line number Diff line change
@@ -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<f64>, n: usize) {
for y in 0..n {
for x in 0..n {
Expand All @@ -54,7 +45,6 @@ fn create_single_element_grid_data(b: &mut SingleElementGridBuilder<f64>, n: usi
}
}

#[cfg(feature = "mpi")]
fn example_single_element_grid<C: Communicator>(
comm: &C,
n: usize,
Expand All @@ -71,14 +61,12 @@ fn example_single_element_grid<C: Communicator>(
}
}

#[cfg(feature = "mpi")]
fn example_single_element_grid_serial(n: usize) -> SingleElementGrid<f64, CiarletElement<f64>> {
let mut b = SingleElementGridBuilder::<f64>::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<C: Communicator>(
comm: &C,
degree: usize,
Expand Down Expand Up @@ -231,7 +219,6 @@ fn test_parallel_assembly_single_element_grid<C: Communicator>(
}
}

#[cfg(feature = "mpi")]
fn main() {
let universe: Universe = mpi::initialize().unwrap();
let world = universe.world();
Expand All @@ -252,6 +239,3 @@ fn main() {
world.barrier();
}
}

#[cfg(not(feature = "mpi"))]
fn main() {}
Empty file added src/boundary_evaluators.rs
Empty file.
3 changes: 0 additions & 3 deletions src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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<C: Communicator>: FunctionSpace {
/// MPI communicator
Expand Down
2 changes: 0 additions & 2 deletions src/function/function_space.rs
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit ab50fdf

Please sign in to comment.