Skip to content

Commit 93c89d0

Browse files
Support builds on fnal-dev-sl7 on scisoftbuild01 (#2153)
* Add missing static * Fix hepmc3 * Fix illegal update of volatile bits * Only warn about ROOT cxxstd mismatch when they're defined * Fix minor indentation error * Update faraday/hudson build * Add scisoftbuild * Apply fixes from pre-commit hooks: see detailed commit message → This commit means that you must (please!) install pre-commit on your development machine and run `pre-commit install --install-hooks`. For more information, see https://celeritas-project.github.io/celeritas/user/development/style.html#formatting Autogenerated: https://pre-commit.ci * Address feedback * Verbal feedback --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 84a24a8 commit 93c89d0

File tree

11 files changed

+231
-19
lines changed

11 files changed

+231
-19
lines changed

CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,10 @@ if(CELERITAS_USE_ROOT)
421421
endif()
422422
# ROOT requirement is due to missing CMake commands in old versions
423423
find_package(ROOT 6.24 REQUIRED)
424-
if(NOT ROOT_CXX_STANDARD STREQUAL CMAKE_CXX_STANDARD)
425-
message(WARNING "ROOT C++ standard ${ROOT_CXX_STANDARD} "
426-
"does not match current CMake standard ${CMAKE_CXX_STANDARD}: "
424+
if(ROOT_CXX_STANDARD AND CMAKE_CXX_STANDARD
425+
AND NOT (ROOT_CXX_STANDARD STREQUAL CMAKE_CXX_STANDARD))
426+
message(WARNING "ROOT C++ standard (${ROOT_CXX_STANDARD}) "
427+
"does not match current CMake standard (${CMAKE_CXX_STANDARD}): "
427428
"build warnings/errors may result")
428429
endif()
429430
endif()

scripts/build.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ source_script() {
7777
log error "Failed to source '$1'"
7878
exit 1
7979
fi
80-
_celer_build=0
8180
set -e
8281
}
8382

@@ -140,7 +139,7 @@ check_ccache_usage() {
140139

141140
# Find a command in PATH, suppressing error messages
142141
find_command() {
143-
command -v "$1" 2>/dev/null || printf ""
142+
command -v "$1" 2>/dev/null || printf ""
144143
}
145144

146145
# Auto-detect and configure ccache if available

scripts/cmake-presets/faraday.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"CELERITAS_USE_covfie": {"type": "BOOL", "value": "OFF"},
1717
"CELERITAS_USE_OpenMP": {"type": "BOOL", "value": "OFF"},
1818
"CELERITAS_USE_MPI": {"type": "BOOL", "value": "OFF"},
19+
"CELERITAS_USE_VecGeom": {"type": "BOOL", "value": "OFF"},
1920
"CMAKE_CXX_FLAGS": "-Wall -Wextra -pedantic -Werror -fdiagnostics-color=always",
2021
"CMAKE_CXX_STANDARD": "20",
2122
"CMAKE_CXX_EXTENSIONS": {"type": "BOOL", "value": "OFF"},
@@ -33,24 +34,21 @@
3334
"displayName": "Build with full optimizations (ORANGE)",
3435
"inherits": [".base", ".ndebug"],
3536
"cacheVariables": {
36-
"CELERITAS_USE_VecGeom": {"type": "BOOL", "value": "OFF"}
3737
}
3838
},
3939
{
4040
"name": "reldeb-orange",
4141
"displayName": "Build with optimizations, but enable host debugging (ORANGE)",
4242
"inherits": [".base", ".reldeb"],
4343
"cacheVariables": {
44-
"CELERITAS_USE_VecGeom": {"type": "BOOL", "value": "OFF"}
4544
}
4645
},
4746
{
4847
"name": "debug-orange",
4948
"displayName": "Build without optimization, enabling full host debugging (ORANGE)",
5049
"inherits": [".base", ".debug"],
5150
"cacheVariables": {
52-
"CELERITAS_DEVICE_DEBUG":{"type": "BOOL", "value": "OFF"},
53-
"CELERITAS_USE_VecGeom": {"type": "BOOL", "value": "OFF"}
51+
"CELERITAS_DEVICE_DEBUG":{"type": "BOOL", "value": "OFF"}
5452
}
5553
}
5654
],
@@ -70,7 +68,7 @@
7068
"name": ".base",
7169
"configurePreset": ".base",
7270
"output": {"outputOnFailure": true},
73-
"execution": {"noTestsAction": "error", "stopOnFailure": false, "jobs": 8}
71+
"execution": {"noTestsAction": "error", "stopOnFailure": false, "jobs": 96}
7472
},
7573
{"name": "release-orange", "configurePreset": "release-orange", "inherits": ".base"},
7674
{"name": "reldeb-orange", "configurePreset": "reldeb-orange", "inherits": ".base"},

