Skip to content

Commit

Permalink
Move the asynchronous mode components into AdePT (#325)
Browse files Browse the repository at this point in the history
This PR integrates the asynchronous mode components from `AsyncExample`
into AdePT as a new backend that can be activated via a compile-time
option.

In order to compile either backend into the final library
`AdePTTrackingManager.hh` includes either `AdePTTransport.h` or
`AsyncAdePTTransport.hh`, which will pull in the gcc-compiled parts of
the code. `AdePTTrackingManager.cu` includes `AdePTTransport.cuh` or
`AsyncAdePTTransport.cuh` for the nvcc-compiled side. This is done via
the cmake option `-DASYNC_MODE=[ON|OFF]`

There are no changes to the current synchronous backend, and as expected
validation shows no difference in performance or results compared to the
current `master`. For the asynchronous backend, there is no performance
difference with the current standalone example, and the validation shows
good agreement with Geant4.

<img
src="https://github.com/user-attachments/assets/a088f1d1-cad6-4669-b293-817561db8e6c"
width="70%"/>

---------

Co-authored-by: SeverinDiederichs <[email protected]>
  • Loading branch information
JuanGonzalezCaminero and SeverinDiederichs authored Jan 28, 2025
1 parent fff5dba commit 3fb7b90
Show file tree
Hide file tree
Showing 46 changed files with 1,661 additions and 1,815 deletions.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ endif()
set(ADEPT_G4_INTEGRATION_SRCS
src/G4HepEmTrackingManagerSpecialized.cc
src/AdePTTrackingManager.cc
src/AdePTTrackingManager.cu
src/AdePTPhysics.cc
src/HepEMPhysics.cc
src/AdePTGeant4Integration.cpp
src/AdePTConfigurationMessenger.cc
src/AdePTTrackingManager.cu
)

add_library(CopCore INTERFACE)
Expand All @@ -187,6 +187,7 @@ target_include_directories(AdePT_G4_integration
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/>
)

target_link_libraries(AdePT_G4_integration
PUBLIC
CopCore
Expand All @@ -207,6 +208,14 @@ set_target_properties(AdePT_G4_integration
CUDA_RESOLVE_DEVICE_SYMBOLS ON
)

option(ASYNC_MODE OFF "Enable the async transport backend")
if(ASYNC_MODE)
add_compile_definitions(ASYNC_MODE)
message(STATUS "${Green}Using the asynchronous transport backend${ColorReset}")
else()
message(STATUS "${Red}Async backend is disabled${ColorReset}")
endif()

# Optional library to activate NVTX annotations for profiling:
option(NVTX OFF "Add NVTX instrumentation for profiling (only for annotated examples)")
add_library(NVTX INTERFACE)
Expand Down
273 changes: 0 additions & 273 deletions examples/AsyncExample/AdeptIntegration.cpp

This file was deleted.

Loading

0 comments on commit 3fb7b90

Please sign in to comment.