Skip to content

GPU CMake: enable the Metal backend by default where the toolchain supports it - #15982

Open
ktf wants to merge 4 commits into
AliceO2Group:devfrom
ktf:pr15982
Open

ktf wants to merge 4 commits into
AliceO2Group:devfrom
ktf:pr15982

Conversation

@ktf

@ktf ktf commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

ENABLE_METAL defaults to AUTO like the other backends: it is used when the
Metal toolchain compiles MSL 4.1 (macOS 27) and silently skipped otherwise.

Notice that in any case by default we use the CPU, even when Metal is available.

@ktf
ktf requested review from a team and davidrohr as code owners October 17, 2026 14:02
@ktf

ktf commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

In case someone wants to experiment with it while I am away...

@alibuild

alibuild commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Error while checking build/O2/fullCI_slc9 for e139bea at 2026-11-10 03:51:

-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindHepMC.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindFlukaVMC.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindTBB.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/Findpythia.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindVMC.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindGeant4VMC.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindRapidJSON.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/O2Dependencies.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindO2GPU.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindFastJet.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/O2CompileFlags.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindVGM.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindO2GPUWayland.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindLibUV.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindVtune.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindGeant4.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindMCStepLogger.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/O2SimulationDependencies.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindOpenMPMacOS.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindlibjalienO2.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/Findpythia6.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindGLFW.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindXRootD.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindHepMC3.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindAliRoot.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindGeant3.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/CMakeLists.txt
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/O2TestsAdapter.cmake
-- Installing: /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/lib/cmake/O2/FindAliceGridUtils.cmake
+ mkdir -p /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/etc/modulefiles
+ rsync -a --delete etc/modulefiles/ /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15/etc/modulefiles
+ cp /sw/BUILD/4088699252dd5e472752d9611987d69a5fe93e8b/O2/compile_commands.json /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local15
++ readlink /sw/SOURCES/O2/slc9_x86-64-slc9_x86-64/0
+ DEVEL_SOURCES=/O2
+ '[' /O2 '!=' /sw/SOURCES/O2/slc9_x86-64-slc9_x86-64/0 ']'
+ perl -p -i -e 's|/sw/SOURCES/O2/slc9_x86-64-slc9_x86-64/0|/O2|' compile_commands.json
+ ln -sf /sw/BUILD/4088699252dd5e472752d9611987d69a5fe93e8b/O2/compile_commands.json /O2/compile_commands.json
+ [[ -n '' ]]
+ checkFindO2GPU
+ [[ -n /alidist ]]
+ [[ -f /alidist/resources/FindO2GPU.cmake ]]
+ cmp -s /alidist/resources/FindO2GPU.cmake /sw/SOURCES/O2/slc9_x86-64-slc9_x86-64/0/dependencies/FindO2GPU.cmake
++ grep '# FindO2GPU.cmake Version ' /alidist/resources/FindO2GPU.cmake
++ awk '{print $4}'
++ grep '# FindO2GPU.cmake Version ' /sw/SOURCES/O2/slc9_x86-64-slc9_x86-64/0/dependencies/FindO2GPU.cmake
++ awk '{print $4}'
+ [[ ! 23 -gt 24 ]]
+ echo 'FindO2GPU.cmake differs in O2 compared to alidist, please sync O2/dependencies/FindO2GPU.cmake to alidist/resources and make sure to update the version number'
FindO2GPU.cmake differs in O2 compared to alidist, please sync O2/dependencies/FindO2GPU.cmake to alidist/resources and make sure to update the version number
+ exit 1

Full log here.

ktf added 4 commits November 12, 2026 08:57
The stage run with ENABLE_GPU_TEST=1 was hardcoded to CUDA. FST_GPUTYPE
selects it, e.g. FST_GPUTYPE=METAL on macOS; the default stays CUDA.
…pports it

ENABLE_METAL defaults to AUTO like the other backends: it is used when the
Metal toolchain compiles MSL 4.1 (macOS 27) and silently skipped otherwise.

Notice that in any case by default we use the CPU, even when Metal is available.
@ktf ktf changed the title Enable Metal if available GPU CMake: enable the Metal backend by default where the toolchain supports it Nov 12, 2026
@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2/fullCI_slc9 for 720ab81 at 2026-11-12 09:57:

[ 98%] Linking CXX shared library libGPUTrackingCPUDevice.so
[100%] Built target GPUTrackingCPUDevice
In file included from /O2/GPU/GPUTracking/utils/qconfig.cxx:438:
/O2/GPU/GPUTracking/utils/qconfig_genrtti.inc: In function 'std::tuple<std::vector<T, std::allocator<_Up> >, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > qConfig::internal::qConfigGenRTTI(const std::vector<std::__cxx11::basic_string<char> >*) [with T = qConfig::qConfigRTTIentry; Structs = {}]':
/O2/GPU/GPUTracking/utils/qconfig_genrtti.inc:76:68: note: variable tracking size limit exceeded with '-fvar-tracking-assignments', retrying without
   76 | static inline std::tuple<std::vector<T>, std::vector<std::string>> qConfigGenRTTI(const std::vector<std::string>* configStructs = nullptr) // Entries (of type T, derived from qConfigRTTIentry) and list of config structs. Filter: struct types Structs at compile time (code only generated for those), else the names in configStructs at runtime (all if nullptr)
      |                                                                    ^~~~~~~~~~~~~~
[100%] Linking CXX executable ca
[100%] Built target ca
Install the project...
-- Install configuration: "RELEASE"
-- Installing: /sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/libGPUUtils.so
-- Set non-toolchain portion of runtime path of "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/libGPUUtils.so" to "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone"
-- Installing: /sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/libTPCFastTransformation.so
-- Set non-toolchain portion of runtime path of "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/libTPCFastTransformation.so" to "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone"
-- Installing: /sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/libGPUTracking.so
-- Set non-toolchain portion of runtime path of "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/libGPUTracking.so" to "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone"
-- Installing: /sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/include/GPU/GPUReconstructionKernelList.h
-- Installing: /sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/include/GPU/GPUReconstructionKernelIncludes.h
-- Installing: /sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/include/GPU/GPUReconstructionIncludesDeviceAll.h
-- Installing: /sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/include/GPU/GPUDefParametersRuntime.h
-- Installing: /sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/include/GPU/GPUDefParametersLoad.inc
-- Installing: /sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/include/GPU/GPUDefParametersLoadPrepare.h
-- Installing: /sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/libGPUTrackingCPUDevice.so
-- Set non-toolchain portion of runtime path of "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/libGPUTrackingCPUDevice.so" to "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone"
-- Installing: /sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/ca
-- Set non-toolchain portion of runtime path of "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/ca" to "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone"
-- Installing: /sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/libstandalone_support.so
-- Set non-toolchain portion of runtime path of "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/libstandalone_support.so" to "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone"
-- Installing: /sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/libstandalone_support2.so
-- Set non-toolchain portion of runtime path of "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone/libstandalone_support2.so" to "/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2/standalone"
/sw/BUILD/2ce16b52ada09eb50930e1c4d7db18ab55525d80/O2
++ mkdir -p etc/modulefiles
++ cat
+++ [[ slc == osx ]]
++ mkdir -p /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local14/etc/modulefiles
++ rsync -a --delete etc/modulefiles/ /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local14/etc/modulefiles
++ [[ -n '' ]]
++ checkFindO2GPU
++ [[ -n /alidist ]]
++ [[ -f /alidist/resources/FindO2GPU.cmake ]]
++ cmp -s /alidist/resources/FindO2GPU.cmake /sw/SOURCES/O2/slc9_x86-64-slc9_x86-64/0/dependencies/FindO2GPU.cmake
+++ grep '# FindO2GPU.cmake Version ' /alidist/resources/FindO2GPU.cmake
+++ awk '{print $4}'
+++ grep '# FindO2GPU.cmake Version ' /sw/SOURCES/O2/slc9_x86-64-slc9_x86-64/0/dependencies/FindO2GPU.cmake
+++ awk '{print $4}'
++ [[ ! 23 -gt 25 ]]
++ echo 'FindO2GPU.cmake differs in O2 compared to alidist, please sync O2/dependencies/FindO2GPU.cmake to alidist/resources and make sure to update the version number'
FindO2GPU.cmake differs in O2 compared to alidist, please sync O2/dependencies/FindO2GPU.cmake to alidist/resources and make sure to update the version number
++ exit 1

