Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:17

0001 # SPDX-PackageName = "traccc, a part of the ACTS project"
0002 # SPDX-FileCopyrightText: CERN
0003 # SPDX-License-Identifier: MPL-2.0
0004 
0005 import pathlib
0006 import logging
0007 import subprocess
0008 import typing
0009 import os
0010 
0011 from . import git
0012 
0013 log = logging.getLogger("traccc_benchmark")
0014 
0015 
0016 SPACK_LIBS_COMMIT = "069cc80b845c16bf36430fdc90130f0306b47f3e"
0017 COVFIE_V0_15_1_HASH_MISMATCH_BEGIN = "2757ac69fc61bf21fb7959d6fb30d003d6128e44"
0018 COVFIE_V0_15_1_HASH_MISMATCH_END = "00f027941a40157bed2c3f94beecd82df2b34544"
0019 
0020 
0021 def configure(
0022     source_dir: pathlib.Path, build_dir: pathlib.Path, commit, cc: str = None
0023 ):
0024     config_args = [
0025         "cmake",
0026         "-S",
0027         source_dir,
0028         "-B",
0029         build_dir,
0030         "-DTRACCC_BUILD_CUDA=ON",
0031         "-DCMAKE_BUILD_TYPE=Release",
0032         "-DTRACCC_USE_ROOT=OFF",
0033     ]
0034 
0035     if cc is not None:
0036         config_args.append("-DCMAKE_CUDA_ARCHITECTURES=%s" % cc)
0037 
0038     if git.is_parent_of(commit, SPACK_LIBS_COMMIT):
0039         log.info(
0040             "Commit is a child of (or is) %s; enabling Spack libraries",
0041             SPACK_LIBS_COMMIT[:8],
0042         )
0043         config_args.append("-DTRACCC_USE_SPACK_LIBS=ON")
0044     else:
0045         log.info(
0046             "Commit is not a child of %s; disabling Spack libraries",
0047             SPACK_LIBS_COMMIT[:8],
0048         )
0049         config_args.append("-DTRACCC_USE_SYSTEM_ACTS=ON")
0050         config_args.append("-DTRACCC_USE_SYSTEM_TBB=ON")
0051 
0052     if git.is_parent_of(
0053         commit, COVFIE_V0_15_1_HASH_MISMATCH_BEGIN
0054     ) and not git.is_parent_of(commit, COVFIE_V0_15_1_HASH_MISMATCH_END):
0055         log.info(
0056             "Commit is a child of (or is) %s but not %s; removing covfie v0.15.1 hash",
0057             COVFIE_V0_15_1_HASH_MISMATCH_BEGIN[:8],
0058             COVFIE_V0_15_1_HASH_MISMATCH_END[:8],
0059         )
0060         config_args.append(
0061             "-DTRACCC_COVFIE_SOURCE='URL;https://github.com/acts-project/covfie/archive/refs/tags/v0.15.1.tar.gz'"
0062         )
0063 
0064     subprocess.run(
0065         config_args,
0066         check=True,
0067         stdout=subprocess.DEVNULL,
0068     )
0069 
0070 
0071 def build(build_dir: pathlib.Path, parallel: int = 1):
0072     subprocess.run(
0073         [
0074             "cmake",
0075             "--build",
0076             build_dir,
0077             "--",
0078             "-j",
0079             str(parallel),
0080             "traccc_throughput_st_cuda",
0081         ],
0082         check=True,
0083         stdout=subprocess.DEVNULL,
0084     )