Skip to content

Commit 7217336

Browse files
committed
Add scisoftbuild
1 parent f2d024c commit 7217336

File tree

2 files changed

+187
-0
lines changed

2 files changed

+187
-0
lines changed
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/scisoftbuild01.sh

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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+
# Reduce I/O metadata overhead by avoiding language translation lookups
8+
export LC_ALL=C
9+
10+
# Allow running from user rc setup outside of build.sh environment
11+
if ! command -v celerlog >/dev/null 2>&1; then
12+
celerlog() {
13+
printf "%s: %s\n" "\$1" "\$2" >&2
14+
}
15+
fi
16+
if [ -z "${SYSTEM_NAME}" ]; then
17+
celerlog debug "Set SYSTEM_NAME=${SYSTEM_NAME}"
18+
SYSTEM_NAME=$(uname -s)
19+
fi
20+
21+
if [ -n "${APPTAINER_CONTAINER}" ]; then
22+
export MRB_PROJECT=larsoft
23+
export MRB_PROJECT_VERSION=v10_14_01
24+
export MRB_QUALS=e26:prof
25+
celerlog info "Running in apptainer ${APPTAINER_CONTAINER}"
26+
if [ -z "${UPS_DIR}" ]; then
27+
celerlog info "Setting up DUNE UPS"
28+
. /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh
29+
celerlog debug "Using UPS_OVERRIDE=${UPS_OVERRIDE}, MRB_PROJECT=${MRB_PROJECT}"
30+
fi
31+
if [ -z "${SETUP_LARCORE}" ]; then
32+
# Set up larsoft build defaults with UPS
33+
celerlog info "Setting up ${MRB_PROJECT} ${MRB_PROJECT_VERSION} with qualifiers '${MRB_QUALS}'"
34+
setup ${MRB_PROJECT} ${MRB_PROJECT_VERSION} -q ${MRB_QUALS} || return $?
35+
fi
36+
fi
37+
38+
# Set default scratchdir; /scratch should exist according to excl docs
39+
export SCRATCHDIR="${SCRATCHDIR:-/scratch/$USER}"
40+
for _d in build install cache; do
41+
# Create build/install in higher-performance local-but-persistent dir
42+
_scratch="$SCRATCHDIR/$_d"
43+
if ! [ -d "${_scratch}" ]; then
44+
celerlog info "Creating scratch directory '${_scratch}'"
45+
mkdir -p "${_scratch}" || return $?
46+
chmod 700 "${_scratch}" || return $?
47+
fi
48+
unset _scratch
49+
done
50+
51+
# Set up larsoft if running inside an apptainer
52+
if [ -n "${MRB_PROJECT}" ]; then
53+
LARSCRATCHDIR="${SCRATCHDIR}/${MRB_PROJECT}"
54+
if ! [ -d "${LARSCRATCHDIR}" ]; then
55+
celerlog info "Setting up MRB in ${LARSCRATCHDIR}..."
56+
mkdir -p "${LARSCRATCHDIR}" || return $?
57+
(
58+
cd "${LARSCRATCHDIR}"
59+
mrb newDev
60+
)
61+
celerlog debug "MRB environment created"
62+
fi
63+
_setup_filename="${LARSCRATCHDIR}/localProducts_${MRB_PROJECT}_${MRB_PROJECT_VERSION}_${MRB_QUALS//:/_}/setup"
64+
if ! [ -f "${_setup_filename}" ]; then
65+
celerlog warn "Expected setup file at ${_setup_filename}: MRB may not have been set up correctly"
66+
. "${LARSCRATCHDIR}/localProducts_${MRB_PROJECT}*/setup"
67+
else
68+
. "${LARSCRATCHDIR}/localProducts_${MRB_PROJECT}_${MRB_PROJECT_VERSION}_${MRB_QUALS//:/_}/setup"
69+
fi
70+
fi
71+
72+
# Install larg4
73+
if [ -n "${MRB_SOURCE}" ]; then
74+
_pkg=larg4
75+
if ! [ -d "${MRB_SOURCE}/${_pkg}" ]; then
76+
celerlog info "Installing ${_pkg}"
77+
mrb g ${_pkg}
78+
fi
79+
80+
# Now that a package exists in MRB source, cmake and dependencies can load
81+
celerlog info "Activating MRB environment"
82+
mrbsetenv
83+
celerlog debug "MRB setup complete"
84+
fi
85+
86+
if [ -n "$CELER_SOURCE_DIR" ]; then
87+
_clangd="$CELER_SOURCE_DIR/.clangd"
88+
if [ ! -e "${_clangd}" ]; then
89+
# Create clangd compatible with the system and build config
90+
_gcc_version=$(gcc -dumpversion | cut -d. -f1)
91+
celerlog info "Creating clangd config using GCC ${_gcc_version}: ${_clangd}"
92+
cat > "${_clangd}" << EOF
93+
CompileFlags:
94+
CompilationDatabase: ${SCRATCHDIR}/build/celeritas-reldeb-orange
95+
Add:
96+
[
97+
-isystem,
98+
/usr/include/c++/${_gcc_version},
99+
-isystem,
100+
/usr/local/include,
101+
-isystem,
102+
/usr/include,
103+
-isystem,
104+
/usr/include/x86_64-linux-gnu/c++/${_gcc_version},
105+
]
106+
EOF
107+
fi
108+
unset _clangd
109+
fi
110+
111+
export XDG_CACHE_HOME="${SCRATCHDIR}/cache"

0 commit comments

Comments
 (0)