add c wrapper to allow testing fortran interface w/o fortran MPI libs

This commit is contained in:
Axel Kohlmeyer
2022-12-11 17:50:03 -05:00
parent 0984b11cb4
commit c0a39dc7b8
4 changed files with 48 additions and 61 deletions

View File

@ -17,6 +17,14 @@ void f_lammps_close();
int f_lammps_get_comm();
}
// C wrapper to split MPI communicator w/o requiring a Fortran MPI lib
extern "C" int create_mpi_comm_split(int color, int key)
{
MPI_Comm c_newcomm = MPI_COMM_NULL;
MPI_Comm_split(MPI_COMM_WORLD, color, key, &c_newcomm);
return MPI_Comm_c2f(c_newcomm);
}
TEST(open_no_mpi, no_args)
{
::testing::internal::CaptureStdout();