scripts/cmake-presets/hudson.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"name": ".base",
106106
"configurePreset": ".base",
107107
"output": {"outputOnFailure": true},
108-
"execution": {"noTestsAction": "error", "stopOnFailure": false, "jobs": 8}
108+
"execution": {"noTestsAction": "error", "stopOnFailure": false, "jobs": 48}
109109
},
110110
{"name": "release", "configurePreset": "release", "inherits": ".base"},
111111
{"name": "reldeb", "configurePreset": "reldeb", "inherits": ".base"},
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"version": 3,
3+
"cmakeMinimumRequired": {"major": 3, "minor": 21, "patch": 0},
4+
"configurePresets": [
5+
{
6+
"name": ".base",
7+
"hidden": true,
8+
"inherits": ["full"],
9+
"binaryDir": "$env{SCRATCHDIR}/build/celeritas-${presetName}",
10+
"generator": "Ninja",
11+
"cacheVariables": {
12+
"BUILD_SHARED_LIBS": {"type": "BOOL", "value": "ON"},
13+
"CELERITAS_BUILD_DOCS": {"type": "BOOL", "value": "OFF"},
14+
"CELERITAS_USE_CUDA": {"type": "BOOL", "value": "OFF"},
15+
"CELERITAS_USE_HIP": {"type": "BOOL", "value": "OFF"},
16+
"CELERITAS_USE_covfie": {"type": "BOOL", "value": "OFF"},
17+
"CELERITAS_USE_OpenMP": {"type": "BOOL", "value": "ON"},
18+
"CELERITAS_USE_MPI": {"type": "BOOL", "value": "OFF"},
19+
"CELERITAS_USE_VecGeom": {"type": "BOOL", "value": "OFF"},
20+
"CMAKE_CXX_FLAGS": "-Wall -Wextra -pedantic -Werror -fdiagnostics-color=always",
21+
"CMAKE_CXX_STANDARD": "17",
22+
"CMAKE_CXX_EXTENSIONS": {"type": "BOOL", "value": "OFF"},
23+
"CMAKE_EXE_LINKER_FLAGS": "-Wl,-z,defs",
24+
"CMAKE_SHARED_LINKER_FLAGS": "-Wl,-z,defs",
25+
"CMAKE_INSTALL_PREFIX": "$env{SCRATCHDIR}/install/celeritas-${presetName}",
26+
"CMAKE_EXPORT_COMPILE_COMMANDS": {"type": "BOOL", "value": "ON"}
27+
}
28+
},
29+
{
30+
"name": "release-orange",
31+
"displayName": "Build with full optimizations (ORANGE)",
32+
"inherits": [".base", ".ndebug"],
33+
"cacheVariables": {
34+
}
35+
},
36+
{
37+
"name": "reldeb-orange",
38+
"displayName": "Build with optimizations, but enable host debugging (ORANGE)",
39+
"inherits": [".base", ".reldeb"],
40+
"cacheVariables": {
41+
"CELERITAS_USE_VecGeom": {"type": "BOOL", "value": "OFF"}
42+
}
43+
},
44+
{
45+
"name": "debug-orange",
46+
"displayName": "Build without optimization, enabling full host debugging (ORANGE)",
47+
"inherits": [".base", ".debug"],
48+
"cacheVariables": {
49+
"CELERITAS_DEVICE_DEBUG":{"type": "BOOL", "value": "OFF"},
50+
"CELERITAS_USE_VecGeom": {"type": "BOOL", "value": "OFF"}
51+
}
52+
}
53+
],
54+
"buildPresets": [
55+
{
56+
"name": ".base",
57+
"configurePreset": ".base",
58+
"jobs": 24,
59+
"nativeToolOptions": ["-k0"]
60+
},
61+
{"name": "release-orange", "configurePreset": "release-orange", "inherits": ".base"},
62+
{"name": "reldeb-orange", "configurePreset": "reldeb-orange", "inherits": ".base"},
63+
{"name": "debug-orange", "configurePreset": "debug-orange", "inherits": ".base"}
64+
],
65+
"testPresets": [
66+
{
67+
"name": ".base",
68+
"configurePreset": ".base",
69+
"output": {"outputOnFailure": true},
70+
"execution": {"noTestsAction": "error", "stopOnFailure": false, "jobs": 24}
71+
},
72+
{"name": "release-orange", "configurePreset": "release-orange", "inherits": ".base"},
73+
{"name": "reldeb-orange", "configurePreset": "reldeb-orange", "inherits": ".base"},
74+
{"name": "debug-orange", "configurePreset": "debug-orange", "inherits": ".base"}
75+
]
76+
}

