Skip to content

Commit ef49ae3

Browse files
committed
Add Spack environment specification
This commit adds a YAML-based Spack environment specification which allows users to more easily install traccc's dependencies.
1 parent 0e989e6 commit ef49ae3

File tree

3 files changed

+59
-10
lines changed

3 files changed

+59
-10
lines changed

CMakeLists.txt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ option( TRACCC_BUILD_EXAMPLES "Build the examples of traccc" TRUE )
6565

6666
# Flags controlling what traccc should use.
6767
option( TRACCC_USE_SYSTEM_LIBS "Use system libraries be default" FALSE )
68+
option( TRACCC_USE_SPACK_LIBS "Use pack libraries by default" FALSE )
6869
option( TRACCC_USE_ROOT "Use ROOT in the build (if needed)" TRUE )
6970

7071
# Check CUDA and SYCL C++ standards
@@ -144,7 +145,7 @@ option( TRACCC_SETUP_EIGEN3
144145
"Set up the Eigen3 target(s) explicitly" TRUE )
145146
option( TRACCC_USE_SYSTEM_EIGEN3
146147
"Pick up an existing installation of Eigen3 from the build environment"
147-
${TRACCC_USE_SYSTEM_LIBS} )
148+
$<OR:$<BOOL:${TRACCC_USE_SYSTEM_LIBS}>,$<BOOL:${TRACCC_USE_SPACK_LIBS}>> )
148149
if( TRACCC_SETUP_EIGEN3 )
149150
if( TRACCC_USE_SYSTEM_EIGEN3 )
150151
find_package( Eigen3 REQUIRED )
@@ -158,7 +159,7 @@ option( TRACCC_SETUP_TBB
158159
"Set up the TBB target(s) explicitly" TRUE )
159160
option( TRACCC_USE_SYSTEM_TBB
160161
"Pick up an existing installation of TBB from the build environment"
161-
${TRACCC_USE_SYSTEM_LIBS} )
162+
$<OR:$<BOOL:${TRACCC_USE_SYSTEM_LIBS}>,$<BOOL:${TRACCC_USE_SPACK_LIBS}>> )
162163
if( TRACCC_SETUP_TBB )
163164
if( TRACCC_USE_SYSTEM_TBB )
164165
find_package( TBB REQUIRED )
@@ -172,7 +173,7 @@ option( TRACCC_SETUP_THRUST
172173
"Set up the Thrust target(s) explicitly" TRUE )
173174
option( TRACCC_USE_SYSTEM_THRUST
174175
"Pick up an existing installation of Thrust from the build environment"
175-
${TRACCC_USE_SYSTEM_LIBS} )
176+
$<OR:$<BOOL:${TRACCC_USE_SYSTEM_LIBS}>,$<BOOL:${TRACCC_USE_SPACK_LIBS}>> )
176177
if( TRACCC_SETUP_THRUST )
177178
if( TRACCC_USE_SYSTEM_THRUST )
178179
find_package( Thrust REQUIRED )
@@ -206,7 +207,7 @@ option( TRACCC_SETUP_DPL
206207
"Set up the DPL target(s) explicitly" ${TRACCC_BUILD_SYCL} )
207208
option( TRACCC_USE_SYSTEM_DPL
208209
"Pick up an existing installation of DPL from the build environment"
209-
${TRACCC_USE_SYSTEM_LIBS} )
210+
$<OR:$<BOOL:${TRACCC_USE_SYSTEM_LIBS}>,$<BOOL:${TRACCC_USE_SPACK_LIBS}>> )
210211
if( TRACCC_SETUP_DPL )
211212
if( TRACCC_USE_SYSTEM_DPL )
212213
# OneDPL determines whether SYCL is supported by asking the C++ compiler
@@ -235,7 +236,7 @@ option( TRACCC_SETUP_KOKKOS
235236
"Set up the Kokkos library" ${TRACCC_BUILD_KOKKOS} )
236237
option( TRACCC_USE_SYSTEM_KOKKOS
237238
"Pick up an existing installation of Kokkos from the build environment"
238-
${TRACCC_USE_SYSTEM_LIBS} )
239+
$<OR:$<BOOL:${TRACCC_USE_SYSTEM_LIBS}>,$<BOOL:${TRACCC_USE_SPACK_LIBS}>> )
239240
if( TRACCC_SETUP_KOKKOS )
240241
if( TRACCC_USE_SYSTEM_KOKKOS )
241242
find_package( Kokkos REQUIRED )
@@ -255,7 +256,7 @@ option( TRACCC_SETUP_ALPAKA
255256
"Set up the Alpaka library" ${TRACCC_BUILD_ALPAKA})
256257
option( TRACCC_USE_SYSTEM_ALPAKA
257258
"Pick up an existing installation of Alpaka from the build environment"
258-
${TRACCC_USE_SYSTEM_LIBS} )
259+
$<OR:$<BOOL:${TRACCC_USE_SYSTEM_LIBS}>,$<BOOL:${TRACCC_USE_SPACK_LIBS}>> )
259260
if( TRACCC_SETUP_ALPAKA )
260261
# Default options for the Alpaka build.
261262
set( alpaka_ACC_CPU_B_SEQ_T_THREADS_ENABLE TRUE CACHE BOOL
@@ -328,7 +329,7 @@ option( TRACCC_SETUP_ACTS
328329
"Set up the Acts target(s) explicitly" TRUE )
329330
option( TRACCC_USE_SYSTEM_ACTS
330331
"Pick up an existing installation of Acts from the build environment"
331-
${TRACCC_USE_SYSTEM_LIBS} )
332+
$<OR:$<BOOL:${TRACCC_USE_SYSTEM_LIBS}>,$<BOOL:${TRACCC_USE_SPACK_LIBS}>> )
332333
if( TRACCC_SETUP_ACTS )
333334
if( TRACCC_USE_SYSTEM_ACTS )
334335
find_package( Acts REQUIRED COMPONENTS PluginJson )
@@ -346,7 +347,7 @@ option( TRACCC_SETUP_GOOGLETEST
346347
"Set up the GoogleTest target(s) explicitly" ${TRACCC_DEFAULT_SETUP_GOOGLETEST} )
347348
option( TRACCC_USE_SYSTEM_GOOGLETEST
348349
"Pick up an existing installation of GoogleTest from the build environment"
349-
${TRACCC_USE_SYSTEM_LIBS} )
350+
$<OR:$<BOOL:${TRACCC_USE_SYSTEM_LIBS}>,$<BOOL:${TRACCC_USE_SPACK_LIBS}>> )
350351
if( TRACCC_SETUP_GOOGLETEST )
351352
if( TRACCC_USE_SYSTEM_GOOGLETEST )
352353
find_package( GTest REQUIRED )
@@ -360,7 +361,7 @@ option( TRACCC_SETUP_BENCHMARKS
360361
"Set up the Google Benchmark target(s) explicitly" TRUE )
361362
option( TRACCC_USE_SYSTEM_BENCHMARKS
362363
"Pick up an existing installation of Google Benchmark from the build environment"
363-
${TRACCC_USE_SYSTEM_LIBS} )
364+
$<OR:$<BOOL:${TRACCC_USE_SYSTEM_LIBS}>,$<BOOL:${TRACCC_USE_SPACK_LIBS}>> )
364365
if( TRACCC_SETUP_BENCHMARKS )
365366
if( TRACCC_USE_SYSTEM_BENCHMARKS )
366367
find_package( benchmark REQUIRED )
@@ -379,7 +380,7 @@ option( TRACCC_SETUP_INDICATORS
379380
unset( _indicatorsDefault )
380381
option( TRACCC_USE_SYSTEM_INDICATORS
381382
"Pick up an existing installation of indicators from the build environment"
382-
${TRACCC_USE_SYSTEM_LIBS} )
383+
$<OR:$<BOOL:${TRACCC_USE_SYSTEM_LIBS}>,$<BOOL:${TRACCC_USE_SPACK_LIBS}>> )
383384
if( TRACCC_SETUP_INDICATORS )
384385
if( TRACCC_USE_SYSTEM_INDICATORS )
385386
find_package( indicators REQUIRED )

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,25 @@ and toolchains that are currently known to work (last updated 2022/01/24):
195195
- [CMake](https://cmake.org/)
196196
- (Optional) [ROOT](https://root.cern/): RIO, Hist, Tree
197197

198+
### Dependency management with Spack
199+
200+
The [Spack](https://spack.io/) project provides a particularly easy way to
201+
install the dependencies that you need to use traccc. In order to use Spack to
202+
manage your dependencies, simply create a new Spack environment using the
203+
provided environment file:
204+
205+
```sh
206+
spack env create traccc spack.yaml
207+
spack -e traccc concretize -f
208+
spack -e traccc install
209+
spack env activate traccc
210+
```
211+
212+
This way, Spack will automatically download and install all dependencies
213+
necessary to use traccc with the CUDA, SYCL, Kokkos, and Alpaka programming
214+
models. When using Spack to manage your dependencies, make sure to compile
215+
traccc with the `-DTRACCC_USE_SPACK_LIBS=ON` flag.
216+
198217
## Getting started
199218

200219
### Clone the repository

spack.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# traccc library, part of the ACTS project (R&D line)
2+
#
3+
# (c) 2025 CERN for the benefit of the ACTS project
4+
#
5+
# Mozilla Public License Version 2.0
6+
spack:
7+
specs:
8+
# Build tools
9+
10+
11+
12+
- "gcc@13"
13+
# HEP dependencies
14+
15+
- "root cxxstd=20"
16+
# General dependencies
17+
18+
- "kokkos"
19+
- "alpaka"
20+
- "[email protected]: +log+program_options"
21+
- "indicators"
22+
- "benchmark ~performance_counters"
23+
# SYCL dependencies
24+
- "intel-oneapi-dpl"
25+
# Examples and test dependencies
26+
27+
view: true
28+
concretizer:
29+
unify: true

0 commit comments

Comments
 (0)