-
Notifications
You must be signed in to change notification settings - Fork 85
Build MIGraphX Source in ROCm3.3
Build MIGraphX source in ROCm3.3 is very similar as that in ROCm3.7 as described in the MIGraphX repository
webpage. The only difference is that the compiler in ROCm3.3 is hcc
rather
than the `clang++' in ROCm3.7 or later releases.
The dependencies required to build MIGraphX source are the same and listed
here. They can be downloaded and installed one by one
manually or throught a script install_prereqs_rocm3.3.sh. To install them one by one manually, you can refer to
the corresponding website for the build and installation instructions. To use the script to install them, you can
download this script install_prereqs_rocm3.3.sh and copy it to the location as
$migraphx_dir/tools/install_prereqs_rocm3.3.sh
, then run the command ./tools/install_prereqs_rocm3.3.sh
.
By default, all dependencies are installed at the default location /usr/local and are accessible by all users. For the default
location, sudo
is required to run the script. You can also specify a location at which the dependencies are installed using
the command ./tools/install_prereqs_rocm3.3.sh $your_loc
.)
With the dependencies installed successfully, MIGraphX source code can be built as:
- Go to the preject folder and create a build directory:
mkdir build
cd build
- Configure the cmake. If the dependencies are installed at the default location
/usr/local
, the command is:
CXX=/opt/rocm/bin/hcc cmake ..
Otherwise, you need to set -DCMAKE_PREFIX_PATH=$your_loc
to configure the cmake as:
CXX=/opt/rocm/bin/hcc cmake -DCMAKE_PREFIX_PATH=$your_loc ..
- Build MIGraphX source code
make -j$(nproc)
Correctness can be verified as:
make -j$(nproc) check
MIGraphX libs can be installed as:
make install
Note that the only different from that in ROCm3.7 is that the compiler used here.
Use the ROCm build tool rbuild.
In this approach, we need to install the rbuild first, then use it to build MIGraphX. rbuild can be installed as (sudo may be needed.):
pip3 install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz
and pip3 can be installed as sudo apt update && sudo apt install -y python3-pip
.
We also need to install rocm-cmake as sudo apt install -y rocm-cmake
.
Then MIGraphX can be built as:
rbuild build -d depend -B build --cxx=/opt/rocm/bin/hcc
Again, the difference is the compiler used here.
We provide a docker file hcc.docker to build a docker container that includes all the dependencies. You can download this docker file to the project folder, use the following commands to build and create a container.
The easiest way to setup the development environment is to use docker. With the docker file, you can build an docker image as:
docker build -t migraphx:rocm3.3 -f hcc.docker .
Then to enter the developement environment use docker run
:
docker run --device='/dev/kfd' --device='/dev/dri' -v=`pwd`:/code/AMDMIGraphX -w /code/AMDMIGraphX --group-add video -it migraphx:rocm3.3
In the docker container, all the required dependencies are already installed, so users can just go to the folder
/code/AMDMIGraphX
and follow the steps in the above [Use cmake to build MIGraphX]
(https://github.com/ROCmSoftwarePlatform/AMDMIGraphX/wiki/Build-MIGraphX-Source-in-ROCm3.3#use-cmake-to-build-migraphx-source) section to build MIGraphX source.