Running Geant

From New IAC Wiki
Jump to navigation Jump to search

Using the pre-installed version on aztec.iac.isu.edu

Aztec has a system-wide installed version of geant4 that may be easier to use than compiling and installing your own version. This version uses qt4, xaw, xm, opengl, raytracer, and openinventor visualization plugins.

The examples need to be copied and Configure run once to set up the environment.

oborn@aztec:~$ mkdir geant4
oborn@aztec:~$ cd geant4/
oborn@aztec:~/geant4$ cp -r /opt/geant4/geant4.9.3.p02/examples ./
oborn@aztec:~/geant4$ /opt/geant4/geant4.9.3.p02/Configure 
                --- Geant4 Toolkit Installation  ---
                 (setting environments for USER )
---------------------------------------------------
The Geant4 toolkit installation was found.
The files env.[c]sh will be copied to your current directory.
For setting Geant4 environments you should make:
. env.sh
It will also check G4WORKDIR setting and set it to
your HOME if needed.
You can use these files also for further modifications
(adding your own environments).
---------------------------------------------------

". env.sh" needs to be run after every login (or it can be added to .bashrc)

oborn@aztec:~/geant4$ . env.sh 
On this machine the G4SYSTEM=Linux-g++
On this machine the G4INSTALL=/opt/geant4/geant4.9.3.p02
On this machine the G4LIB=/opt/geant4/geant4.9.3.p02/lib
On this machine the G4LEVELGAMMADATA=/opt/geant4/PhotonEvaporation2.0
On this machine the G4RADIOACTIVEDATA=/opt/geant4/RadioactiveDecay3.2
On this machine the G4LEDATA=/opt/geant4/G4EMLOW6.9
On this machine the G4NEUTRONHPDATA=/opt/geant4/G4NDL3.13
On this machine the G4ABLADATA=/opt/geant4/G4ABLA3.0
On this machine the G4REALSURFACEDATA=/opt/geant4/RealSurface1.0
On this machine the CLHEP_BASE_DIR=/opt/clhep_2.1.0.1
......
On this machine the QTMOC=/usr/bin/moc-qt4
On this machine the G4LIB_BUILD_SHARED=1

Now the example can be built just by calling make in the directory.

oborn@aztec:~/geant4$ cd examples/novice/N01/
oborn@aztec:~/geant4/examples/novice/N01$ make
Making dependency for file exampleN01.cc ...
......
Using global libraries ...
Linking exampleN01
... Done!

And the example can be run but calling the newly-created excutable:

oborn@aztec:~/geant4/examples/novice/N01$ ~/geant4/bin/Linux-g++/exampleN01 
*************************************************************
Geant4 version Name: geant4-09-03-patch-02    (17-September-2010)
                     Copyright : Geant4 Collaboration
                     Reference : NIM A 506 (2003), 250-303
                           WWW : http://cern.ch/geant4
*************************************************************
========= Table of registered couples ==============================
......
Track (trackID 1, parentID 0) is processed with stopping code 2
NULL returned from G4StackManager.
Terminate current event processing.
Run terminated.
Run Summary
 Number of events processed : 3
 User=0s Real=0.02s Sys=0s
G4 kernel has come to Quit state.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Maximum number of tracks in the urgent stack : 1
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
oborn@aztec:~/geant4/examples/novice/N01$


Running geant4 with multiple processes

Geant doesn't have any parallel facilities built-in naturally, but there are several methods and libraries that can be used to parallelize you code.

Using TOP-C

TOP-C hasn't been updated since 2007 and is somewhat depreciated. However, it is still used by some codes and examples so it is worth demonstrating.

First, setup geant normally:

oborn@aztec:~$ cd geant4/
oborn@aztec:~/geant4$ . env.sh
On this machine the G4SYSTEM=Linux-g++
On this machine the G4INSTALL=/opt/geant4/geant4.9.3.p02
......
On this machine the G4LIB_BUILD_SHARED=1
oborn@aztec:~/geant4$

Additionally, add topc to the PATH environment variable.

oborn@aztec:~/geant4$ export PATH=$PATH:/opt/topc/bin

Then just change to the directory and call make:

oborn@aztec:~/geant4$ cd examples/extended/parallel/ParN02/
oborn@aztec:~/geant4/examples/extended/parallel/ParN02$ make 
Making dependency for file ParN02.cc ...
Making dependency for file src/ParRunManager.cc ...
......
touch /home/oborn/geant4/bin/Linux-g++/ParN02
To run, now type "make run"
To remove built files, type "make parclean"
oborn@aztec:~/geant4/examples/extended/parallel/ParN02$ 

To run the parallel version use make run:

oborn@aztec:~/geant4/examples/extended/parallel/ParN02$ make run
make G4BINDIR=$G4WORKDIR/bin/Linux-g++ $G4WORKDIR/bin/Linux-g++/ParN02.timestamp
make[1]: `/home/oborn/geant4/bin/Linux-g++/ParN02.timestamp' is up to date.
To run, now type "make run"
To remove built files, type "make parclean"
pwd
/home/oborn/geant4/examples/extended/parallel/ParN02
......
>>> Event 99
   0 trajectories stored in this event.
Graphics systems deleted.
Visualization Manager deleting...
oborn@aztec:~/geant4/examples/extended/parallel/ParN02$

Using MPI

TODO


Running geant4 with slurm on brems

TODO