How to Build Pytorch from source for ROCm?

Odin234: <p>'m asking question after trying to build pytorch for months with no results.<br>
Hope some devs would help.<br>
I built pytorch from source in a <strong>local python environment</strong> for specific text-generation-ui app in linux.<br>
The compile ends with no libhipblas.so, and the other .so files, and rocblas folder in torch/lib folder. Those libraries are required for text-generation to run.</p>
<p>Tested in different python versions from 3.8 to 3.11, different gcc versions from 11 to 13 and two different distros: ubuntu and arch.<br>
No luck.</p>
<p>Yes, I could use the nightly whl or some whl(s) available, with those .so libraries available, but it will defeat the purposes.<br>
I’m using 7900 xtx gpu, trying to make it work for ml/ai things since the released beta of rocm5.5, pytorch released whl always behind the rocm versions, that’s why I should build pytorch from source. In the time of writing this question, rocm has released version 5.6, and 5.6.1 in beta stage.</p>
<p>My question is, <strong>is there any other specific flags, or cmake setups, or different setting beside the guide provided</strong> in the page</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/pytorch/pytorch">
  <header class="source">
      <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32">

      <a href="https://github.com/pytorch/pytorch" target="_blank" rel="noopener nofollow ugc">GitHub</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:690/345;"><img src="https://opengraph.githubassets.com/88dbfee1666834eda4110c962df02b4de784ecaf7db89d174635419cb625c5b7/pytorch/pytorch" class="thumbnail" width="690" height="345"></div>

<h3><a href="https://github.com/pytorch/pytorch" target="_blank" rel="noopener nofollow ugc">GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with...</a></h3>

  <p>Tensors and Dynamic neural networks in Python with strong GPU acceleration - GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration</p>


  </article>

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

  <div style="clear: both"></div>
</aside>
<p>
to build pytorch from source so we can have libraries at least similar to the released whls?</p>
<p>I have searched github issues, online guides to build pytorch, no result.<br>
I have posted question in the pytorch github and no answers<br>
Hope some pros would help here.</p>
<p>Thank you.<br>
<a class="mention" href="/u/ptrblck">@ptrblck</a> <a class="mention" href="/u/tom">@tom</a></p>

ptrblck: <p>Please don’t tag specific users as it could discourage others to post a valid question and could just create noise.</p>
<p>To your question: I don’t know as I’m not familiar with rocm.</p>

tom: <p>Back in the olden days of Radeon VII, I used <a href="https://lernapparat.de/pytorch-rocm/" rel="noopener nofollow ugc">the recipe on my blog</a>.<br>
I’d suspect that the overall process is similar, but I haven’t really tried recently.</p>

Stella_Laurenzo1: <p>If you’re like me, you read right past the fact that this page doesn’t just contain installation instructions but also build instructions: <a href="https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/3rd-party/pytorch-install.html" class="inline-onebox" rel="noopener nofollow ugc">Installing PyTorch for ROCm — ROCm installation (Linux)</a> (I had to ask internal to AMD because my brain didn’t categorize these as developer instructions on a quick skim).</p>