Building PyTorch with ROCm

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:
    linked by target "caffe2_hip" in directory /home/thomas/code/pytorch/caffe2
    linked by target "caffe2_hip" in directory /home/thomas/code/pytorch/caffe2

-- Configuring incomplete, errors occurred!

I’m having some fun getting hipsparse installed, but that’s neither here nor there. My question is that I can see it’s being actively worked on:

and it’s been changed in places

but not in others, specifically for caffe2 when building ATEN.

And it looks like the updates from hiprng were to hcrng, which has been outmoded for rocrand, which also shows up in the build files.

So, aside from getting hipsparse installed (I’ve got a bug in my hipconfig, any suggestions?

The “bug in my hipconfig” was due to the fact that ubuntu 16.04 updated to the 4.15 linux kernels, which aren’t supported by ROCm at this time.

So I’ve got hipconfig --platform outputting hcc like it should, but I’m still seeing the hiprng_LIBRARIES associated errors.

I’ve installed the HcSPARSE library, but I don’t really want to install HcRNG as the repo complains that it’s been superseded by rocrand, but ah well. I’ll install it and see if we can get this pytorch built with rocm.

Alright now I’m here and I’m opening an issue on the github.

make[2]: *** [caffe2/CMakeFiles/caffe2_hip.dir/__/aten/src/THC/] Error 1
1 error generated.
In file included from /home/thomas/code/pytorch/aten/src/THC/
In file included from /home/thomas/code/pytorch/aten/src/THC/THCStorage.hpp:6:
In file included from /home/thomas/code/pytorch/aten/src/THC/THCStorage.h:5:
/home/thomas/code/pytorch/build/caffe2/aten/src/THC/THCGeneral.h:13:10: fatal error: 'cuda_runtime.h' file not found
#include "cuda_runtime.h"
1 error generated.
Died at /opt/rocm/hip/bin/hipcc line 496.
CMake Error at (message):
  Error generating