Libtorch1.9 Can't use gpu in windows10 visio studio 2019

After I updated libtorch1.7 to version 1.9, the GPU cannot be used.
Environmental information
windows10
visio studio 2019
Before libtorch 1.6 version, I added it in the linker → command line → other options

/INCLUDE:?searchsorted_cuda@native@at@@YA?AVTensor@2@AEBV32@0_N1@Z
/INCLUDE:?warp_size@cuda@at@@YAHXZ 

But now in version 1.9 of libtorch, this method is invalid. Is there any other way to use libtorch1.9 version for windows GPU?

Hey, zheng_wang

I ended up using only /INCLUDE:?searchsorted_cuda@native@at@@YA?AVTensor@2@AEBV32@0_N1@Z to force the linker to link against torch_cuda_cu.lib.

So, you also have to add torch_cuda_cu.lib to Linker->Input and copy torch_cuda_cu.dll to the folder where your executable is located.

Hope this helps :slight_smile:

1 Like