AMD's library for high peformance machine learning primitives. MIOpen supports two programming models -
- OpenCL
- HIP
- A ROCm enabled platform, more info here
- Base software stack, which includes
- OpenCL - OpenCL libraries and header files
- HIP -
- HIP and HCC libraries and header files
- clang-ocl -- required
- MIOpenGEMM to enable various functionalities including transposed and dilated convolutions
- ROCm cmake modules can be installed from here
- Half - IEEE 754-based half-precision floating point library
- OpenSSL or libressl
- Boost at least version 1.58
- MIOpen uses
boost-system
andboost-filesystem
packages to enable persistent kernel cache
- MIOpen uses
The dependencies can be installed with the install_deps.cmake
, script: cmake -P install_deps.cmake
This will install by default to /usr/local
but it can be installed in another location with --prefix
argument:
cmake -P install_deps.cmake --prefix /some/local/dir
Instructions to manually install all the dependencies on Ubuntu v16 are present in this section.
MIOpen can be installed on Ubuntu using apt-get
.
For OpenCL backend: apt-get install miopen-opencl
For HIP backend: apt-get install miopen-hip
Currently both the backends cannot be installed on the same system simultaneously. If a different backend other than what currently exists on the system is desired, please remove the existing backend completely and then install the new backend.
First create a build directory:
mkdir build; cd build;
Next configure cmake. The preferred backend for MIOpen can be set using the -DMIOPEN_BACKEND
cmake variable.
cmake -DMIOPEN_BACKEND=OpenCL ..
The above assumes that OpenCL is installed in one of the standard locations. If not, then manually set these two cmake variables:
cmake -DMIOPEN_BACKEND=OpenCL -DOPENCL_LIBRARIES=<opencl-library-path> -DOPENCL_INCLUDE_DIRS=<opencl-headers-path> ..
Set the C++ compiler to hcc
.
cmake -DMIOPEN_BACKEND=HIP -DCMAKE_PREFIX_PATH="<hip-installed-path>;<hcc-installed-path>;<clang-ocl-installed-path>" ..
An example cmake step can be:
OpenSSL
installed usingapt-get
on Ubuntu v16? Yes.
CXX=/opt/rocm/hcc/bin/hcc cmake -DMIOPEN_BACKEND=HIP -DCMAKE_PREFIX_PATH="/opt/rocm/hcc;/opt/rocm/hip" -DCMAKE_CXX_FLAGS="-isystem /usr/include/x86_64-linux-gnu/" ..
OpenSSL
installed usingapt-get
on Ubuntu v16? No.
CXX=/opt/rocm/hcc/bin/hcc cmake -DMIOPEN_BACKEND=HIP -DCMAKE_PREFIX_PATH="/opt/rocm/hcc;/opt/rocm/hip" ..
By default the install location is set to '/opt/rocm', this can be set by using CMAKE_INSTALL_PREFIX
:
cmake -DMIOPEN_BACKEND=OpenCL -DCMAKE_INSTALL_PREFIX=<miopen-installed-path> ..
The default path to the System PerfDb is miopen/share/miopen/db/
within install location. The default path to the User PerfDb is ~/.config/miopen/
. For development purposes, setting BUILD_DEV
will change default path to both database files to the source directory:
cmake -DMIOPEN_BACKEND=OpenCL -DBUILD_DEV=On ..
Database paths can be explicitly customized by means of MIOPEN_DB_PATH
(System PerfDb) and MIOPEN_USER_DB_PATH
(User PerfDb) cmake variables.
The configuration can be changed after running cmake by using ccmake
:
ccmake ..
OR cmake-gui
: cmake-gui ..
The ccmake
program is not available on windows.
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.
MIOpen provides an application-driver which can be used to execute any one particular layer in isolation and measure performance and verification of the library.
The driver can be built using the MIOpenDriver
target:
cmake --build . --config Release --target MIOpenDriver
OR make MIOpenDriver
Documentation on how to run the driver is here.
The tests can be run by using the 'check' target:
cmake --build . --config Release --target check
OR make check
A single test can be built and ran, by doing:
cmake --build . --config Release --target test_tensor
./bin/test_tensor
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 ./MIOpen/doc/html folder and a PDF document inside the ./MIOpen/doc/pdf folder.
Documentation is built using generated using Doxygen and should be installed separately.
HTML and PDFs are generated using Sphinx and Breathe, with the ReadTheDocs theme.
Requirements for both Sphinx, Breathe, and the ReadTheDocs theme can be filled for these in the MIOpen/doc folder:
pip install -r ./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-3.8 -style=file -i <path-to-source-file>
Also, githooks can be installed to format the code per-commit:
./.githooks/install
If Ubuntu v16 is used then the OpenSSL
and Boost
packages can also be installed by:
sudo apt-get install libssl-dev
sudo apt-get install libboost-dev
sudo apt-get install libboost-system-dev
sudo apt-get install libboost-filesystem-dev
half
header needs to be installed from here.
The easiest way is to use docker. You can build the top-level docker file:
docker build -t miopen .
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 miopen