Support for AMD ROCm gpu

JosueCom: <p>Is there ongoing work to try to bring PyTorch support for AMD gpus?</p>

albanD: <p>Hi,</p>
<p>We already do.<br>
You can see the corresponding “rocm” builds in our CI that make sure it all works <a href="https://ezyang.github.io/pytorch-ci-hud/build1/pytorch-master">in our CI hud</a>.</p>

JosueCom: <p>I have an pc with a Nvidia gpu but I am looking into building an app that can run in multiple pcs and a server that I have at home with an amd gpu. When visiting the site that you mentioned, I got the following site. Is this correct?</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/f/5/f5862330ef65601444bc8c75742c68f8bc6fc472.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/f5862330ef65601444bc8c75742c68f8bc6fc472" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/f/5/f5862330ef65601444bc8c75742c68f8bc6fc472_2_690x406.jpeg" alt="image" data-base62-sha1="z20mQkYC1UzQdp6FKLcXFNAam6m" width="690" height="406" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/f/5/f5862330ef65601444bc8c75742c68f8bc6fc472_2_690x406.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/f/5/f5862330ef65601444bc8c75742c68f8bc6fc472_2_1035x609.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/f/5/f5862330ef65601444bc8c75742c68f8bc6fc472_2_1380x812.jpeg 2x" data-dominant-color="EBECEC"><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">3239×1909 2.78 MB</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>

albanD: <p>Yes, each column is a different build we test for. You can see in them all the “rocm” builds.</p>
<p>That being said. I don’t know if and how you can build a single app that will run on all these devices. I think you have to specify cuda, rocm or nothing at build time.</p>

JosueCom: <p>Right now, I have support for cpu, cuda and mixed precision by searching for the user’s devices and picking the best one when the app loads. After I send it to the appropriate device and added a few if statement for amp.</p>
<p>The type of app that I am referring to is one that I can send models to edge-computers, train them and then send them back. So, a type of interface that can allow that without having to go through ssh or something similar. A client and server framework.</p>
<p>So, for rocm, does one have to have a specific build depending on the gpu that one has?</p>
<p>I also a bit confused with the set up of the site. How does one download the build?</p>

tom: <p>You can choose which GPU archs you want to support by providing a comma separated list at build-time (I have instructions for <a href="https://lernapparat.de/pytorch-rocm/" rel="nofollow noopener">building for ROCm</a> on my blog) or use an <a href="https://rocmdocs.amd.com/en/latest/Deep_learning/Deep-learning.html#pytorch" rel="nofollow noopener">the AMD-provided packages</a> with broad support).</p>

JosueCom: <p>Good to know. Thanks</p>

JosueCom: <p>Thanks for your help</p>

mathematics: <p>It is quite sad, Pytorch most preferred to Nvidia GPU.There is monopoly of Nvidia in market, on other hand, poor people cant afford because of Expensive monopoly cost. On other hand , for poor beginners, Building and making to support is a intense  pain.<br>
As I used to prefer opensource software, but Nvidia gpu drivers dont really much support opensource, leaving our privacy to their hands.</p>
<details>
<summary>
</summary>
<p>[ hatered toward nvidia doesnt mean hate to our moderators, but i love them]</p>
</details>

JosueCom: <p>Completely agree with you about Nvidia’s monopoly. I had to spend $500 on a Nvidia gpu for a new desktop; it being the most expensive part of the built. I would argue that a gpu should cost less than a cpu based on the functionalities and performance offered in comparison. However, often GPUs cost 3 to 5 times what a cpu would cost. Crazy! Nvidia is extremely greedy</p>
<p>I am grateful for the people from Nvidia here. They have helped me a lot. I am referring to the company policies, not the employees</p>

albanD: <p>Hi,</p>
<p>I agree with you that the support is not equivalent for both platforms unfortunately.<br>
But to give some historical context, even back in the torch7 days (whose backend was the base of pytorch), when the number of devs wasn’t much more than 5 people, there were nvidia engineers working on adding kernels and cuda support to the lib. So I think it is natural that the nvidia support is better as we just didn’t have enough people on the project to add similar support for rocm (IIRC there is an opensource extention that was adding support for it developped by a couple other people).</p>
<p>That being said, now that we have more people, we do try to add more support for amd gpus (new CI, new binaries, etc). So hopefully the experience shouldn’t be as bad as it used to be.<br>
But don’t hesitate to raise up issues for things that are missing on this side.</p>