I think maybe it because the default complier is not mpicxx, I don’t know how to call the correct complier to make this example. Could someone help me? thanks!
The MPI examples are not actively maintained at the moment, and see Error while instal G4mpi library for the limitations on MPI implementation this implies. Also, the G4mpi example was never designed to work with the the Geant4 GNUmake system, which isn’t MPI aware. It would be necessary to use CMake in this case, or modify Linux-g++.gmk to be MPI aware.
You would need to change the compiler commands in that from gcc/g++ to mpicc/mpicxx or similar, and also change the compiler flags if/as needed. I’d strongly recommend using CMake instead as this supports MPI well (see, e.g. https://cliutils.gitlab.io/modern-cmake/chapters/packages/MPI.html)
I have tried using CMake previously. I modify on the example–exMPI adding the CRY code, but still met error when make. The program cannot link the CRY library… It said cannot find CRYsetup.hh ,like this…
If you can post your CMakeLists.txt, we can take a look - does CRY provide a cmake configuration file (e.g. CRYConfig.cmake) or a FindCRY.cmake module that can be used with CMake’s find_package?
Just to note further that if you are using the G4mpi code, then this is only going to work with quite old versions of MPI (see Error while instal G4mpi library). If you’re adding your own MPI calls, then that’s fine.