Lab setup of software: Geant4
100 likes | 133 Vues
Step-by-step instructions for setting up Geant4 software on various operating systems, including requirements, installation process, environment variables setup, and running simulations with multithreading, command line usage, and cluster configurations.
Lab setup of software: Geant4
E N D
Presentation Transcript
Lab setup of software: Geant4 José A. Ramos Méndez, PhD. University of California San Francisco
Requirements • The requirements vary from one OS system to others. But essentially one needs (either main package and developer libraries): • C++ and GLIBC • CMAKE • OpenGL • X11 libraries • EXPAT • Debian-based • apt-get install expat-dev • RedHat-based • yum install expat-devel • OSX • port install expat FCFM-BUAP, Puebla, Pue.
geant4.web.cern.ch FCFM-BUAP, Puebla, Pue.
Installation • Create a directory named Geant4 in your home directory. • Uncompress Geant4 and the DATA files downloaded from the webpage • Create the directories: Geant4/geant4-build and Geant4/geant4-install • Inside Geant4/geant4-build do the follow: cmake ../geant4.xxx.xxx -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_RAYTRACER_X11=ON -DEXPAT_LIBRARY=/usr/lib/libexpat.so -DGEANT4_INSTALL_DATA=OFF -DCMAKE_INSTALL_PREFIX=../geant4-install • Then: make -jN where N is the number of CPUs in your PC • Finally make install FCFM-BUAP, Puebla, Pue.
Installation • Setup the environment variables: • For example if your Geant4 is at your $HOME/Geant4, then export GEANT4=$HOME/Geant4 export Geant4_DIR=$GEANT4/geant4-install export G4LEDATA=$GEANT4/G4EMLOW6.41 export G4NEUTRONHPDATA=$GEANT4/G4NDL4.5 export G4SAIDXSDATA=$GEANT4/G4SAIDDATA1.1 export G4NEUTRONXSDATA=$GEANT4/G4NEUTRONXS1.4 export G4LEVELGAMMADATA=$GEANT4/PhotonEvaporation3.1 export G4RADIOACTIVEDATA=$GEANT4/RadioactiveDecay4.2 • Add those lines to ~/.bashrc; ~/.bash_profile FCFM-BUAP, Puebla, Pue.
Running • user@user$ cd $GEANT4/geant4.xxx.xxx • user@user$ cd examples/basic/B1 • user@user$ mkdir build • user@user$ cd build • user@user$ cmake ../ • user@user$ make -jN • user@user$ ./exampleB1 run1.mac • user@user$ ./exampleB1 FCFM-BUAP, Puebla, Pue.
The command line and parallelism FCFM-BUAP, Puebla, Pue.
Running • Let’s start with the example Geant4/basic/B1 • user@user:$ ./exampleB1 • Idle> /run/beamOn 10 • Like-Unix commands. Do not use in a macro. • cd, pwd - jump to a command directory and shows the path, respectively • ls - all available commands • history - used commands • ?UICommand- shows the parameter of command UICommand • helpUICommand - Provide detailed help, navigate it through keyboard • exit - Finalize simulation FCFM-BUAP, Puebla, Pue.
Multithreading • In exampleB1.cc add G4cout << “##### “ << G4Threading::GetNumberOfCores() << “ ####” << G4endl; • rebuild and execute. Then you can set /run/numberOfThreads 4 Or runManger->SetNumberOfThreads( G4Threading::GetNumberOfCores() ); FCFM-BUAP, Puebla, Pue.
Cluster • Let’s play with the random generation seed. • In exampleB1.cc G4int myseed = G4UIcommand::ConvertToInt(argv[2]); G4Random::setTheSeed(mySeed); • Rebuild and execute for different seeds ./exampleB1 run1.mac 2324 • Everyone pick a ID number, we will use in each simulation. FCFM-BUAP, Puebla, Pue.