Migrating to SYCL
One-stop forum for getting assistance migrating your existing code to SYCL
48 Discussions

How to Run oneAPI Ported DPC++ Code on Nvidia GPU

-Light-
Novice
1,298 Views

Hello,

I recently ported a CUDA project to DPC++ using oneAPI and successfully ran it on an Intel GPU. Now, I would like to run the same project on an Nvidia GPU on Windows to compare performance. How can I achieve this?

I tried using the following code to target the Nvidia GPU, but it did not recognize the NVIDIA GeForce RTX 3060 on my computer.

The code is attached below.

 

std::vector<platform> platforms = platform::get_platforms();
for (const auto& plt : platforms) {
std::string platform_name = plt.get_info<info::platform::name>();
std::cout << "Platform: " << platform_name << std::endl;
std::vector<device> devices = plt.get_devices();
for (const auto& dev : devices) {
if (dev.is_gpu()) {
std::string device_name = dev.get_info<info::device::name>();
std::string device_vendor = dev.get_info<info::device::vendor>();
std::string driver_version = dev.get_info<info::device::driver_version>();
std::cout << " GPU Device: " << device_name << std::endl;
std::cout << " Vendor: " << device_vendor << std::endl;
std::cout << " Driver Version: " << driver_version << std::endl;
}
}
}

Thank you!

0 Kudos
1 Reply
yzh_intel
Moderator
863 Views

Hi, coldplay provides CUDA plugin for dpc++ compiler, you may need to install this plugin and make sure sycl-ls can find cuda backend like below. sycl-ls is a utility provide in oneapi basekit. 

$ sycl-ls
[cuda:gpu][cuda:0] NVIDIA CUDA BACKEND, NVIDIA A100 80GB PCIe 8.0 [CUDA 12.7]

During compilation you may need to add one more option to target NVIDIA gpu, 

-fsycl-targets=nvptx64-nvidia-cuda

More details can be found here

0 Kudos
Reply