Fix return type of MPIContext::get_handle#212
Fix return type of MPIContext::get_handle#212andrewcoughtrie merged 5 commits intoMetOffice:mainfrom
Conversation
The get_handle() method should return an MPI_Comm and not an int, because this causes failures when building with OpenMPI.
There was a problem hiding this comment.
The change itself looks good, I've tested it with an OpenMPI based stack and it built successfully, however one of the unit-tests fails with the following error and will need sorting out.
[ RUN ] MPINotInitTest.MpiNotInitialised
*******************/Vernier/tests/unit_tests/c++/test_mpi_not_init.cpp:20: Failure
Death test: { meto::vernier.init(); }
Result: died but not with expected exit code:
Exited with exit status 14
Actual msg:
[ DEATH ] MPIContext::init. MPI not initialized.
[ DEATH ] *** The MPI_Abort() function was called before MPI_INIT was invoked.
[ DEATH ] *** This is disallowed by the MPI standard.
[ DEATH ] *** Your MPI job will now abort.
[ DEATH ] [************] Local abort before MPI_INIT completed completed successfully, but am not able to aggregate error messages, and not able to guarantee that all other processes were killed!
[ DEATH ]
[ FAILED ] MPINotInitTest.MpiNotInitialised (2 ms)
[----------] 1 test from MPINotInitTest (2 ms total)
|
The test output is correct: Vernier does not comply with the MPI standard because it calls
MPICH is clearly willing to tolerate this but OpenMPI is not. It should be possible to resolve the problem by protecting the |
Check whether MPI is initialised before trying to call MPI_Abort. This improves compliance with the standard and prevents test failures when building with OpenMPI.
|
Clean run with OpenMPI: |
andrewcoughtrie
left a comment
There was a problem hiding this comment.
This is a good change and fixes the issue. All the tests pass with OpenMPI
Description
The get_handle() method should return an MPI_Comm and not an int, because this causes failures when building with OpenMPI. This changes the prototype in the header file and the method in the source file to address the problem.
Linked issues
NA
Type of change
How has this been tested?
Prior to the fix, code would not compile with OpenMPI:
Following the change, the code now compiles successfully with OpenMPI. Change was also validated by building with MPICH.
Checklist: