DPC++ Runtime
Runtime libraries for oneAPI Data Parallel C++
device_selector.hpp
Go to the documentation of this file.
1 //==------ device_selector.hpp - SYCL device selector ---------*- C++ --*---==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
13 
14 // 4.6.1 Device selection class
15 
17 namespace sycl {
18 
19 // Forward declarations
20 class device;
21 
28 class __SYCL_EXPORT device_selector {
29 protected:
30  // SYCL 1.2.1 defines a negative score to reject a device from selection
31  static constexpr int REJECT_DEVICE_SCORE = -1;
32 
33 public:
34  virtual ~device_selector() = default;
35 
36  virtual device select_device() const;
37 
38  virtual int operator()(const device &device) const = 0;
39 };
40 
46 class __SYCL_EXPORT default_selector : public device_selector {
47 public:
48  int operator()(const device &dev) const override;
49 };
50 
56 class __SYCL_EXPORT gpu_selector : public device_selector {
57 public:
58  int operator()(const device &dev) const override;
59 };
60 
66 class __SYCL_EXPORT cpu_selector : public device_selector {
67 public:
68  int operator()(const device &dev) const override;
69 };
70 
76 class __SYCL_EXPORT accelerator_selector : public device_selector {
77 public:
78  int operator()(const device &dev) const override;
79 };
80 
86 class __SYCL_EXPORT host_selector : public device_selector {
87 public:
88  int operator()(const device &dev) const override;
89 };
90 } // namespace sycl
91 } // __SYCL_INLINE_NAMESPACE(cl)
cl::sycl::device_selector
The device_selector class provides ability to choose the best SYCL device based on heuristics specifi...
Definition: device_selector.hpp:28
cl::sycl::info::device
device
Definition: info_desc.hpp:50
cl::sycl::gpu_selector
Selects any SYCL GPU device.
Definition: device_selector.hpp:56
cl::sycl::default_selector
The default selector chooses the first available SYCL device.
Definition: device_selector.hpp:46
export.hpp
cl::sycl::device
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:35
defines.hpp
cl::sycl::accelerator_selector
Selects any SYCL accelerator device.
Definition: device_selector.hpp:76
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
cl::sycl::host_selector
Selects SYCL host device.
Definition: device_selector.hpp:86
cl::sycl::cpu_selector
Selects any SYCL CPU device.
Definition: device_selector.hpp:66
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12