C10 Runtime issue when building with VCPKG

Hi everyone, I am trying to build libtorch 2.13 via VCPKG and compilers by VS 2022, with CUDA Toolkit 13.0 and cudnn 9.20 as of the documentation ( pytorch/RELEASE.md at main · pytorch/pytorch · GitHub ). The package builds but it throws during execution at the following Exception

throw c10::AcceleratorError( {.function = function_name, .file = filename, .line = line_number}, err, std::move(check_message));

Here the output after try/catch

CUDA error: no kernel image is available for execution on the device Search for `cudaErrorNoKernelImageForDevice' in  for more information. For more detailed error information, run with CUDA_LOG_FILE=stderr

This basically means I can not perform operations device for acceleration (it works fine on cpu), like the following sum operation

 torch::Device device(torch::kCUDA, 0);
 torch::Tensor tensor1 = torch::ones({ 3, 3 }, torch::kFloat32).to(device);
 torch::Tensor tensor2 = torch::full({ 3, 3 }, 2.0, torch::kFloat32).to(device);
 torch::Tensor result = tensor1 + tensor2;

I tried it on two different grafic cards with the same architecture, i.e. same computer capability 8.9 and I got the same error.

  1. NVIDIA RTX 1000 Ada Generation Laptop GPU
  2. NVIDIA RTX 4000 Ada Generation

I already modified the file

<BUILD_FOLDER>\vcpkg_installed\x64-windows\share\Caffe2\Modules_CUDA_fix\upstream\FindCUDA\select_compute_arch.cmake

to enforce:

set(CUDA_KNOWN_GPU_ARCHITECTURES “Ada”)

set(CUDA_COMMON_GPU_ARCHITECTURES “8.9”)

set(CUDA_ALL_GPU_ARCHITECTURES “8.9”)

but it did not cause any effect. Any help on this topic?

Ps: I am interested in both Debug and Release binaries.

Best

Luis

Did you use TORCH_CUDA_ARCH_LIST during the source build and set it to a compatible architecture (8.9 for your direct computer capability or 8.6, or 8.0 for compatible compatibilities)?

This is my command line

cmake.exe -B .\build -S . -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="C:\Microsoft\vcpkg\scripts\buildsystems\vcpkg.cmake" -DTORCH_CUDA_ARCH_LIST="8.9"

and I also set this environment variable

$env:VCPKG_CMAKE_CONFIGURE_OPTIONS="-DTORCH_CUDA_ARCH_LIST=8.9"