Geant4 Multitthreaded on Supercomputer cluster

Dear experts,

I am running a series of Geant4 simulations in the supercomputer cluster of my university. My Geant4 was compiled with Multithreading enabled, and so I can make use of the multiple available cores there. The cluster itself is composed by multiple computers, that have the ability of sharing cores between each other.
Now, my requirement in running my simulations has been so far that all the cores must be from the same host, but would Geant4 have any problems if I allow it to run with shared hosts? Would I need to activate enable anything in the code, or when building Geant4?

Thanks a lot in advance.

_Geant4 Version:_10.7.3
_Operating System:_Linux Debian
_Compiler/Version:_GCC 10.4.0
_CMake Version:_3.25.1


What technology/interface is used to share cores? MPI or something else?

Geant4 doesn’t have direct support for MPI, though there is an extended example for older MPI implementations. Depending on the setup and queuing system on the cluster, you can still run multiple jobs of the same application in parallel to make up to the needed statistics, merging/combining the output results appropriately. Care would be needed to ensure each run is statistically independent, though that should just be a case of ensuring each process is started with a different random number seed.

1 Like

Thanks for the feedback!

Yes, I think it is MPI. I have set “/run/useMaximumLogicalCores” in my macro, and tried running the code with shared cores, but the cluster manager almost immediately killed my job :sweat_smile:. So for now I’m running in the cluster with the requirement that all cores must be from the same machine.
I took a look at the MPI example and it sounds very promising. I’ll try to implement it, and send a feedback here :slight_smile:
Thanks a lot again for the help and suggestion.

Dear @bmorgan,

I was able to compile the MPI examples for Geant4, and I see that there are a couple of additional steps in order to make my application fully in accordance with MPI. An additional question I have is, does G4ScoringManager automatically takes care of dumping all quantities in the MPI case as it does for multithreading?

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