Shamrock
2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shamsys
include
shamsys
for_each_device.hpp
Go to the documentation of this file.
1
// -------------------------------------------------------//
2
//
3
// SHAMROCK code for hydrodynamics
4
// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5
// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6
// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7
//
8
// -------------------------------------------------------//
9
10
#pragma once
11
18
#include "
shambackends/sycl.hpp
"
19
#include <functional>
20
21
namespace
shamsys
{
22
50
inline
u32
for_each_device
(
51
std::function<
void
(
u32
,
const
sycl::platform &,
const
sycl::device &)> fct) {
52
53
u32
key_global = 0;
54
const
auto
&Platforms = sycl::platform::get_platforms();
55
for
(
const
auto
&Platform : Platforms) {
56
const
auto
&Devices = Platform.get_devices();
57
for
(
const
auto
&Device : Devices) {
58
fct(key_global, Platform, Device);
59
key_global++;
60
}
61
}
62
return
key_global;
63
}
64
65
}
// namespace shamsys
u32
std::uint32_t u32
32 bit unsigned integer
Definition
aliases_int.hpp:27
shamsys
namespace for the system handling
Definition
CommProtocolException.hpp:21
shamsys::for_each_device
u32 for_each_device(std::function< void(u32, const sycl::platform &, const sycl::device &)> fct)
Iterate over all SYCL devices and perform a given function.
Definition
for_each_device.hpp:50
sycl.hpp
Generated on Wed May 13 2026 13:21:49 for Shamrock by
1.9.8