Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into surface-insert-opt
Browse files Browse the repository at this point in the history
  • Loading branch information
sethrj committed May 24, 2024
2 parents 3c30cb9 + 08f509f commit 35e59de
Show file tree
Hide file tree
Showing 493 changed files with 18,294 additions and 5,759 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
- name: Run tests
working-directory: build
run: |
ctest --parallel 2 --timeout 15 --output-on-failure \
ctest --parallel $(nproc) --timeout 15 --output-on-failure \
--test-output-size-passed=32768 --test-output-size-failed=1048576
- name: Install
working-directory: build
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/build-spack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ concurrency:
group: build-spack-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}-${{github.workflow}}

env:
SPACK_REF: 968ad02473b12f6305cc1fe19f2a0d706f171154
SPACK_REF: 5fe93fee1eec46a0750bd340198bffcb92ff9eec # v0.22.0

jobs:
spack:
Expand Down Expand Up @@ -59,14 +59,16 @@ jobs:
fetch-depth: 255
fetch-tags: true # to get version information
- name: Setup Spack
uses: spack/setup-spack@5ab3c91bdefffffad9a7e45d1d156146afebb3a7
uses: spack/setup-spack@0ce61628ed8a32a5664cf01a0e0b5a4834a3b413 # 2024/03
with:
ref: ${{env.SPACK_REF}}
buildcache: true
color: true
path: spack-src
- name: Initialize spack environment
run: |
# TODO: https://github.com/spack/spack/pull/43136
curl -LfsS https://github.com/spack/spack/pull/43136.patch | git -C spack-src apply -
cp scripts/ci/spack.yaml .
if [ "${{matrix.geometry}}" == "vecgeom" ]; then
spack -e . add vecgeom
Expand Down Expand Up @@ -136,6 +138,10 @@ jobs:
fi
ctest --parallel $(nproc) --timeout 15 --output-on-failure \
--test-output-size-passed=32768 --test-output-size-failed=1048576
- name: Check using build directory as install
run: |
. ${SPACK_VIEW}/rc
CELER_INSTALL_DIR=${PWD}/build ./scripts/ci/test-examples.sh
- name: Install
working-directory: build
run: |
Expand Down
109 changes: 109 additions & 0 deletions .github/workflows/build-ultralite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Build directly on the GitHub runner with caching
name: build-ultralite
on:
workflow_dispatch:
workflow_call:

concurrency:
group: build-ultralite-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}-${{github.workflow}}
cancel-in-progress: true

