File indexing completed on 2025-08-06 08:11:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "Acts/Plugins/Sycl/Utilities/DeviceSelector.hpp"
0011
0012
0013 #include <CL/sycl.hpp>
0014
0015 namespace Acts::Sycl {
0016 DeviceSelector::DeviceSelector(const std::string& deviceName)
0017 : m_defaultSelector(cl::sycl::default_selector()),
0018 m_deviceName(deviceName) {}
0019
0020 int DeviceSelector::operator()(const cl::sycl::device& d) const {
0021
0022 const std::string vendor = d.get_info<cl::sycl::info::device::vendor>();
0023 const std::string version = d.get_info<cl::sycl::info::device::version>();
0024 if ((vendor.find("NVIDIA") != std::string::npos) &&
0025 (version.find("OpenCL") != std::string::npos)) {
0026 return -1;
0027 }
0028
0029
0030 if (!m_deviceName.empty()) {
0031 if (d.get_info<cl::sycl::info::device::name>().find(m_deviceName) !=
0032 std::string::npos) {
0033 return 1;
0034 } else {
0035 return -1;
0036 }
0037 }
0038
0039
0040 return m_defaultSelector(d);
0041 };
0042 }