scripts/env/excl.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ export LC_ALL=C
1010
# Allow running from user rc setup outside of build.sh environment
1111
if ! command -v celerlog >/dev/null 2>&1; then
1212
celerlog() {
13-
printf "%s: %s\n" "\$1" "\$2" >&2
13+
printf "%s: %s\n" "$1" "$2" >&2
1414
}
1515
fi
1616
if test -z "${SYSTEM_NAME}"; then
17-
celerlog debug "Set SYSTEM_NAME=${SYSTEM_NAME}"
1817
SYSTEM_NAME=$(uname -s)
18+
celerlog debug "Set SYSTEM_NAME=${SYSTEM_NAME}"
1919
fi
2020

2121
export SPACK_ROOT=/auto/projects/celeritas/spack

scripts/env/scisoftbuild01.sh

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
#!/bin/sh -ex
2+
#-------------------------------- -*- sh -*- ---------------------------------#
3+
# Copyright Celeritas contributors: see top-level COPYRIGHT file for details
4+
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
5+
#
6+
#-----------------------------------------------------------------------------#
7+
# Note: to launch the apptainer run this
8+
apptainer_fermilab() {
9+
if ! [ -d "${SCRATCHDIR}" ]; then
10+
echo "Scratch directory does not exist: ru
11+
. scripts/env/scisoftbuild01.sh
12+
"
13+
return 1
14+
fi
15+
16+
image=${1:-fnal-dev-sl7:latest}
17+
18+
# Start apptainer, forwarding necessary directories
19+
SUBDOMAIN=mis # codespell:ignore
20+
exec /cvmfs/oasis.opensciencegrid.org/$SUBDOMAIN/apptainer/current/bin/apptainer \
21+
shell --shell=/bin/bash \
22+
-B /cvmfs,$SCRATCHDIR,$HOME,$XDG_RUNTIME_DIR,/opt,/etc/hostname,/etc/hosts,/etc/krb5.conf \
23+
--ipc --pid \
24+
/cvmfs/singularity.opensciencegrid.org/fermilab/${image}
25+
}
26+
27+
#-----------------------------------------------------------------------------#
28+
29+
# Reduce I/O metadata overhead by avoiding language translation lookups
30+
export LC_ALL=C
31+
32+
# Allow running from user rc setup outside of build.sh environment
33+
if ! command -v celerlog >/dev/null 2>&1; then
34+
celerlog() {
35+
printf "%s: %s\n" "$1" "$2" >&2
36+
}
37+
fi
38+
if [ -z "${SYSTEM_NAME}" ]; then
39+
SYSTEM_NAME=$(uname -s)
40+
celerlog debug "Set SYSTEM_NAME=${SYSTEM_NAME}"
41+
fi
42+
43+
if [ -n "${APPTAINER_CONTAINER}" ]; then
44+
export MRB_PROJECT=larsoft
45+
export MRB_PROJECT_VERSION=v10_14_01
46+
export MRB_QUALS=e26:prof
47+
celerlog info "Running in apptainer ${APPTAINER_CONTAINER}"
48+
if [ -z "${UPS_DIR}" ]; then
49+
celerlog info "Setting up DUNE UPS"
50+
. /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh
51+
celerlog debug "Using UPS_OVERRIDE=${UPS_OVERRIDE}, MRB_PROJECT=${MRB_PROJECT}"
52+
fi
53+
if [ -z "${SETUP_LARCORE}" ]; then
54+
# Set up larsoft build defaults with UPS
55+
celerlog info "Setting up ${MRB_PROJECT} ${MRB_PROJECT_VERSION} with qualifiers '${MRB_QUALS}'"
56+
setup ${MRB_PROJECT} ${MRB_PROJECT_VERSION} -q ${MRB_QUALS} || return $?
57+
fi
58+
fi
59+
60+
# Set default scratchdir; /scratch should exist according to excl docs
61+
export SCRATCHDIR="${SCRATCHDIR:-/scratch/$USER}"
62+
for _d in build install cache; do
63+
# Create build/install in higher-performance local-but-persistent dir
64+
_scratch="$SCRATCHDIR/$_d"
65+
if ! [ -d "${_scratch}" ]; then
66+
celerlog info "Creating scratch directory '${_scratch}'"
67+
mkdir -p "${_scratch}" || return $?
68+
chmod 700 "${_scratch}" || return $?
69+
fi
70+
unset _scratch
71+
done
72+
73+
# Set up larsoft if running inside an apptainer
74+
if [ -n "${MRB_PROJECT}" ]; then
75+
LARSCRATCHDIR="${SCRATCHDIR}/${MRB_PROJECT}"
76+
if ! [ -d "${LARSCRATCHDIR}" ]; then
77+
celerlog info "Creating MRB dev area in ${LARSCRATCHDIR}..."
78+
mkdir -p "${LARSCRATCHDIR}" || return $?
79+
(
80+
cd "${LARSCRATCHDIR}"
81+
mrb newDev
82+
)
83+
celerlog debug "MRB environment created"
84+
fi
85+
_setup_filename="${LARSCRATCHDIR}/localProducts_${MRB_PROJECT}_${MRB_PROJECT_VERSION}_${MRB_QUALS//:/_}/setup"
86+
if ! [ -f "${_setup_filename}" ]; then
87+
celerlog warn "Expected setup file at ${_setup_filename}: MRB may not have been set up correctly"
88+
_setup_filename=$(print %s"${LARSCRATCHDIR}/localProducts_${MRB_PROJECT}*/setup")
89+
if [ -f "${_setup_filename}" ]; then
90+
celerlog info "Found setup file ${_setup_filename}"
91+
fi
92+
fi
93+
. "${_setup_filename}"
94+
fi
95+
96+
# Check out a package so that mrb will load cmake (may be arbitrary?)
97+
if [ -n "${MRB_SOURCE}" ]; then
98+
_pkg=larsim
99+
if ! [ -d "${MRB_SOURCE}/${_pkg}" ]; then
100+
celerlog info "Installing ${_pkg}"
101+
mrb g ${_pkg}
102+
fi
103+
104+
# Now that a package exists in MRB source, cmake and dependencies can load
105+
celerlog info "Activating MRB environment"
106+
mrbsetenv
107+
celerlog debug "MRB setup complete"
108+
fi
109+
110+
if [ -n "$CELER_SOURCE_DIR" ]; then
111+
_clangd="$CELER_SOURCE_DIR/.clangd"
112+
if [ ! -e "${_clangd}" ]; then
113+
# Create clangd compatible with the system and build config
114+
_gcc_version=$(gcc -dumpversion | cut -d. -f1)
115+
celerlog info "Creating clangd config using GCC ${_gcc_version}: ${_clangd}"
116+
cat > "${_clangd}" << EOF
117+
CompileFlags:
118+
CompilationDatabase: ${SCRATCHDIR}/build/celeritas-reldeb-orange
119+
Add:
120+
[
121+
-isystem,
122+
/usr/include/c++/${_gcc_version},
123+
-isystem,
124+
/usr/local/include,
125+
-isystem,
126+
/usr/include,
127+
-isystem,
128+
/usr/include/x86_64-linux-gnu/c++/${_gcc_version},
129+
]
130+
EOF
131+
fi
132+
unset _clangd
133+
fi
134+
135+
export XDG_CACHE_HOME="${SCRATCHDIR}/cache"

src/corecel/sys/ScopedSignalHandler.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ extern "C" void celer_set_signal(int signal)
3030
// It's undefined behavior to throw C++ exceptions from inside a C function
3131
// call, so use a C assert to check that the bit being set is within
3232
// bounds.
33-
assert(signal >= 0 && signal < static_cast<int>(sizeof(int) * 8 - 1));
33+
assert(signal >= 0
34+
&& signal < static_cast<int>(sizeof(sig_atomic_t) * 8 - 1));
3435

35-
g_celer_signal_bits_ |= (1 << signal);
36+
// Use separate load/stores since atomic modification isn't possible
37+
sig_atomic_t bits = g_celer_signal_bits_ | (1 << signal);
38+
g_celer_signal_bits_ = bits;
3639
}
3740

3841
//---------------------------------------------------------------------------//

src/geocel/ScopedGeantLogger.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ enum class SGLState
202202

203203
SGLState& sgl_state()
204204
{
205-
G4ThreadLocal SGLState result{SGLState::inactive};
205+
static G4ThreadLocal SGLState result{SGLState::inactive};
206206
return result;
207207
}
208208

test/celeritas/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ endif()
2323

2424
if(NOT CELERITAS_USE_HepMC3)
2525
set(_needs_hepmc DISABLE)
26+
else()
27+
set(_needs_hepmc LINK_LIBRARIES ${HepMC3_LIBRARIES})
2628
endif()
2729

2830
if(NOT CELERITAS_USE_ROOT)
@@ -371,8 +373,7 @@ celeritas_add_test(grid/XsCalculator.test.cc)
371373

372374
#-----------------------------------------------------------------------------#
373375
# IO
374-
celeritas_add_test(io/EventIO.test.cc ${_needs_hepmc}
375-
LINK_LIBRARIES ${HepMC3_LIBRARIES})
376+
celeritas_add_test(io/EventIO.test.cc ${_needs_hepmc})
376377
celeritas_add_test(io/ImportUnits.test.cc)
377378
celeritas_add_test(io/JsonEventIO.test.cc)
378379
celeritas_add_test(io/RootEventIO.test.cc ${_needs_root})

0 commit comments

Comments
 (0)