Exploring a simple MPI cartesian grid with halo region updates, mpi_f08
, havaita
, some clever encapsulation, and general project structure and architecture.
- Specifications
- Getting Started
- Development Tools
- Documentation
- Contributing
- Contact
- License
- Appendix
Key features implemented:
- MPI Cartesian Grid
- 3D topology with configurable dimensions and periodicity
- Automatic decomposition via
MPI_Dims_create
- Neighbor discovery using
MPI_Cart_shift
- Halo Region Updates
- Blocking communication via
MPI_SendRecv
- Static transfer buffers for real and integer types
- Interface-based type handling
- Blocking communication via
- Boundary Conditions
- Periodic (MPI-handled), Dirichlet, Neumann
- Integrated with MPI topology for domain boundaries
- Parameterized boundary types per face
- Modern MPI Interface
- Migration to
mpi_f08
for improved type safety - Enhanced error handling and propagation
- Fortran 2008 submodules for implementation hiding
- Migration to
- Advanced Communication
- Non-blocking halo exchanges via
MPI_Isend
/MPI_Irecv
- One-sided communication options for boundaries
- Derived datatypes for halo regions
- Non-blocking halo exchanges via
- Development Infrastructure
- Parallel testing framework with
fpm
- Distributed logging system
- Performance benchmarking suite
- Parallel testing framework with
- Linux OS or WSL2 via Windows
- GFortran or oneAPI Fortran compiler
- MPI/MPICH installation. Currently testing on OpenMPI v5.0.2
- VS Code installation
- Modern Fortran extension installation
-
Load compiler modules (if using a compute cluster):
module load gcc openmpi # or module load intel intelmpi
-
Create and activate a Python environment:
python3 -m venv .venv source .venv/bin/activate # Remember to activate your enviroment before runtime or development tasks.
-
Install the runtime and development packages:
pip3 install . # Install runtime dependencies from pyproject.toml pip3 install .[dev] # Install development dependencies
-
Run the tests and main program:
fpm test # by default it uses gcc/gfortran to compile and run fpm run sendrecv_1D
The template includes preconfigured development tools and settings for Modern Fortran development, with optimized configurations for:
- VS Code integration
- Language server features
- Code formatting
- Automated testing
- Package management
For detailed setup instructions and tool configurations, see TOOLING.md.
Automated documentation is generated by using the ford package. For example config files and usage, see here.
To generate dcoumentation for this sample project, and then view it on the browser, run:
ford ford.md
firefox docs/ford/index.html # Alternatively, use your preferred browser
Contributions from the community are welcome. To contribute, consider opening an issue or pull request with changes and suggestions.
For questions or suggestions, please contact me at email or open an issue.
The project is operating under an MIT license. You are free to use, modify, and distribute the code as needed for your project. Feel free to adapt and customize it to suit your requirements.
$ tree -Ia '__pycache__|.git|.pytest_cache|.venv|build|.gen*|ford'
.
├── app # The main program driver(s) resides here
│ └── main.f90
├── docs
│ ├── MIGRATION.md
│ └── TOOLING.md
├── ford.md # FORD config file
├── .fortls # VSCode Modern Fortran config file
├── fpm.toml # Fortran Package Manager config file
├── .fprettify.rc # fprettify config file
├── .gitignore # Git ignore list of files and directories
├── LICENSE
├── .pre-commit-config.yaml # pre-commit config file
├── pyproject.toml # config file
├── README.md # you are here!
├── src # All source code files are placed in here, except main driver
│ └── first_steps.f90
├── test # All tests are placed in here
│ └── check.f90
└── .vscode # Holds VSCode configs and runtime/debugging tasks
├── extensions.json # simply populates the "Recommended" Extensions tab
└── settings.json # also referred to as "Workspace Settings (JSON)"