Documentation for BELFEM's MPI communication abstraction layer.
Contents
Guides
- comm_usage_guide.md - Comprehensive usage guide for BELFEM MPI communication
- Global communicator (gComm)
- Type-safe MPI datatype mapping
- Broadcast operations (scalars, Cells, Vectors, Matrices)
- Point-to-point communication (send/receive)
- Collective operations (distribute/collect)
- Common parallel patterns
- Performance tips and debugging
Quick Reference
Core Components
Utility Functions
| Function | Purpose |
| comm_size() | Get number of processes |
| comm_rank() | Get current process rank |
| comm_barrier() | Synchronize all processes |
| comm_tag(src, tgt) | Generate unique message tag |
| comm_split(len) | Split message into chunks |
Communication Operations
| Operation | Types Supported |
| Broadcast | Scalar, Cell, Vector, Matrix, Cell<string> |
| Send/Receive | Scalar, Raw array, Cell, Vector, Matrix, String |
| Distribute | Cell, Vector, Cell<Vector>, Cell<Cell>, Cell<Matrix>, Raw array |
| Collect | Cell, Vector, Cell<Vector>, Cell<Matrix>, Raw array |
| Share | Cell, Vector |
Build Configuration
# MPI build (default if MPI available)
cmake -DUSE_MPI=ON ..
# Non-MPI build (serial fallback)
cmake -DUSE_MPI=OFF ..
Open MPI is the only supported implementation. MPICH and Intel MPI are untested — PETSc has been observed to crash when called on that path — and the configure step refuses them. Using the Intel compilers is fine; build Open MPI with them rather than substituting Intel MPI. See mpi_support.md for the guard, the override, and why the Open MPI link flags in the MUMPS and MKL configs must not be "made portable".
Common Patterns
Vector<real> v;
if (comm_rank() == 0) v = {1, 2, 3};
broadcast(v, 0);
if (comm_rank() == 0) send(data, 1);
if (comm_rank() == 1) receive(data, 0);
Cell<int> send_data(comm_size(), 0);
distribute(send_data);
Cell<int> recv_data;
collect(recv_data, my_value);
belfem::Communicator gComm
Definition belfem.cpp:35
int finalize()
Definition cl_Communicator.cpp:295
void init(int &argc, char **&argv)
Definition cl_Communicator.cpp:96
See Also