SYCL - 在 Windows Visual Studio 中未检测到 GPU 平台

问题描述 投票:0回答:1

我想在 Windows 10 Pro 21H2 19044.3086 中使用 SYCL 在 Nvidia GPU 上执行工作负载。 SYCL 指南指出 Windows 支持 CUDA 后端:

Build DPC++ toolchain with support for NVIDIA CUDA
To enable support for CUDA devices, follow the instructions... for Windows DPC++ toolchain 
Note, the CUDA backend has Windows support

在 Powershell 中使用computecpp 从此处测试硬件支持时,我得到:

PS D:\repos\ComputeCpp\bin> .\computecpp_info.exe
********************************************************************************
SYCL 1.2.1 revision 3
********************************************************************************
Device Info:
Discovered 3 devices matching:
  platform    : <any>
  device type : <any>
--------------------------------------------------------------------------------
Device 0:
  Device is supported                     : UNTESTED - Vendor not tested on this OS
  Bitcode targets                         : spirv64 ptx64
  CL_DEVICE_NAME                          : NVIDIA GeForce RTX 3060 Laptop GPU
  CL_DEVICE_VENDOR                        : NVIDIA Corporation
  CL_DRIVER_VERSION                       : 535.98
  CL_DEVICE_TYPE                          : CL_DEVICE_TYPE_GPU
--------------------------------------------------------------------------------
Device 1:
  Device is supported                     : UNTESTED - Device running untested driver
  CL_DEVICE_NAME                          : AMD Ryzen 5 5600H with Radeon Graphics
--------------------------------------------------------------------------------
Device 2:
  Device is supported                     : UNTESTED - Device not tested on this OS
  CL_DEVICE_NAME                          : Intel(R) FPGA Emulation Device

但是,使用 oneAPI DPC++ Compiler 2023 检查 Visual Studio 2022 中的可用平台时,我没有获得 GPU,只有 CPU 和 FPGA 模拟器:

Found platform: Intel(R) FPGA Emulation Platform for OpenCL(TM)
 Device: Intel(R) FPGA Emulation Device

Found platform: Intel(R) OpenCL
 Device: AMD Ryzen 5 5600H with Radeon Graphics

用于此的代码:

#include <sycl/sycl.hpp>
#include <iostream>
#if FPGA || FPGA_EMULATOR
#include <sycl/ext/intel/fpga_extensions.hpp>
#endif

using namespace sycl;
int main(int argc, char* argv[]) {
    // Loop through available platforms
    for (auto const& this_platform : platform::get_platforms()) {
        std::cout << "Found platform: "
            << this_platform.get_info<info::platform::name>() << "\n";
        // Loop through available devices in this platform
        for (auto const& this_device : this_platform.get_devices()) {
            std::cout << " Device: "
                << this_device.get_info<info::device::name>() << "\n";
        }
        std::cout << "\n";
    }
    return 0;
}

我还安装了 CUDA 12.2,可以在 VS2022 中运行 CUDA 项目。为什么在 DPC++ 项目中找不到 GPU(发布和调试模式)?我应该做什么来修复它?

windows visual-studio gpu sycl dpc++
1个回答
0
投票

如果您使用的是 Linux,则可以将 Intel 的 DPC++ 版本与 Codeplay 的 OneAPI for NVidia GPUs 插件结合使用。这尚未在 Windows 上发布。

要在 Windows 上针对 NVidia GPU,您需要使用适当的标志从源代码构建开源 DPC++。有关如何执行此操作的文档可在 Intel/llvm 存储库中找到。

构建并安装此程序后,您可以使用

sycl-ls
(或
sycl-ls --verbose
了解更多详细信息)测试是否正确找到您的 NVidia 设备。

至于为什么您会看到带有computecpp_info.exe的CUDA设备:ComputeCpp独立于DPC++。仅当您使用 ComputeCpp 作为 SYCL 编译器时,才应使用computecpp_info.exe。然而,Codeplay 指出,DPC++ 的 CUDA 支持已于 2020 年被 DPC++ 取代,并且自 9 月 1 日起不再支持 ComputeCpp。

© www.soinside.com 2019 - 2024. All rights reserved.