Skip to content
/ AdePT Public
forked from apt-sim/AdePT

Accelerated demonstrator of electromagnetic Particle Transport

License

Notifications You must be signed in to change notification settings

agheata/AdePT

 
 

Repository files navigation

AdePT

Accelerated demonstrator of electromagnetic Particle Transport

Build Requirements

The following packages are a required to build and run:

  • CMake >= 3.18
  • C/C++ Compiler with C++14 support
  • CUDA Toolkit (tested 10.1, min version TBD)
  • VecCore library 0.7.0 (recommended, but older versions >= 0.5.0 also work)
  • VecGeom library >= 1.1.20
  • G4HepEM library

A suitable environment may be set up either from CVMFS (requires the sft.cern.ch and projects.cern.ch repos to be available on the local system):

$ source /cvmfs/sft.cern.ch/lcg/views/devAdePT/latest/x86_64-centos7-gcc11-opt/setup.sh

or from the supplied spack environment file:

$ spack env create adept-spack ./scripts/spack.yaml
$ spack -e adept-spack concretize -f
$ spack -e adept-spack install
...
$ spack env activate -p adept-spack

Note that the above assumes your spack configuration defaults to use a suitable C++ compiler and has cuda_arch set appropriately for the hardware you will be running on.

You can also build the packages manually as follows. To configure and build VecCore, simply run:

$ cmake -S. -B./veccore-build -DCMAKE_INSTALL_PREFIX="<path_to_veccore_installation>"
$ cmake --build ./veccore-build --target install

Add your CUDA installation to the PATH and LD_LIBRARY_PATH environment variables, as in:

$ export PATH=${PATH}:/usr/local/cuda/bin
$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64

Find the CUDA architecture for the target GPU. If you installed the CUDA demo suite, the fastest way is to use the deviceQuery executable from extras/demo_suite. This lists the CUDA capability for all installed GPUs, remember the value for your target:

$ /usr/local/cuda/extras/demo_suite/deviceQuery
Device 0: "GeForce RTX 2080 SUPER"
  CUDA Capability Major/Minor version number:    7.5 (cuda_architecture=75)
...
Device 1: "Quadro K4200"
  CUDA Capability Major/Minor version number:    3.0 (cuda_architecture=30)

To configure and build VecGeom, use the configuration options below, using as <cuda_architecture> the value from the step above:

$ cmake -S. -B./vecgeom-build \
  -DCMAKE_INSTALL_PREFIX="<path_to_vecgeom_installation>" \
  -DCMAKE_PREFIX_PATH="<path_to_veccore_installation>" \
  -DVECGEOM_ENABLE_CUDA=ON \
  -DVECGEOM_GDML=ON \
  -DBACKEND=Scalar \
  -DCMAKE_CUDA_ARCHITECTURES=<cuda_architecture> \
  -DVECGEOM_USE_NAVINDEX=ON \
  -DCMAKE_BUILD_TYPE=Release
$ cmake --build ./vecgeom-build --target install -- -j6 ### build using 6 threads and install

To configure and build G4HepEM, use the configuration options below:

$ cmake -S. -B./g4hepem-build \
  -DCMAKE_INSTALL_PREFIX="<path_to_g4hepem_installation>" \
  -DCMAKE_PREFIX_PATH="<path_to_geant4_installation>" \
  -DG4HepEm_CUDA_BUILD=ON
$ cmake --build ./g4hepem-build --target install -- -j6 ### build using 6 threads and install

To configure AdePT, simply run:

$ cmake -S. -B./adept-build <otherargs>

As one needs to provide the paths to the dependence libraries VecCore, VecGeom and G4HepEM

   -DCMAKE_PREFIX_PATH="<path_to_veccore_installation>;<path_to_vecgeom_installation>;<path_to_g4hepem_installation>" \
   -DCMAKE_CUDA_ARCHITECTURES=<cuda_architecture> \
   -DCMAKE_BUILD_TYPE=Release

To build, run:

$ cmake --build ./adept-build -- -j6 ### build using 6 threads

The provided examples and tests can be run from the build directory:

$ cd adept-build
$ CUDA_VISIBLE_DEVICES=0 BuildProducts/bin/<executable>   ### use the device number matching the selected <cuda_architecture>

Including AdePT in other CMake projects

In order to include AdePT in a separate project we need to run:

find_package(AdePT)

Which has the same dependencies as before (VecGeom, VecCore and G4HepEM).

Then, for the targets using AdePT:

target_include_directories(example_target <SCOPE> 
                          <TARGET INCLUDE DIRECTORIES>
                          ${AdePT_INCLUDE_DIRS})

target_link_libraries(example_target <SCOPE>
                      <TARGET LINK LIBRARIES>
                      ${AdePT_LIBRARIES})

Copyright

AdePT code is Copyright (C) CERN, 2020, for the benefit of the AdePT project. Any other code in the project has (C) and license terms clearly indicated.

Contributions of all authors to AdePT and their institutes are acknowledged in the AUTHORS.md file.

About

Accelerated demonstrator of electromagnetic Particle Transport

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 53.4%
  • Cuda 36.6%
  • Python 4.6%
  • CMake 4.5%
  • C 0.9%