Distributed Ranges
Loading...
Searching...
No Matches
execution_policy.hpp
1// SPDX-FileCopyrightText: Intel Corporation
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#pragma once
6
7#include <span>
8#include <sycl/sycl.hpp>
9#include <vector>
10
11namespace dr::sp {
12
14 device_policy(sycl::device device) : devices_({device}) {}
15 device_policy(sycl::queue queue) : devices_({queue.get_device()}) {}
16
17 device_policy() : devices_({sycl::queue{}.get_device()}) {}
18
19 template <rng::range R>
20 requires(std::is_same_v<rng::range_value_t<R>, sycl::device>)
21 device_policy(R &&devices)
22 : devices_(rng::begin(devices), rng::end(devices)) {}
23
24 std::span<sycl::device> get_devices() noexcept { return devices_; }
25
26 std::span<const sycl::device> get_devices() const noexcept {
27 return devices_;
28 }
29
30private:
31 std::vector<sycl::device> devices_;
32};
33
34} // namespace dr::sp
Definition: execution_policy.hpp:13