It would be nice to have a function to test GPU availability when using SYCL.
A runtime implementation could be like:
// Checks whether GPU offloading is available in this system
// Don't forget the compilation flag "-fsycl -fsycl-targets=nvptx64-nvidia-cuda,x86_64"
// With x86_64 or spir64 for parallel CPU execution, to target both Nvidia GPUs and native CPUs.
static bool has_gpu()
{
auto devices = ::sycl::device::get_devices();
for (const auto& dev : devices)
{
if (dev.is_gpu())
{
return true;
}
}
return false;
}
It would be nice to have a function to test GPU availability when using SYCL.
A runtime implementation could be like: