Skip to content
This repository was archived by the owner on Jul 15, 2026. It is now read-only.

Alpaka inhomogeneous magnetic field - #1202

Merged
krasznaa merged 41 commits into
acts-project:mainfrom
StewMH:alpaka_magfield
Jan 25, 2026
Merged

krasznaa merged 41 commits into
acts-project:mainfrom
StewMH:alpaka_magfield

Conversation

@StewMH

@StewMH StewMH commented Nov 18, 2025 •

Copy link
Copy Markdown
Contributor

Implementation of alpaka on-device magnetic field. This either calls the CUDA or SYCL versions, or a HIP implementation written here. In principle this could be factorised out as well.

Seems to give reasonable results, although not identical track parameters.
1)AMD HIP:

Using Alpaka device: AMD Instinct MI210 [id: 0]
Warm-up processing [==================================================] 100% [00m:00s]
Event processing   [==================================================] 100% [00m:00s]
Reconstructed track parameters: 7107
Time totals:
                  File reading  5 ms
            Warm-up processing  827 ms
              Event processing  7832 ms
Throughput:
            Warm-up processing  82.7008 ms/event, 12.0918 events/s
              Event processing  78.3286 ms/event, 12.7667 events/s

2)NVidia CUDA:

Using Alpaka device: NVIDIA A100 80GB PCIe [id: 0]
Warm-up processing [==================================================] 100% [00m:00s]
Event processing   [==================================================] 100% [00m:00s]
Reconstructed track parameters: 7373
Time totals:
                  File reading  4 ms
            Warm-up processing  429 ms
              Event processing  1843 ms
Throughput:
            Warm-up processing  42.9128 ms/event, 23.3031 events/s
              Event processing  18.4336 ms/event, 54.2489 events/s

3)After some delay, Intel (with FP64 emulation):

Using Alpaka device: Intel(R) Data Center GPU Flex 170 [id: 0]
Reconstructed track parameters: 7212
Time totals:
                  File reading  4 ms
            Warm-up processing  1090842 ms
              Event processing  11936 ms
Throughput:
            Warm-up processing  109084 ms/event, 0.00916723 events/s
              Event processing  119.369 ms/event, 8.37741 events/s

Comment thread device/alpaka/src/utils/magnetic_field_types.hpp
Comment thread extern/covfie/CMakeLists.txt Outdated
StewMH and others added 11 commits November 18, 2025 16:48
Expand on the number of Kalman fit status codes and track fit outcomes to make a more fine-grained distinction between different error types in the Kalman fitter possible. Takes up the improvements in acts-project#1177.

Edit: The wire chamber Kalman fitter test had to be adapted, because more error states are recognized

Edit2: Also fixed the condition of is_complete for the backward fit to point one position below the first state
If the navigation in the forward KF missed a surface, advance the track state iterator correctly (for example if the propagation config between CKF and KF is different or we are running truth fitting). This is only needed for navigators that are not "guided" or "direct".
It also adds an option to the KF to do the full hole count, which is only possible if the propagation starts at the IP and continues through the whole detector, otherwise the first and last holes are missed and the hole count remains an underestimation. Since this will not help in increasing the fit accuracy, but eat more compute resources it will remain optional.
This commit switched the measurement IO code to optionally get the
dimensionality from the detector description rather than from the
measurement input data.
This commit reworks the covariance estimation logic to match that used
in ACTS. It greatly increases the covariances of tracks, hopefully
increasing the tracking efficiency.
The CUDA CI jobs are currently running out of disk space. This commit
builds ACTS separately, as a release build, in order to save space.
This PR is a revival of acts-project#652, removing the obsolete Kokkos and Futhark
code bases.
Did not bother with the host algorithm, because:
  - It's not actively used in any current workflow;
  - It works correctly without this optimization as well.
@StewMH
StewMH marked this pull request as ready for review November 27, 2025 11:08
@StewMH

StewMH commented Nov 28, 2025

Copy link
Copy Markdown
Contributor Author

Think this is ready to merge.

@krasznaa krasznaa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The feature addition in general is great of course. Let's just arrange the code in a better way. 😉

Comment thread device/alpaka/src/utils/make_magnetic_field.cpp
@sonarqubecloud

