How to use PyTorch with AMD VEGA GPU

fkucuk: <p>I have serious problems on this issue. I know, natively, it isn’t supporting yet. However I am observing some “movements” on the AMD side with the new ROCm platform. They have a fork of PyTorch on their github. I wonder if anyone tried to install that port? I would be grateful if someone guide me through the installation and getting it to work.</p>

Felix_Lessange: <p>Pretty interested too</p>

fee0th: <p>I’d also like to know how to do this.</p>
<p>I think the first step is to install Ubuntu 18.04. Then you can install this stuff.</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/RadeonOpenCompute/ROCm#installing-from-amd-rocm-repositories">
  <header class="source">
      <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32">

      <a href="https://github.com/RadeonOpenCompute/ROCm#installing-from-amd-rocm-repositories" target="_blank" rel="noopener nofollow ugc">GitHub</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:690/344;"><img src="https://opengraph.githubassets.com/9d403ba3fc4bf56f14e7885ad72918fdcf9a93e30e25a55205d8c8a9672e5c5b/RadeonOpenCompute/ROCm" class="thumbnail" width="690" height="345"></div>

<h3><a href="https://github.com/RadeonOpenCompute/ROCm#installing-from-amd-rocm-repositories" target="_blank" rel="noopener nofollow ugc">GitHub - RadeonOpenCompute/ROCm: AMD ROCm™ Software - GitHub Home</a></h3>

  <p>AMD ROCm™ Software - GitHub Home. Contribute to RadeonOpenCompute/ROCm development by creating an account on GitHub.</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>And then IDK. GitHub says something.</p>
<aside class="onebox githubissue" data-onebox-src="https://github.com/pytorch/pytorch/issues/10657#issuecomment-415067478">
  <header class="source">

      <a href="https://github.com/pytorch/pytorch/issues/10657#issuecomment-415067478" target="_blank" rel="noopener nofollow ugc">github.com/pytorch/pytorch</a>
  </header>

  <article class="onebox-body">
    <div class="github-row">
  <div class="github-icon-container" title="Issue">
	  <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg>
  </div>

  <div class="github-info-container">
    <h4>
      <a href="https://github.com/pytorch/pytorch/issues/10657#issuecomment-415067478" target="_blank" rel="noopener nofollow ugc">AMD GPU support in PyTorch</a>
    </h4>

    <div class="github-info">
      <div class="date">
        opened <span class="discourse-local-date" data-format="ll" data-date="2018-08-18" data-time="10:36:57" data-timezone="UTC">10:36AM - 18 Aug 18 UTC</span>
      </div>

        <div class="date">
          closed <span class="discourse-local-date" data-format="ll" data-date="2023-08-16" data-time="16:42:29" data-timezone="UTC">04:42PM - 16 Aug 23 UTC</span>
        </div>

      <div class="user">
        <a href="https://github.com/hpigula" target="_blank" rel="noopener nofollow ugc">
          <img alt="hpigula" src="https://avatars.githubusercontent.com/u/41572588?v=4" class="onebox-avatar-inline" width="20" height="20">
          hpigula
        </a>
      </div>
    </div>

    <div class="labels">
        <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">
          feature
        </span>
        <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">
          module: rocm
        </span>
        <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">
          triaged
        </span>
    </div>
  </div>
</div>

  <div class="github-row">
    <p class="github-body-container">PyTorch version: 0.4.1.post2
Is debug build: No
CUDA used to build PyTorch: No<span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">ne

OS: Arch Linux
GCC version: (GCC) 8.2.0
CMake version: version 3.11.4

Python version: 3.7
Is CUDA available: No
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA

Versions of relevant libraries:
[pip] Could not collect
[conda] Could not collect

Hello I'm running latest PyTorch on my laptop with AMD [A10-9600p](https://www.amd.com/en/support/apu/amd-series-processors/amd-a10-series-apu-for-laptops/7th-gen-a10-9600p-apu) and it's iGPU that I wish to use in my projects but am not sure if it works and if yes how to set it to use iGPU but have no CUDA support on both Linux(Arch with Antergos) and Win10 Pro Insider so it would be nice to have support for something that AMD supports.</span></p>
  </div>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<blockquote>
<p>Once [ROCm is] installed, then run the cuda-&gt;hip transpiler &amp; build PyTorch.</p>
<ul>
<li>python tools/amd_build/build_pytorch_amd.py</li>
<li>USE_ROCM=1 python setup.py install</li>
</ul>
</blockquote>
<p>I’m guessing the two python commands build PyTorch, but not really sure what is meant by “run the cuda” transpiler. Don’t know where it is or how to run it.</p>
<p>Oh, also, I <em>think</em> <code>python</code> means <code>python3</code>. I tried with the <code>python</code> installed on 18.04 and the first Python command failed.</p>

fee0th: <p>This other thread might also be useful.</p><aside class="quote quote-modified" data-post="1" data-topic="20793">
  <div class="title">
    <div class="quote-controls"></div>
    <img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/odellus/48/1200_2.png" class="avatar">
    <a href="https://discuss.pytorch.org/t/building-pytorch-with-rocm/20793">Building PyTorch with ROCm</a> 
  </div>
  <blockquote>
    So I’m building PyTorch from source and the caffe2 subrepo is still using old hiprng libraries 
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
hiprng_LIBRARIES
    linked by target "caffe2_hip" in directory /home/thomas/code/pytorch/caffe2
hipsparse_LIBRARIES
    linked by target "caffe2_hip" in directory /home/thomas/code/pytorch/caffe2

-- Configuring incomplete, err…
  </blockquote>
</aside>


Hemang_Joshi: <p>is it working ? Any latest update on this ? I have radeon vega 8 mobile graphics in my laptop.</p>