Compiling and Installing Geant4
Procedure
- Use PuTTY to log in to the server as the root user.
- Configure OpenGL.
yum install -y mesa* yum install -y freeglut* yum install -y *GLEW* yum install -y openssl-devel
- Switch to the DATA directory.
cd /path/to/DATA
- Create a script for decompression.
- Create a script.
vi run.sh
- Press i to enter the insert mode and add the following content to decompress data packages in batches:
#!/bin/bash for wav in ./*.tar.gz; do echo "Extracting wav from $wav" tar -xvf $wav done - Press Esc, type :wq!, and press Enter to save the script and exit.
- Create a script.
- Add execution permissions for the script.
chmod +x run.sh
- Decompress the data files.
sh run.sh
- Set environment variables for data files.
- Open data_source.
vi data_source
- Press i to enter the insert mode and add the following content to set environment variables:
export G4SAIDXSDATA=/path/to/DATA/G4SAIDDATA2.0 export G4LEDATA=/path/to/DATA/G4EMLOW7.9.1 export G4LEVELGAMMADATA=/path/to/DATA/PhotonEvaporation5.5 export G4INCLDATA=/path/to/DATA/G4INCL1.0 export G4PARTICLEXSDATA=/path/to/DATA/G4PARTICLEXS2.1 export G4PIIDATA=/path/to/DATA/G4PII1.3 export G4RADIOACTIVEDATA=/path/to/DATA/RadioactiveDecay5.4 export G4REALSURFACEDATA=/path/to/DATA/RealSurface2.1.1 export G4ABLADATA=/path/to/DATA/G4ABLA3.1 export G4NEUTRONHPDATA=/path/to/DATA/G4NDL4.6 export G4ENSDFSTATEDATA=/path/to/DATA/G4ENSDFSTATE2.2 export G4TENDLDATA=/path/to/DATA/G4TENDL1.3.2
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open data_source.
- Run the following command to make the environment variables take effect:
source data_source
- Decompress the Geant4 installation package.
tar -xvf geant4.10.06.p01.tar.gz
- Create a build folder and switch to the folder.
mkdir geant4.10.06.p01/build cd geant4.10.06.p01/build
- Compile Geant4.
CC=mpicc CXX=mpicxx CFLAGS='-O3 -finline-functions -march=armv8.2-a -flto' cmake -DCMAKE_INSTALL_PREFIX=/path/to/GEANT4/geant4.10.06.p01-install -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_BUILD_MULTITHREADED=ON ../
- Run the following commands to install Geant4:
make -j16 make install
- Switch to the parallel module directory.
cd /path/to/GEANT4/geant4.10.06.p01/examples/extended/parallel/MPI/source
- Create a build directory and switch to the directory.
mkdir build cd build
- Compile the parallel module.
CC=mpicc CXX=mpicxx CFLAGS='-O3 -finline-functions -march=armv8.2-a -flto' cmake -DCMAKE_INSTALL_PREFIX=/path/to/GEANT4/geant4.10.06.p01-install/lib64 ../
- Install the parallel module.
make -j16 make install
Parent topic: Geant4 10.6 Porting Guide (CentOS 7.6)