Open3D (C++ API)  0.18.0
SYCLContext.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
14 
15 #pragma once
16 
17 #include <CL/sycl.hpp>
18 #include <unordered_map>
19 
20 #include "open3d/core/Device.h"
21 
22 namespace open3d {
23 namespace core {
24 namespace sycl {
25 
26 namespace sy = cl::sycl;
27 
30 class SYCLContext {
31 public:
32  SYCLContext(SYCLContext const&) = delete;
33  void operator=(SYCLContext const&) = delete;
34 
36  static SYCLContext& GetInstance();
37 
39  bool IsAvailable();
40 
42  bool IsDeviceAvailable(const Device& device);
43 
45  std::vector<Device> GetAvailableSYCLDevices();
46 
48  sy::queue GetDefaultQueue(const Device& device);
49 
50 private:
51  SYCLContext();
52 
54  std::vector<Device> devices_;
55 
57  std::unordered_map<Device, sy::queue> device_to_default_queue_;
58 
60  std::unordered_map<Device, sy::device> device_to_sycl_device_;
61 };
62 
63 } // namespace sycl
64 } // namespace core
65 } // namespace open3d
Definition: Device.h:18
Definition: SYCLContext.h:30
sy::queue GetDefaultQueue(const Device &device)
Get the default SYCL queue given an Open3D device.
Definition: SYCLContext.cpp:41
void operator=(SYCLContext const &)=delete
bool IsAvailable()
Returns true if there is at least one SYCL devices.
Definition: SYCLContext.cpp:27
static SYCLContext & GetInstance()
Get singleton instance.
Definition: SYCLContext.cpp:22
std::vector< Device > GetAvailableSYCLDevices()
Returns a list of all available SYCL devices.
Definition: SYCLContext.cpp:39
bool IsDeviceAvailable(const Device &device)
Returns true if the specified SYCL device is available.
Definition: SYCLContext.cpp:29
SYCLContext(SYCLContext const &)=delete
Definition: PinholeCameraIntrinsic.cpp:16