Namespace "at::cuda" has no member "is_available"

dambo: <p>Hello,<br>
Using 1.6:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/1/b/1bb86d2fe4649353ad05b26d2bf9a6ddfbe42526.png" data-download-href="https://discuss.pytorch.org/uploads/default/1bb86d2fe4649353ad05b26d2bf9a6ddfbe42526" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/1/b/1bb86d2fe4649353ad05b26d2bf9a6ddfbe42526.png" alt="image" data-base62-sha1="3Xe1t22phPVdNB8wk5g0YqZaAm2" width="690" height="421" data-dominant-color="262C30"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">750×458 21.1 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>What is the catch? It’s working in python.</p>

tom: <p>Maybe you need to <a href="https://pytorch.org/cppdocs/api/function_namespaceat_1_1cuda_1abdf5679016d4e4149f80f3fe2e80890f.html" rel="nofollow noopener">include the <code>CUDAContext.h</code> header</a>.<br>
Note that it is a function, not a variable, so you’re missing the <code>()</code>.</p>
<p>In general, I would recommend to just put the function name you’re looking for into the C++ doc search box if you cannot find something from Python to find the right headers. (Which is not to say you should have done it this time, but to help you solve problems in the future.)</p>
<p>Best regards</p>
<p>Thomas</p>

dambo: <p>Thomas,<br>
That was just a typo, it works under CMake, not under VC 19.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/3/d/3d355c1f6563b8d3e434f80bc84208092591c6ef.png" data-download-href="https://discuss.pytorch.org/uploads/default/3d355c1f6563b8d3e434f80bc84208092591c6ef" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/3/d/3d355c1f6563b8d3e434f80bc84208092591c6ef.png" alt="image" data-base62-sha1="8JtrODDCjUuRAULGMU9qNWXLyxN" width="690" height="462" data-dominant-color="272C30"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">859×576 22.5 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

Flock1: <p>Hi,</p>
<p>I have a question regarding CUDA compatibility. I have installed cuda toolkit with PyTorch 1.6 that I installed through anaconda for python development.</p>
<p>So I wanted to ask you if I can link that cuda with the C++ library? Because I don’t have CUDA installed on the machine, just in the environment.</p>

tom: <p>Yes, PyTorch distributions contain the full libtorch, so you can use that. (I’m not sure they come with all cuda headers, there might be ones they only use indirectly.)</p>

Flock1: <p>So I am facing <a href="https://discuss.pytorch.org/t/missing-cuda-path/97017">this</a>. I don’t have CUDA installed. So what should I do to get rid of this error?</p>