Skip to content

gxyd/c_mpi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom MPI Wrapper for Fortran

Welcome to the Custom MPI Wrapper project! This repository contains a Fortran-based implementation of MPI wrappers that bind directly to native MPI library routines using ISO_C_BINDING. The goal is to eliminate intermediate C wrappers and call MPI functions directly from Fortran.

This project currently supports MPI routines such as MPI_Init, MPI_Bcast, MPI_Reduce, MPI_Comm_split_type, MPI_Recv, MPI_Ssend, MPI_Waitall, and more. In addition, the repository provides several tests to verify the correctness of these custom wrappers.


Prerequisites

  • Fortran Compiler:
    You can use LFortran, gfortran, or any standard Fortran compiler.

  • MPI Library:
    This project supports OpenMPI and MPICH. Install the desired MPI library along with its development headers.

  • Conda Environment (Optional):
    It is recommended to create separate conda environments for MPICH and OpenMPI:

    • For MPICH:
      conda create -n mpich_env mpich=4.3.0
      conda activate mpich_env
    • For OpenMPI:
      conda create -n openmpi_env openmpi=5.0.6
      conda activate openmpi_env

Running Tests

The repository contains a collection of standalone tests located in the tests/ directory. These tests validate the functionality of the custom MPI wrappers.

Running All Standalone Tests

To execute all standalone tests, navigate to the tests/ directory and run:

cd tests/
FC='lfortran' ./run_tests.sh

Running a Specific Standalone Test

If you want to run a single test (for example, testFilename.f90), execute:

cd tests/
FC='lfortran' ./run_tests.sh testFilename.f90

Running the pot3d Test

To build and run the pot3d test, navigate to the tests/pot3d/ directory.

  • For Lfortran run:
cd tests/pot3d/
FC='lfortran' ./build_and_run_lfortran.sh
  • For GFortran run:
cd tests/pot3d/
FC='gfortran' ./build_and_run_gfortran.sh

Customizing Compiler Flags

You can pass custom flags to your Fortran compiler using the FC environment variable. For example, to compile with optimization flags using gfortran, run:

FC='gfortran -O3' ./run_tests.sh

This enables you to tailor the compilation process to your needs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published