jobs:
linux:
name: ultralite-ubuntu
env:
CCACHE_DIR: "${{github.workspace}}/.ccache"
CCACHE_MAXSIZE: "20Mi"
CMAKE_PRESET: ultralite
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get -q -y update
sudo apt-get -q -y install \
ccache cmake ninja-build
- name: Check out Celeritas
uses: actions/checkout@v4
- name: Cache ccache
uses: actions/cache@v4
with:
path: ${{env.CCACHE_DIR}}
key: ccache-ultralite-ubuntu-${{github.run_id}}
restore-keys: |
ccache-ultralite
- name: Zero ccache stats
run: |
ccache -z
- name: Configure Celeritas
run: |
ln -fs scripts/cmake-presets/ci-ubuntu-github.json CMakeUserPresets.json
cmake --preset=${CMAKE_PRESET} \
-DCeleritas_GIT_DESCRIBE="${{github.event.pull_request
&& format(';-pr.{0};', github.event.pull_request.number)
|| format(';-{0};', github.ref_name)}}"
- name: Build all
working-directory: build
run: |
ninja
- name: Run tests
working-directory: build
run: |
ctest --parallel $(nproc) --timeout 15 --output-on-failure
- name: Install
working-directory: build
run: |
ninja install
- name: Check installation
working-directory: install
run: |
./bin/celer-sim --version
- name: Show ccache stats
if: ${{!cancelled()}}
run: |
ccache -s
windows:
name: ultralite-windows
env:
CCACHE_DIR: "${{github.workspace}}\\.ccache"
CCACHE_MAXSIZE: "20Mi"
CMAKE_PRESET: ultralite
runs-on: windows-latest
steps:
- name: Install dependencies
run: |
choco install ninja ccache
- name: Check out Celeritas
uses: actions/checkout@v4
- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Cache ccache
uses: actions/cache@v4
with:
path: ${{env.CCACHE_DIR}}
key: ccache-ultralite-windows-${{github.run_id}}
restore-keys: |
ccache-ultralite
- name: Zero ccache stats
run: |
ccache -z
- name: Configure Celeritas
shell: pwsh
run: |
Copy-Item scripts/cmake-presets/ci-windows-github.json -Destination CMakeUserPresets.json
cmake --preset=$Env:CMAKE_PRESET `
-DCeleritas_GIT_DESCRIBE="${{github.event.pull_request
&& format(';-pr.{0};', github.event.pull_request.number)
|| format(';-{0};', github.ref_name)}}"
- name: Build all
run: |
cmake --build --preset=$Env:CMAKE_PRESET
- name: Test all
continue-on-error: true
run: |
ctest --preset=$Env:CMAKE_PRESET
- name: Show ccache stats
if: ${{!cancelled()}}
run: |
ccache -s
# vim: set nowrap tw=100:
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Install Python packages
run: |
pip install --upgrade pip
pip install -r scripts/requirements.txt
pip install -r scripts/doc-requirements.txt
- name: Configure celeritas
run: |
mkdir build && cd build
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ on:
paths-ignore:
- '**.rst'
- '**.md'
- 'scripts/dev'
- 'scripts'
- '.jenkins'
- '!scripts/cmake-presets/ci*'
- '!scripts/ci'
- '!scripts/build.sh'

concurrency:
group: pr-${{github.ref}}-${{github.event.number}}-${{github.workflow}}
Expand All @@ -20,10 +24,12 @@ concurrency:
jobs:
build-fast:
uses: ./.github/workflows/build-fast.yml
build-ultralite:
uses: ./.github/workflows/build-ultralite.yml
doc:
uses: ./.github/workflows/doc.yml
all-prechecks:
needs: [build-fast, doc]
needs: [build-fast, build-ultralite, doc]
runs-on: ubuntu-latest
steps:
- name: Success
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ concurrency:
cancel-in-progress: true

jobs:
build-ultralite:
uses: ./.github/workflows/build-ultralite.yml
build-fast:
uses: ./.github/workflows/build-fast.yml
build-docker:
Expand Down
1 change: 1 addition & 0 deletions .jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pipeline {
options {
disableConcurrentBuilds(abortPrevious: true)
newContainerPerStage()
timeout(time: 7, unit: 'HOURS')
}
triggers {
issueCommentTrigger('.*do: test')
Expand Down
69 changes: 58 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,31 @@ cmake_dependent_option(CELERITAS_TEST_VERBOSE
# CELERITAS CORE IMPLEMENTATION OPTIONS
#----------------------------------------------------------------------------#

# CELERITAS_CORE_RNG: random number generator selection
if(CELERITAS_USE_CUDA OR CELERITAS_USE_HIP)
set(CELERITAS_MAX_BLOCK_SIZE 256
CACHE STRING "Threads-per-block launch bound for Celeritas action kernels"
)
else()
set(CELERITAS_MAX_BLOCK_SIZE 0)
endif()

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# CELERITAS_CORE_RNG
# Random number generator selection
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
celeritas_setup_option(CELERITAS_CORE_RNG xorwow)
celeritas_setup_option(CELERITAS_CORE_RNG cuRAND CELERITAS_USE_CUDA)
celeritas_setup_option(CELERITAS_CORE_RNG hipRAND CELERITAS_USE_HIP)
# TODO: allow wrapper to standard library RNG when not building for device?
# TODO: add wrapper to standard library RNG when not building for device?
# TODO: add ranluxpp?
# TODO: maybe even add wrapper to Geant4 RNG??
celeritas_define_options(CELERITAS_CORE_RNG
"Celeritas runtime random number generator")

# CELERITAS_CORE_GEO: runtime geometry selection
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# CELERITAS_CORE_GEO
# Runtime geometry selection
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if(CELERITAS_USE_VecGeom AND NOT CELERITAS_USE_HIP)
set(_allow_vecgeom TRUE)
else()
Expand All @@ -98,7 +113,7 @@ else()
message(SEND_ERROR "VecGeom core geometry is incompatible with HIP")
endif()
endif()
if(CELERITAS_USE_Geant4 AND NOT (CELERITAS_USE_HIP OR CELERITAS_USE_CUDA OR CELERITAS_USE_OpenMP))
if(CELERITAS_USE_Geant4 AND NOT (CELERITAS_USE_HIP OR CELERITAS_USE_CUDA OR CELERITAS_OPENMP))
set(_allow_g4 TRUE)
else()
if(CELERITAS_CORE_GEO STREQUAL "Geant4")
Expand All @@ -111,14 +126,26 @@ celeritas_setup_option(CELERITAS_CORE_GEO ORANGE)
celeritas_setup_option(CELERITAS_CORE_GEO Geant4 _allow_g4)
celeritas_define_options(CELERITAS_CORE_GEO "Celeritas runtime geometry")

if(CELERITAS_USE_CUDA OR CELERITAS_USE_HIP)
set(CELERITAS_MAX_BLOCK_SIZE 256
CACHE STRING "Threads-per-block launch bound for Celeritas action kernels"
)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# CELERITAS_OPENMP
# Thread parallelism
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if(CELERITAS_USE_OpenMP)
set(_disable_openmp FALSE)
else()
set(CELERITAS_MAX_BLOCK_SIZE 0)
set(_disable_openmp TRUE)
endif()

celeritas_setup_option(CELERITAS_OPENMP disabled _disable_openmp)
celeritas_setup_option(CELERITAS_OPENMP event CELERITAS_USE_OpenMP)
celeritas_setup_option(CELERITAS_OPENMP track CELERITAS_USE_OpenMP)
celeritas_define_options(CELERITAS_OPENMP "Celeritas OpenMP parallelism")

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# CELERITAS_UNITS
# Unit system for celeritas runtime
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if(CELERITAS_CORE_GEO STREQUAL Geant4)
set(_allow_single_prec FALSE)
else()
Expand All @@ -131,6 +158,10 @@ celeritas_setup_option(CELERITAS_UNITS CLHEP)
celeritas_define_options(CELERITAS_UNITS
"Native unit system for Celeritas")

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# CELERITAS_REAL_TYPE
# Precision for real numbers
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
celeritas_setup_option(CELERITAS_REAL_TYPE double)
celeritas_setup_option(CELERITAS_REAL_TYPE float)
celeritas_define_options(CELERITAS_REAL_TYPE
Expand Down Expand Up @@ -232,7 +263,7 @@ celeritas_set_default(CMAKE_INSTALL_MESSAGE LAZY)
# Output locations for Celeritas products (used by CeleritasUtils.cmake and
# install code below) will mirror the installation layout
set(CELERITAS_CMAKE_CONFIG_DIRECTORY
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake")
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(CELERITAS_HEADER_CONFIG_DIRECTORY
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}")
set(CELERITAS_LIBRARY_OUTPUT_DIRECTORY
Expand Down Expand Up @@ -269,6 +300,11 @@ endif()

if(CELERITAS_USE_Geant4 AND NOT Geant4_FOUND)
find_package(Geant4 REQUIRED)
if(CELERITAS_OPENMP STREQUAL "track" AND Geant4_multithreaded_FOUND)
message(WARNING "Track-level OpenMP will conflict with MT runs of geant4:"
"consider setting CELERITAS_OPENMP to \"event\" or disabling OpenMP"
)
endif()
endif()

if(CELERITAS_USE_HepMC3)
Expand Down Expand Up @@ -522,7 +558,7 @@ endif()

# Where to install configured cmake files
set(CELERITAS_INSTALL_CMAKECONFIGDIR
"${CMAKE_INSTALL_LIBDIR}/cmake/Celeritas")
"${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")

# Build list of CMake files to install
set(_cmake_files
Expand All @@ -549,6 +585,11 @@ install(DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/backport"
COMPONENT development
)

# Copy CMake files to support using Celeritas build dir as an install dir
file(COPY ${_cmake_files}
DESTINATION "${CELERITAS_INSTALL_CMAKECONFIGDIR}"
)

# Export all cache variables that start with CELERITAS_
set(CELERITAS_EXPORT_VARIABLES)
macro(celeritas_export_var varname)
Expand Down Expand Up @@ -628,6 +669,12 @@ install(EXPORT celeritas-targets
COMPONENT development
)

# Export targets to the build tree
export(EXPORT celeritas-targets
FILE "${CELERITAS_CMAKE_CONFIG_DIRECTORY}/CeleritasTargets.cmake"
NAMESPACE Celeritas::
)

if(Celeritas_VERSION VERSION_EQUAL "0.0.0")
install(CODE "
message(WARNING \"The Celeritas version was not detected during configuration.
Expand Down
2 changes: 1 addition & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ celeritas_target_link_libraries(celer-dump-data

add_subdirectory(celer-sim)
add_subdirectory(celer-g4)
add_subdirectory(celer-geo)

if(CELERITAS_BUILD_DEMOS)
add_subdirectory(demo-interactor)
add_subdirectory(demo-geo-check)
add_subdirectory(demo-rasterizer)
endif()

#-----------------------------------------------------------------------------#
Expand Down
15 changes: 7 additions & 8 deletions app/celer-g4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,20 @@ if(CELERITAS_USE_Geant4)
nlohmann_json::nlohmann_json
)
endif()
if(CELERITAS_USE_ROOT)
list(APPEND SOURCES
RootIO.cc
)
list(APPEND LIBRARIES ROOT::Tree)
endif()
celeritas_get_g4libs(_g4_libs geometry persistency intercoms run tasking
physicslists interfaces)
list(APPEND LIBRARIES ${_g4_libs})
else()
set(SOURCES
celer-g4.nogeant.cc
)
set(LIBRARIES)
endif()

if(CELERITAS_USE_ROOT AND CELERITAS_USE_Geant4)
list(APPEND SOURCES
RootIO.cc
)
list(APPEND LIBRARIES ROOT::Tree)
set(LIBRARIES Celeritas::corecel)
endif()

celeritas_add_executable(celer-g4 ${SOURCES})
Expand Down
Loading

0 comments on commit 35e59de

Please sign in to comment.