- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My windows laptop has two Gpus, nvidia GPU and Intel HD Graphic. How to run dpc++ code on Intel Graphic atop Nvidia GPU?
queue myQueue(gpu_selector{})
gives Nvidia GPU and can't find Intel Graphic.
But I just like to make Intel Graphic for dpc++ applications, not for any other applications and processes.
My system can detect both as shown in the following image.
- Tags:
- General Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us.
We are working on your issue. We will get back to you with a sample code template with your requirements.
Regards
-Goutham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Nyan,
Sorry for the delay in response.
Please use the below "custom_selector" class in order to select a specific device from available devices.
Here in this "custom_selector" class, we are explicitly selecting Intel iGPU over Nvidia GPU.
#include <CL/sycl.hpp>
#include <string>
using namespace cl::sycl;
class custom_selector : public device_selector {
public:
custom_selector() : device_selector() {}
int operator()(const device& device) const override {
std::string device_name=device.get_info<info::device::name>();
if (device_name.find("Intel")!=std::string::npos) // Selecting Intel Device
if (device.get_info<info::device::device_type>() == info::device_type::gpu) //Selecting GPU device
return 100;
return -1;
}
};
int main() {
custom_selector selector;
queue myQueue(selector);
{
std::cout<<"Device Name: "<<myQueue.get_device().get_info<info::device::name>() <<std::endl;
myQueue.submit([&](handler& cgh) {
cgh.parallel_for<class my_selector>(dataRange, [=](item<1> item) {
size_t idx = item.get_linear_id();
//==============Your code Logic==================
});
});
}
myQueue.wait();
return 0;
}
I hope this resolves your issue. Please let us know if you face any further issues.
Thanks
Goutham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes it works. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Glad to hear that the solution provided has worked. We are closing this thread.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page