sonarqubecloud Bot commented Dec 8, 2025

Copy link
Copy Markdown

Comment thread device/cuda/CMakeLists.txt Outdated

@krasznaa krasznaa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's discuss in Friday's parallelization meeting about this a little. I'm not absolutely sure what will be the most elegant setup for all this code. 🤔

Comment thread CMakeLists.txt Outdated
Comment on lines +60 to +64
option( TRACCC_BUILD_CUDA "Build the CUDA sources included in traccc" FALSE )
option( TRACCC_BUILD_CUDA_UTILS "Build the CUDA util sources included in traccc" FALSE )
option( TRACCC_BUILD_HIP "Build the HIP sources included in traccc" FALSE)
option( TRACCC_BUILD_SYCL "Build the SYCL sources included in traccc" FALSE )
option( TRACCC_BUILD_SYCL_UTILS "Build the SYCL util sources included in traccc" FALSE )

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We haven't done such a thing in traccc yet, but this appears to be a good use-case. Let's use cmake_dependent_option(...) for setting up these flags.

I have the following in mind:

option( TRACCC_BUILD_CUDA_UTILS "Build the CUDA utility sources included in traccc" FALSE )
cmake_dependent_option( TRACCC_BUILD_CUDA "Build the CUDA sources included in traccc"
   FALSE TRACCC_BUILD_CUDA_UTILS FALSE )

I think this would produce the wanted behaviour, but you should experiment a little. Of course what we want is:

  • In case TRACCC_BUILD_CUDA_UTILS==FALSE, then TRACCC_BUILD_CUDA must be FALSE;
  • if TRACCC_BUILD_CUDA_UTILS==TRUE, then TRACCC_BUILD_CUDA may be TRUE (but is not by default);

And then of course, to make things really fancy, you should make TRACCC_BUILD_ALPAKA depend on the utility flags as well. 🤔

Comment thread device/alpaka/CMakeLists.txt
Comment thread device/sycl/CMakeLists.txt Outdated
Comment on lines +16 to +36
traccc_add_library( traccc_sycl_utils sycl_utils TYPE SHARED
# Utilities.
"include/traccc/sycl/utils/algorithm_base.hpp"
"src/utils/algorithm_base.sycl"
"include/traccc/sycl/utils/make_prefix_sum_buff.hpp"
"src/utils/make_prefix_sum_buff.sycl"
"include/traccc/sycl/utils/queue_wrapper.hpp"
"src/utils/queue_wrapper.cpp"
"include/traccc/sycl/utils/make_magnetic_field.hpp"
"src/utils/make_magnetic_field.sycl"
"src/utils/magnetic_field_types.hpp"
"src/utils/barrier.hpp"
"src/utils/calculate1DimNdRange.hpp"
"src/utils/calculate1DimNdRange.sycl"
"src/utils/get_queue.hpp"
"src/utils/get_queue.sycl"
"src/utils/thread_id.hpp"
"src/utils/oneDPL.hpp"
"src/sanity/contiguous_on.hpp"
"src/sanity/ordered_on.hpp"
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In both the CUDA and the SYCL case the utility library needs to only hold the code that has a public interface. There is absolutely no need to include stuff like get_queue and calculate1DimNdRange. The utility library should actually be quite little for both CUDA and SYCL.

It might actually turn out that, at least at the moment, you wouldn't even need to link traccc::cuda against traccc::cuda_utils. We may only ever put "utilities" into these libraries that are not direct dependencies of the device algorithms/tools.

Of course if that turns out to be the case, the CMake cache option inter-dependencies simplify a little as well. 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK so just magnetic_field at the moment in cuda_utils? I can fix this.

@StewMH

StewMH commented Jan 14, 2026

Copy link
Copy Markdown
Contributor Author

I can't join the meeting on Friday but happy to go with whatever's decided (I don't have particularly strong feelings on this).

@sonarqubecloud

Copy link
Copy Markdown

@StewMH

StewMH commented Jan 24, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @krasznaa for the work in #1237 - hopefully this is good to go now.

@krasznaa krasznaa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's go ahead like this.

@krasznaa
krasznaa merged commit ebe6934 into acts-project:main Jan 25, 2026
27 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants