Is it ok for CMake to use c++, rather than mpicxx, to compile my code?

Solution 1:

  • Can source code which originally was getting compiled with mpicxx be compiled with "just" a C++ compiler, with the appropriate includes?

Yes, and you're doing it correctly.

The MPI systems I've used (Cori, Perlmutter, Stampede) have all provided implementations that work correctly with CMake's MPI support. However, it's possible that a sufficiently poorly administered system will break this.

  • Assuming there's any merit to using mpicxx for compilation - how do I get CMake to use it for my target?

This is a toolchain setting... set CMAKE_CXX_COMPILER to /path/to/mpicxx either at the command line, in a preset, or in a toolchain file.