Error in make CRY example when using G4mpi

Hi everyone,
I add mpi code to CRY geant4 example, but when I make the program it report error in linking step.

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.

I am not very clear, how should i modify Linux-g++.gmk to implement your advice?

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.

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.

My CMakeLists.txt is same as the file in exMPI01, I post it as follow. I can cmake successfully ,but error in make like this:

CRY does not provide cmake, it provide GNUmakefile. So I don’t know how to link CRY library in my current cmakelist.txt
CMakeLists.txt (2.6 KB)

GNUmakefile.txt (851 Bytes) (5.3 KB)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.