Libtorch can't run on RTX3090 GPU

I use libtorch on RTX3090, but it occurs:

terminate called after throwing an instance of 'std::runtime_error'
  what():  nvrtc: error: invalid value for --gpu-architecture (-arch)

Configuration:
pytorch v1.7.0 ->libtorch
CUDA11.0

Could you post an executable code snippet to reproduce this issue?
I’ve used libtorch==1.7.0+CUDA11.0 and adapted the CPP Export tutorial to reproduce this issue on a 3090, but the code works fine:

#include <torch/script.h> // One-stop header.

#include <iostream>
#include <memory>

int main(int argc, const char* argv[]) {
  if (argc != 2) {
    std::cerr << "usage: example-app <path-to-exported-script-module>\n";
    return -1;
  }


  torch::jit::script::Module module;
  try {
    // Deserialize the ScriptModule from a file using torch::jit::load().
    module = torch::jit::load(argv[1]);
    module.to(torch::kCUDA);
    auto tensor = torch::randn({1, 3, 224, 224}).to(torch::kCUDA);
    std::vector<torch::jit::IValue> inputs;
    inputs.push_back(tensor);
    auto output = module.forward(inputs).toTensor();
    std::cout << output << std::endl;
  }
  catch (const c10::Error& e) {
    std::cerr << "error loading the model\n";
    return -1;
  }

  std::cout << "ok\n";

Executed via:

cmake -DCMAKE_PREFIX_PATH=/workspace/src/libtorch .. && cmake --build . --config Release && ./example-app ../traced_resnet_model.pt

The above code also works fine for me. The module in my project is similar to the code snippet, and it works fine when I extract the module out of my project. But it always occurs the above error when I run the project. I don’t know why.

I rebuild libtorch using CUDA11.1 and solve this problem.

Could you send me a builded torch ? My email 2545407140@qq.com. :slightly_smiling_face: