[807] | 1 | $Id: README,v 1.2 2007/11/16 14:04:05 kmura Exp $ |
---|
| 2 | ========================================================================== |
---|
| 3 | Geant4 MPI Interface |
---|
| 4 | |
---|
| 5 | Author: |
---|
| 6 | Koichi Murakami (KEK) / Koichi.Murakami@kek.jp |
---|
| 7 | ========================================================================== |
---|
| 8 | |
---|
| 9 | About the interface |
---|
| 10 | =================== |
---|
| 11 | G4MPI is a native interface with MPI libraries. The directory contains |
---|
| 12 | a Geant4 UI library and a couple of parallelized examples. |
---|
| 13 | Using this interface, users applications can be parllelized with |
---|
| 14 | different MPI compliant libraries, such as LAM/MPI, MPICH2, OpenMPI, |
---|
| 15 | and so on. |
---|
| 16 | |
---|
| 17 | System Requirements: |
---|
| 18 | ------------------- |
---|
| 19 | * Platform |
---|
| 20 | |
---|
| 21 | - Linux (32bit/64bit) |
---|
| 22 | - MacOS (Tiger) |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | * MPI implementation |
---|
| 26 | |
---|
| 27 | - LAM/MPI (7.1.3) |
---|
| 28 | http://www.lam-mpi.org/ |
---|
| 29 | |
---|
| 30 | - MPICH2 (1.0.6p1) |
---|
| 31 | http://www.mcs.anl.gov/research/projects/mpich2/ |
---|
| 32 | |
---|
| 33 | - Open MPI (1.2.4) |
---|
| 34 | http://www.open-mpi.org/ |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | * Optional |
---|
| 38 | - ROOT for histogramming/analysis |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | G4MPI UI library |
---|
| 42 | ---------------- |
---|
| 43 | G4MPI UI library is provided in the "mpi_interface" directory. |
---|
| 44 | Start with building the G4MPI UI library according to the instruction |
---|
| 45 | in the directory. |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | How to make parallel applications: |
---|
| 49 | ---------------------------------- |
---|
| 50 | * An example of a main program: |
---|
| 51 | |
---|
| 52 | #include "G4MPImanager.hh" |
---|
| 53 | #include "G4MPIsession.hh" |
---|
| 54 | |
---|
| 55 | int main(int argc,char** argv) |
---|
| 56 | { |
---|
| 57 | // At first, G4MPImanager/G4MPIsession should be created. |
---|
| 58 | G4MPImanager* g4MPI= new G4MPImanager(argc,argv); |
---|
| 59 | |
---|
| 60 | // MPI session (G4MPIsession) instead of G4UIterminal |
---|
| 61 | G4MPIsession* session= g4MPI-> GetMPIsession(); |
---|
| 62 | |
---|
| 63 | // LAM users can use G4tcsh. |
---|
| 64 | G4String prompt= "G4MPI"; |
---|
| 65 | G4UItcsh* tcsh= new G4UItcsh(prompt); |
---|
| 66 | session-> SetShell(tcsh); |
---|
| 67 | |
---|
| 68 | // user application setting |
---|
| 69 | G4RunManager* runManager= new G4RunManager(); |
---|
| 70 | |
---|
| 71 | // .... |
---|
| 72 | |
---|
| 73 | // After user application setting, just start a MPI session. |
---|
| 74 | // MPIsession treats both interactive and batch modes. |
---|
| 75 | session-> SessionStart(); |
---|
| 76 | |
---|
| 77 | // Finally, terminate the program |
---|
| 78 | delete g4MPI; |
---|
| 79 | delete runManager; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | |
---|
| 83 | * Notes about session shell: |
---|
| 84 | |
---|
| 85 | LAM/MPI users can use "G4tcsh" as an interactive session shell. |
---|
| 86 | For other users (Open MPI/MPICH2), plese use G4csh (default). |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | How to use: |
---|
| 90 | ----------- |
---|
| 91 | * MPI runtime rnvironment |
---|
| 92 | |
---|
| 93 | 1. Make hosts/cluster configuration of your MPI environment. |
---|
| 94 | |
---|
| 95 | 2. Launch MPI runtime environment, typically executing |
---|
| 96 | lamboot (LAM) / mpdboot (MPICH2). |
---|
| 97 | |
---|
| 98 | * How to run |
---|
| 99 | For example, |
---|
| 100 | |
---|
| 101 | > mpiexec -n # <your application> |
---|
| 102 | |
---|
| 103 | Instead, "mpirun" command is more convenient for LAM users. |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | MPI G4UI commands: |
---|
| 107 | ------------------ |
---|
| 108 | G4UI commands handling the G4MPI interface are placed in /mpi/. |
---|
| 109 | |
---|
| 110 | Command directory path : /mpi/ |
---|
| 111 | |
---|
| 112 | Guidance : |
---|
| 113 | MPI control commands |
---|
| 114 | |
---|
| 115 | Sub-directories : |
---|
| 116 | Commands : |
---|
| 117 | verbose * Set verbose level. |
---|
| 118 | status * Show mpi status. |
---|
| 119 | execute * Execute a macro file. (=/control/execute) |
---|
| 120 | beamOn * Start a parallel run w/ thread. |
---|
| 121 | .beamOn * Start a parallel run w/o thread. (=/run/beamOn) |
---|
| 122 | masterWeight * Set weight for master node. |
---|
| 123 | showSeeds * Show seeds of MPI nodes. |
---|
| 124 | setMasterSeed * Set a master seed for the seed generator. |
---|
| 125 | setSeed * Set a seed for a specified node. |
---|
| 126 | |
---|
| 127 | * Notes: |
---|
| 128 | While "/run/beamOn" is executed in foreground, the "/mpi/beamOn" |
---|
| 129 | command invokes beam-on in background, so you can input UI commands |
---|
| 130 | even while event processing. |
---|
| 131 | |
---|
| 132 | The original "/control/execute" and "/run/beamOn" are overwritten |
---|
| 133 | with "/mpi/execute" and "/mpi/.beamOn" commands, customized for |
---|
| 134 | the MPI interface. |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | Examples |
---|
| 138 | ======== |
---|
| 139 | There are a couple of examples for Geant4 MPI applications. |
---|
| 140 | |
---|
| 141 | In some cases, you need to set some additional environment variables |
---|
| 142 | for running examples: |
---|
| 143 | |
---|
| 144 | - G4LEVELGAMMADATA : directory path for the data of |
---|
| 145 | "low energy electromagnetic processes". |
---|
| 146 | |
---|
| 147 | For running ROOT applications, |
---|
| 148 | |
---|
| 149 | - ROOTSYS : root path of the ROOT package |
---|
| 150 | - LD_LIBRARY_PATH : add ROOT library path, such as $(ROOTSYS)/lib/root |
---|
| 151 | |
---|
| 152 | |
---|
| 153 | [exMPI01] |
---|
| 154 | A simple application. |
---|
| 155 | |
---|
| 156 | * Geometry : chamber / calorimeter |
---|
| 157 | * Primary : particle gun (200 MeV electron as default) |
---|
| 158 | * Physics List : standard EM |
---|
| 159 | |
---|
| 160 | - Particles are transported in a geometry without any scoring. |
---|
| 161 | - Learn how to parallelize your G4 session. |
---|
| 162 | |
---|
| 163 | |
---|
| 164 | [exMPI02] (ROOT application) |
---|
| 165 | An example of dosimetry in a water phantom. |
---|
| 166 | |
---|
| 167 | * Geometry : water phantom |
---|
| 168 | * Primary : particle gun (200 MeV proton as default) |
---|
| 169 | * Physics List : QGSP_BIC |
---|
| 170 | |
---|
| 171 | - Score dose distribution in a water phantom. |
---|
| 172 | - Learn how to paralleize your applications. |
---|
| 173 | - Create a ROOT file containing histograms in each node. |
---|
| 174 | * treat multiple outputs properly: |
---|
| 175 | each slave node generate a ROOT file, whose file name should |
---|
| 176 | be different from each other. |
---|
| 177 | |
---|