Well, it is because torch_cuda and torch_cpu are separated to make the linker happy. (target executable/library has a size limit) However, calling torch::cuda::is_available(); doesn’t rely on any symbol in torch_cuda so the linker will optimize it away for your executable. As the result, you see FALSE there. Adding -INCLUDE:?warp_size@cuda@at@@YAHXZ forces the linker to include torch_cuda. If you use CMake, then you don’t need to set it manually. I just don’t expect so many users that create the VS project on their own. So we are working on to move this flag into the header to avoid confusing the user.
Many thanks for prompt response. I was waiting for this VS integration capability for several years and it looks great right now. Thank you for your excellent work!
Does this issue resolved ? The torch::cuda::is_available() api return false on my linux system, while torch.cuda.is_available() return True.
How to fix it ?