Full log here.

SYNCMODE=1 CONFIG_EXTRA_PROCESS_o2_gpu_reco_workflow="GPU_global.dump=1;" WORKFLOW_DETECTORS=TPC SHMSIZE=16000000000 $O2_ROOT/prodtests/full-system-test/dpl-workflow.sh
ARGS_ALL_EXTRA="--completion-policy=wait --exit-transition-timeout 20" \
CONFIG_EXTRA_PROCESS_o2_gpu_reco_workflow="GPU_global.dump=1;" \
WORKFLOW_DETECTORS=TPC SYNCMODE=1 SHMSIZE=$((16<<30)) EXTINPUT=1 \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you propose to use EXTINPUT? It should be easiest for the user to ust convert the existing raw data, and not run DD or some other chain in parallel to go over the readout proxy. And why do we need the completion policy and exit transition settings here? I'd leave this as is, and you can add an additional comment below how to get the data from DataDistribution, but I'd not make the base version more complicated than necessary.


## Using the built-in event generator

With `--eventGenerator` the benchmark generates simple synthetic events itself, without any simulation or raw data. The parent `events/` folder has to exist, since the generator only creates the dataset folder itself:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, it might be worth mentioning it, but this built-in generator was done for some particular studies how the track fit behaves and it is fully unsupported. So I would in principle discourage using it for anything but special tests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will simply drop the changes to the documentation form this commit and review them separately.


# NOTE!!!! - Whenever this file is changed, move it over to alidist/resources
# FindO2GPU.cmake Version 23
# FindO2GPU.cmake Version 25

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does it jump by 2 version numbers?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged two commits. I will fix it.

In o2, `o2-tpc-reco-workflow` and the `o2-gpu-reco-workflow` can dump event data with the `configKeyValue` `GPU_global.dump=1;`.
This will dump the event data to the local folder, all dumped files have a `.dump` file extension. If there are multiple TFs/events processed, there will be multiple `event.i.dump` files. In order to create a standalone dataset out of these, just copy all the `.dump` files to a subfolder in `~/standalone/events/[FOLDERNAME]`.

## What a dataset consists of

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While at it, it might be worth mentioning an explaining the recreateTrivialCalibObjects option. When some of the calibration data formats in O2 changes, which happens often, the event.*.dump is still readable, but the other files need updating. It can be done either by dumping again from dpl-workflow.sh. But for MC without distortions, i.e. when all files just use nominal values, the standalone benchmark has recreateTrivialCalibObjects to recreate the files. There are 2 different verions, o2-gpu-standalone-benchmark of O2 can rebuold all of them, and the ca binary of the standalone benchmark most of them (it lacks access to CCDB).

DISABLE_PROCESSING=1 NEvents=5 NEventsQED=100 SHMSIZE=16000000000 $O2_ROOT/prodtests/full_system_test.sh
mkdir -p test && cd test
ulimit -n 1024
NEvents=5 NEventsQED=100 $O2_ROOT/prodtests/full_system_test.sh

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove DISALBE_PROCESSING? It is not needed for dumping files. And why did you remove SHMSIZE? (althoigh not 100% sure it is needed without DISABLE_PROCESSING).

@davidrohr

Copy link
Copy Markdown
Collaborator

ok, I should have said, in general I am fine with this change (as discussed in person). I also appreciate if people improve the documentation :). So please go ahead like this :).

@ktf

ktf commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

I am not sure if "people" is the right collective noun, but ok... ;-)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants