Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/examples/advanced/CaTS/Instructions.md is written in an unsupported language. File is not indexed.

0001 # Prerequisites
0002 Opticks requires Geant4 (10.7.p02), nvidia cuda (11.3)  and nvidia Optix (6.5) among other libraries. CaTS in addition will require ROOT. If all these libraries and development headers are available on your machine skip directly to  (**Building opticks vs. existing libraries**). On a 'blank' computing system it makes sense to build CLHEP, then Geant4 and finally ROOT assuring that all the necessary development libraries and headers are installed.   
0003 
0004 # Building CLHEP
0005 The current version of Geant4 10.07.p02 is build on clhep 2.4.4.0. 
0006 CLHEP can be found at:
0007 https://proj-clhep.web.cern.ch/proj-clhep/clhep23.html
0008 
0009 to build it from scratch using cmake (used cmake version 3.20.5) 
0010 
0011     cd to the directory where you want to build clhep
0012     wget https://proj-clhep.web.cern.ch/proj-clhep/dist1/clhep-2.4.4.0.tgz
0013     tar xzvf clhep-2.4.4.0.tgz
0014     cd 2.4.4.0/
0015     mkdir CLHEP-build
0016     cd  CLHEP-build
0017     cmake -DCMAKE_INSTALL_PREFIX=../CLHEP-install DCLHEP_BUILD_CXXSTD=-std=c++11 ../CLHEP
0018     make -j 8
0019     make install
0020 
0021 **Note** the default install directory is /usr/local but one needs root privileges to install it there:
0022 
0023     cd to the directory where you want to build clhep
0024     wget https://proj-clhep.web.cern.ch/proj-clhep/dist1/clhep-2.4.4.0.tgz
0025     tar xzvf clhep-2.4.4.0.tgz
0026     cd 2.4.4.0/
0027     mkdir CLHEP-build
0028     cd  CLHEP-build
0029     cmake -DCLHEP_BUILD_CXXSTD=-std=c++11 ../CLHEP
0030     make -j 8
0031     sudo make install
0032 
0033 # Building Geant4
0034 
0035 Geant4 versions are available at:
0036 https://geant4.web.cern.ch/support/download
0037 
0038 
0039     cd to the directory where you want to install Geant4
0040     wget https://geant4-data.web.cern.ch/releases/geant4.10.07.p02.tar.gz
0041     mkdir geant4.10.07.p02-build
0042     cd  geant4.10.07.p02-build
0043     cmake -DCMAKE_INSTALL_PREFIX=../geant4.10.07.p02-install -DGEANT4_BUILD_VERBOSE_CODE=OFF -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_SYSTEM_CLHEP=ON -DGEANT4_USE_GDML=ON -DGEANT4_USE_SYSTEM_EXPAT=ON -DGEANT4_USE_SYSTEM_ZLIB=ON  -DGEANT4_USE_QT=ON -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_USE_OPENGL_X11=ON ../geant4.10.07.p02
0044     make -j 8
0045     make install
0046     . ../geant4.10.07.p02-install/bin/geant4.sh
0047 
0048 
0049 check the output for any error, install any development packages that might be necessary. 
0050 
0051 
0052 
0053 
0054 # Building ROOT 
0055 Instructions how to build ROOT from ssource can be found at:
0056 https://root.cern/install/build_from_source/
0057 
0058     # cd  to the diretory where you want to install root
0059     git clone --branch latest-stable https://github.com/root-project/root.git root_src
0060     mkdir root-build
0061     cd root-build
0062     cmake -DCMAKE_INSTALL_PREFIX=../root-install  ../root
0063     # speed up the make process
0064     new=" -j$(($(grep -c ^processor /proc/cpuinfo) - 1))" 
0065     case ":${MAKEFLAGS:=$new}:" in
0066         *:"$new":*)  ;;
0067         *) MAKEFLAGS="$MAKEFLAGS:$new"  ;;
0068     esac
0069     cmake -DCMAKE_INSTALL_PREFIX=../root-install  ../root_src/
0070     cmake --build . --target install
0071 
0072 check the output for any error, install any development packages that might be necessary. 
0073 
0074 
0075     . ../root-install/bin/thisroot.sh
0076     root
0077     
0078 
0079 # Installing CUDA
0080 
0081 cuda (11.3) is available at the NVIDIA web site just follow the instruction depending on the system you are using. 
0082 
0083 https://developer.nvidia.com/cuda-downloads
0084 
0085 **Note** this will also install the corresponding NVIDIA graphics driver you might have to reboot.  
0086 
0087 Another way to obtain cuda is to install the NVIDIA hpc-sdk kit. Which can be found here. 
0088 https://developer.nvidia.com/nvidia-hpc-sdk-downloads
0089 
0090 The NVIDIA hpc-sdk kit provides an interesting set of tools e.g. nvc++ which allows offloading of parallel algorithms to NVIDIA GPUs.
0091 
0092 A good way to check that things are working properly is to build the cuda samples and execute them
0093 
0094     # cd to the directory where you want to build the cuda samples. E.g. the commands deviceQueryDrv and deviceQuery provide useful information. 
0095     mkdir cuda-test
0096     cd cuda-test
0097     cp -r /usr/local/cuda-11.3/samples .
0098     cd  samples/
0099     which nvcc
0100     make 
0101     bin/x86_64/linux/release/deviceQuery
0102     bin/x86_64/linux/release/deviceQueryDrv 
0103 
0104 2 Tools For Monitoring Nvidia GPUs On Linux can be found here:
0105 https://www.linuxuprising.com/2019/06/2-tools-for-monitoring-nvidia-gpus-on.html
0106 
0107 # Installing Optix (6.5)
0108 
0109 https://developer.nvidia.com/designworks/optix/download
0110 
0111 Optix comes with precompiled samples and one might want to try them:
0112 
0113     # cd to the Optix installation directory
0114     cd SDK-precompiled-samples
0115     export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
0116     # execute e.g.:
0117     ./optixMDLSphere
0118     ./optixSphere
0119     ./optixTutorial
0120     # etc.
0121 
0122 
0123 
0124 
0125 
0126 # Building opticks vs. existing libraries
0127 
0128 This are instructions how to build opticks making use of preinstalled libraries available on the system. These libraries include CLHEP, xerces-c, boost and  Geant4.
0129 For geant 4 we use the current version at the time of writing which is Geant4.10.7.p2. We make use of the fact that the om-cmake function of om.bash is sensitive
0130 to CMAKE_PREFIX_PATH envvar so that we can point to the directories where the libraries are installed and void having to rebuild them.  In principle just cut and paste the following line to a file change the envars of the different directories to match your system and source the resulting script.
0131 
0132     cd to the directory where you want to install Opticks (the WORK_DIR environmental variable will point to this directory). 
0133     
0134     
0135 Here we are using a tagged snapshot of Opticks which can be found in github:
0136 
0137     git clone https://github.com/simoncblyth/opticks.git
0138     cd opticks
0139     git checkout tags/v0.1.6 -b v0.1.6-branch
0140     git status
0141     
0142 The development version (a. k. a. the latest and greatest) can be found in the following repository 
0143 
0144     git clone https://bitbucket.org/simoncblyth/opticks.git
0145     
0146     
0147 
0148 change opticks/optickscore/OpticksSwitches.h
0149 
0150 so that:
0151 
0152     #define WITH_SKIPAHEAD 1
0153 
0154 is set. 
0155 
0156     cat > setup_opticks.sh << +EOF
0157     # ----------------------------------------------------------------------------------------------------------------------
0158     # --- you need to modify the following environmental variables so that point to the specific directories on your system
0159     # --- 
0160     export WORK_DIR=/data2/wenzel/gputest_10.7.p02
0161     export OptiX_INSTALL_DIR=/home/wenzel/NVIDIA-OptiX-SDK-6.5.0-linux64
0162     export OPTICKS_COMPUTE_CAPABILITY=75
0163     export CUDA_INSTALL_DIR=/usr/local/cuda-11.3
0164     export CUDA_SAMPLES=${CUDA_INSTALL_DIR}/samples
0165     export G4INSTALL=/data2/wenzel/Geant4.10.07.p02_install
0166     . ${G4INSTALL}/bin/Geant4.sh
0167     export ROOTSYS=/data2/wenzel/root_install
0168     . ${ROOTSYS}/bin/thisroot.sh
0169     # ----------------------------------------------------------------------------------------------------------------------
0170     export LOCAL_BASE=${WORK_DIR}/local
0171     export CMAKE_PREFIX_PATH=${G4INSTALL}:${LOCAL_BASE}/opticks/externals:${OptiX_INSTALL_DIR}:${WORK_DIR}/opticks/cmake/Modules/:${WORK_DIR}/local/opticks:${WORK_DIR}/local/opticks:${WORK_DIR}/local/opticks/externals/
0172     export PYTHONPATH=$WORK_DIR
0173     export OPTICKS_HOME=${WORK_DIR}/opticks
0174     export PATH=${LOCAL_BASE}/bin:${PATH}
0175     export OPTICKS_PREFIX=${WORK_DIR}/local/opticks                            
0176     export OPTICKS_INSTALL_PREFIX=$LOCAL_BASE/opticks
0177     export OPTICKS_OPTIX_PREFIX=${OptiX_INSTALL_DIR}
0178     export OPTICKS_CUDA_PREFIX=${CUDA_INSTALL_DIR}
0179     export OPTICKS_EMBEDDED_COMMANDLINE_EXTRA="--rngmax 10 --rtx 1 --skipaheadstep 10000"
0180     opticks-(){ . ${OPTICKS_HOME}/opticks.bash && opticks-env $* ; }
0181     op(){ op.sh $* ; }
0182     o(){ cd $(opticks-home) ; hg st ; }
0183     # make sure to add the compiler options
0184     new=" -fPIC" 
0185     case ":${CXXFLAGS:=$new}:" in
0186         *:"$new":*)  ;;
0187         *) CXXFLAGS="$CXXFLAGS:$new"  ;;
0188     esac
0189     new=" -fPIC" 
0190     case ":${CFLAGS:=$new}:" in
0191         *:"$new":*)  ;;
0192         *) CFLAGS="$CFLAGS:$new"  ;;
0193     esac
0194     # speed up the make process
0195     new=" -j$(($(grep -c ^processor /proc/cpuinfo) - 1))" 
0196     case ":${MAKEFLAGS:=$new}:" in
0197         *:"$new":*)  ;;
0198         *) MAKEFLAGS="$MAKEFLAGS:$new"  ;;
0199     esac
0200     # deal with the $LD_LIBRARYPATH
0201     new=${OptiX_INSTALL_DIR}/lib64/
0202     case ":${LD_LIBRARY_PATH:=$new}:" in
0203         *:"$new":*)  ;;
0204         *) LD_LIBRARY_PATH="$new:$LD_LIBRARY_PATH"  ;;
0205     esac
0206     new=${OPTICKS_HOME}/externals/lib
0207     case ":${LD_LIBRARY_PATH:=$new}:" in
0208         *:"$new":*)  ;;
0209         *) LD_LIBRARY_PATH="$new:$LD_LIBRARY_PATH"  ;;
0210     esac
0211     new=${CUDA_INSTALL_DIR}/lib64/
0212     case ":${LD_LIBRARY_PATH:=$new}:" in
0213         *:"$new":*)  ;;
0214         *) LD_LIBRARY_PATH="$new:$LD_LIBRARY_PATH"  ;;
0215     esac
0216     new=${LOCAL_BASE}/opticks/lib/
0217     case ":${LD_LIBRARY_PATH:=$new}:" in
0218         *:"$new":*)  ;;
0219         *) LD_LIBRARY_PATH="$new:$LD_LIBRARY_PATH"  ;;
0220     esac
0221     opticks-
0222     new=${CUDA_INSTALL_DIR}/bin
0223     case ":${PATH:=$new}:" in
0224         *:"$new":*)  ;;
0225         *) PATH="$new:$PATH"  ;;
0226     esac
0227     new=${OPTICKS_HOME}/bin/
0228     case ":${PATH:=$new}:" in
0229         *:"$new":*)  ;;
0230         *) PATH="$new:$PATH"  ;;
0231     esac
0232     new=${OPTICKS_HOME}/ana/
0233     case ":${PATH:=$new}:" in
0234         *:"$new":*)  ;;
0235         *) PATH="$new:$PATH"  ;;
0236     esac
0237     new=${LOCAL_BASE}/opticks/lib/
0238     case ":${PATH:=$new}:" in
0239         *:"$new":*)  ;;
0240         *) PATH="$new:$PATH"  ;;
0241     esac
0242     new=${CUDA_SAMPLES}/bin/x86_64/linux/release/
0243     case ":${PATH:=$new}:" in
0244         *:"$new":*)  ;;
0245         *) PATH="$new:$PATH"  ;;
0246     esac
0247     oinfo-(){
0248         echo 'LD_LIBRARY_PATH:';
0249         echo '================';
0250         echo  ${LD_LIBRARY_PATH}| tr : \\n;
0251         echo;
0252         echo 'PATH:';
0253         echo '=====';
0254         echo  ${PATH}| tr : \\n;
0255         echo;
0256         echo 'CMAKE_PREFIX_PATH:';
0257         echo '==================';
0258         echo  ${CMAKE_PREFIX_PATH}| tr : \\n;
0259         }
0260     dinfo-(){    
0261         nvidia-smi;
0262         ${CUDA_SAMPLES}/bin/x86_64/linux/release/deviceQuery
0263     }
0264     +EOF
0265 
0266     source setup_opticks.sh
0267     oinfo-
0268     dinfo-
0269     mkdir -p ${WORK_DIR}/local/opticks/externals/
0270     cd ${WORK_DIR}/local/opticks/externals/
0271     ln -s ${OptiX_INSTALL_DIR} OptiX
0272     cd ${WORK_DIR}
0273     opticks-externals-install >& install_ext.log &
0274 
0275 scan the log file or any errors and correct them.
0276 
0277     cd ${WORK_DIR}
0278     opticks-full  >& install_full.log &
0279 
0280 scan the log file or any errors and correct them. Before you run     opticks-t you want to to create the geocache using e.g. one of the gdml files provided by CaTS
0281 (https://github.com/hanswenzel/CaTS)
0282 
0283     geocache-
0284     geocache-create- --gdmlpath  ${WORK_DIR}/local/opticks/opticksdata/export/juno1808/g4_00.gdml
0285     export OPTICKS_KEY=`output from above command"
0286     opticks-t
0287     
0288 if the geocache-create- command doesn't work:
0289 
0290 
0291     ${WORK_DIR}/local/opticks/lib/OKX4Test --okx4test --g4codegen --deletegeocache --gdmlpath  ${WORK_DIR}/CaTS/gdml/simpleLArTPC.gdml
0292     export OPTICKS_KEY=`output from above command"
0293     opticks-t
0294 
0295 
0296 
0297 # Building CaTS
0298 
0299 Instructions for building and running CaTS can be found here:
0300 
0301 https://github.com/hanswenzel/CaTS/blob/master/README.md