-
Notifications
You must be signed in to change notification settings - Fork 58
Alpaka inhomogeneous magnetic field #1202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7425f29
5ecf0ff
20daddb
9e0a410
690568a
a82ec28
b337f26
7d5e3cd
0ec0818
98ab783
d7550a0
9a20eb5
c9d5a49
3b49096
f047bc9
3f9da81
bf36868
85e6833
9640360
113339c
753b362
3728179
8c5af92
6859c85
526a56c
a9f91c7
52a9025
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /** TRACCC library, part of the ACTS project (R&D line) | ||
| * | ||
| * (c) 2025 CERN for the benefit of the ACTS project | ||
| * | ||
| * Mozilla Public License Version 2.0 | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| // Project include(s). | ||
| #include "traccc/alpaka/utils/queue.hpp" | ||
| #include "traccc/bfield/magnetic_field.hpp" | ||
|
|
||
| namespace traccc::alpaka { | ||
|
|
||
| /// Create a magnetic field usable on the active device | ||
| /// | ||
| /// @param bfield The magnetic field to be copied | ||
| // | ||
| magnetic_field make_magnetic_field(const magnetic_field& bfield, | ||
| const queue& queue); | ||
|
|
||
| } // namespace traccc::alpaka |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /** TRACCC library, part of the ACTS project (R&D line) | ||
| * | ||
| * (c) 2025 CERN for the benefit of the ACTS project | ||
| * | ||
| * Mozilla Public License Version 2.0 | ||
| */ | ||
|
|
||
| // Local include(s). | ||
| #include "traccc/alpaka/utils/make_magnetic_field.hpp" | ||
|
|
||
| #include "magnetic_field_types.hpp" | ||
|
|
||
| // Project include(s). | ||
| #include "traccc/definitions/primitives.hpp" | ||
| #if defined(ALPAKA_ACC_GPU_CUDA_ENABLED) | ||
| #include "traccc/cuda/utils/make_magnetic_field.hpp" | ||
| #elif defined(ALPAKA_ACC_GPU_HIP_ENABLED) | ||
| // | ||
| #elif defined(ALPAKA_ACC_SYCL_ENABLED) | ||
| #include "../utils/get_queue.hpp" | ||
| #include "traccc/sycl/utils/make_magnetic_field.hpp" | ||
| #endif | ||
|
|
||
| // System include(s). | ||
| #include <stdexcept> | ||
|
|
||
| namespace traccc::alpaka { | ||
|
|
||
| magnetic_field make_magnetic_field(const magnetic_field& bfield, | ||
| [[maybe_unused]] const queue& queue) { | ||
| #if defined(ALPAKA_ACC_GPU_CUDA_ENABLED) | ||
| return traccc::cuda::make_magnetic_field( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like this. 😦 I don't want to make I would very much prefer duplicating the code from those instead. If you prefer, we could set up some CUDA, SYCL and HIP "utility code" outside of the main libraries. Let's say But I definitely don't want to also slow down the CI even further, by the Alpaka build getting even heavier. 🤔
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I like putting these in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I started off by making |
||
| bfield, traccc::cuda::magnetic_field_storage::global_memory); | ||
| #elif defined(ALPAKA_ACC_GPU_HIP_ENABLED) | ||
| if (bfield.is<const_bfield_backend_t<traccc::scalar> >()) { | ||
| return magnetic_field{covfie::field<const_bfield_backend_t<scalar> >{ | ||
| bfield.as_field<const_bfield_backend_t<traccc::scalar> >()}}; | ||
| } else if (bfield.is<host::inhom_bfield_backend_t<traccc::scalar> >()) { | ||
| return magnetic_field{covfie::field< | ||
| inhom_bfield_backend_t<traccc::scalar> >( | ||
| bfield.as_field<host::inhom_bfield_backend_t<traccc::scalar> >())}; | ||
| } else { | ||
| throw std::invalid_argument( | ||
| "Unsupported storage method chosen for inhomogeneous b-field"); | ||
| } | ||
| #elif defined(ALPAKA_ACC_SYCL_ENABLED) | ||
| ::sycl::queue q(::alpaka::getNativeHandle(details::get_queue(queue))); | ||
| traccc::sycl::queue_wrapper qw{&q}; | ||
| return traccc::sycl::make_magnetic_field(bfield, qw); | ||
| #else | ||
| return bfield; | ||
| #endif | ||
| } | ||
|
|
||
| } // namespace traccc::alpaka | ||
Uh oh!
There was an error while loading. Please reload this page.