AMD's graph optimization engine.
- ROCm cmake modules required
- MIOpen for running on the GPU
- HIP for running on the GPU
- Protobuf for reading onnx files
- Half - IEEE 754-based half-precision floating point library
- pybind11 - for python bindings
Dependencies can be installed using the ROCm build tool rbuild.
To install rbuild:
pip install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz
To build dependencies along with MIGraphX
rbuild build -d depend --cxx=/opt/rocm/bin/hcc
This builds dependencies in the subdirectory named depend and then builds MIGraphX using these dependencies.
First create a build directory:
mkdir build;
cd build;
Next configure cmake. The hcc compiler is required to build the MIOpen backend:
CXX=/opt/rocm/bin/hcc cmake ..
If the dependencies from install_deps.cmake
was installed to another directory, the CMAKE_PREFIX_PATH
needs to be set to what --prefix
was set to from install_deps.cmake
:
CXX=/opt/rocm/bin/hcc cmake -DCMAKE_PREFIX_PATH=/some/dir ..
The configuration can be changed after running cmake by using ccmake
:
ccmake ..
OR cmake-gui
: cmake-gui ..
The library can be built, from the build
directory using the 'Release' configuration:
cmake --build . --config Release
OR make
And can be installed by using the 'install' target:
cmake --build . --config Release --target install
OR make install
This will install the library to the CMAKE_INSTALL_PREFIX
path that was set.
To build a debug version of the library, the cmake variable CMAKE_BUILD_TYPE
can be set to Debug
.
cmake -DCMAKE_BUILD_TYPE=Debug .
The tests can be run by using the 'check' target:
cmake --build . --config Release --target check
OR make check
HTML and PDF documentation can be built using:
cmake --build . --config Release --target doc
OR make doc
This will build a local searchable web site inside the doc/html folder.
Documentation is built using Doxygen, Sphinx, and Breathe
Requirements for both Sphinx and Breathe can be installed with:
pip install -r doc/requirements.txt
Depending on your setup sudo
may be required for the pip install.
All the code is formatted using clang-format. To format a file, use:
clang-format-5.0 -style=file -i <path-to-source-file>
Also, githooks can be installed to format the code per-commit:
./.githooks/install
The easiest way to setup the development environment is to use docker. You can build the top-level docker file:
docker build -t migraphx .
Then to enter the developement environment use docker run
:
docker run --device='/dev/kfd' --device='/dev/dri' -v=`pwd`:/data -w /data --group-add video -it migraphx