TheRock (The HIP Environment and ROCm Kit) is a lightweight open source build platform for HIP and ROCm. The project is currently in an early preview state but is under active development and welcomes contributors. Come try us out! Please see CONTRIBUTING.md for more info.
TheRock includes:
[!IMPORTANT] See the Releases Page for instructions on how to install prebuilt ROCm and PyTorch packages.
Packages and Python wheels:
| Platform | Prebuilt tarballs and ROCm Python packages | PyTorch Python packages |
|---|---|---|
| Linux | ||
| Windows |
We keep the following instructions for recent, commonly used operating system versions. Most build failures are due to minor operating system differences in dependencies and project setup. Refer to the Environment Setup Guide for contributed instructions and configurations for alternatives.
[!TIP] While building from source offers the greatest flexibility, installing from releases in supported configurations is often faster and easier.
[!IMPORTANT] Frequent setup and building problems and their solutions can be found in section Common Issues.
[!TIP]
dvcis used for version control of pre-compiled MIOpen kernels.dvcis not a hard requirement, but it does reduce compile time.snap install --classic dvccan be used to install on Ubuntu. Visit the DVC website for other installation methods.
# Install Ubuntu dependencies
sudo apt update
sudo apt install gfortran git ninja-build cmake g++ pkg-config xxd patchelf automake libtool python3-venv python3-dev libegl1-mesa-dev
# Clone the repository
git clone https://github.com/ROCm/TheRock.git
cd TheRock
# Init python virtual environment and install python dependencies
python3 -m venv .venv && source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
# Download submodules and apply patches
python3 ./build_tools/fetch_sources.py
# Install python dependencies for submodules
pip install -r requirements-external.txt
[!IMPORTANT] See windows_support.md for setup instructions on Windows, in particular the section for installing tools.
If the build system is a non-English system. Make sure to switch to utf-8.
chcp 65001
# Install dependencies following the Windows support guide
# Clone the repository
git clone https://github.com/ROCm/TheRock.git
cd TheRock
# Init python virtual environment and install python dependencies
python -m venv .venv
.venv\Scripts\Activate.bat
pip install --upgrade pip
pip install -r requirements.txt
# Download submodules and apply patches
# Note that dvc is used for pulling large files
python ./build_tools/fetch_sources.py
# Install python dependencies for submodules
pip install -r requirements-external.txt
The build can be customized through cmake feature flags.
-DTHEROCK_AMDGPU_FAMILIES=
or
-DTHEROCK_AMDGPU_TARGETS=
[!NOTE] Not all family and targets are currently supported. See therock_amdgpu_targets.cmake file for available options.
In case you don't have an existing ROCm/HIP installation from which you can run any of these tools:
| Tool | Platform |
|---|---|
amd-smi | Linux |
rocm-smi | Linux |
rocm_agent_enumerator | Linux |
hipinfo | Windows |
offload-arch | Both |
You can install the rocm Python package for any architecture inside a venv and run offload-arch from there:
python build_tools/setup_venv.py --index-name nightly --index-subdir gfx110X-dgpu --packages rocm .tmpvenv.tmpvenv/bin/offload-arch on Linux, .tmpvenv\Scripts\offload-arch on Windowsrm -rf .tmpvenvBy default, the project builds everything available. The following group flags enable/disable selected subsets:
| Group flag | Description |
|---|---|
-DTHEROCK_ENABLE_ALL=OFF | Disables all optional components |
-DTHEROCK_ENABLE_CORE=OFF | Disables all core components |
-DTHEROCK_ENABLE_COMM_LIBS=OFF | Disables all communication libraries |
-DTHEROCK_ENABLE_MATH_LIBS=OFF | Disables all math libraries |
-DTHEROCK_ENABLE_ML_LIBS=OFF | Disables all ML libraries |
-DTHEROCK_ENABLE_PROFILER=OFF | Disables profilers |
-DTHEROCK_ENABLE_DC_TOOLS=OFF | Disables data center tools |
Individual features can be controlled separately (typically in combination with
-DTHEROCK_ENABLE_ALL=OFF or -DTHEROCK_RESET_FEATURES=ON to force a
minimal build):
| Component flag | Description |
|---|---|
-DTHEROCK_ENABLE_COMPILER=ON | Enables the GPU+host compiler toolchain |
-DTHEROCK_ENABLE_HIPIFY=ON | Enables the hipify tool |
-DTHEROCK_ENABLE_CORE_RUNTIME=ON | Enables the core runtime components and tools |
-DTHEROCK_ENABLE_HIP_RUNTIME=ON | Enables the HIP runtime components |
-DTHEROCK_ENABLE_OCL_RUNTIME=ON | Enables the OpenCL runtime components |
-DTHEROCK_ENABLE_ROCPROFV3=ON | Enables rocprofv3 |
-DTHEROCK_ENABLE_ROCPROFSYS=ON | Enables rocprofiler-systems |
-DTHEROCK_ENABLE_RCCL=ON | Enables RCCL |
-DTHEROCK_ENABLE_PRIM=ON | Enables the PRIM library |
-DTHEROCK_ENABLE_BLAS=ON | Enables the BLAS libraries |
-DTHEROCK_ENABLE_RAND=ON | Enables the RAND libraries |
-DTHEROCK_ENABLE_SOLVER=ON | Enables the SOLVER libraries |
-DTHEROCK_ENABLE_SPARSE=ON | Enables the SPARSE libraries |
-DTHEROCK_ENABLE_MIOPEN=ON | Enables MIOpen |
-DTHEROCK_ENABLE_MIOPEN_PLUGIN=ON | Enables MIOpen_plugin |
-DTHEROCK_ENABLE_HIPDNN=ON | Enables hipDNN |
-DTHEROCK_ENABLE_ROCWMMA=ON | Enables rocWMMA |
-DTHEROCK_ENABLE_RDC=ON | Enables ROCm Data Center Tool (Linux only) |
[!TIP] Enabling any features will implicitly enable their minimum dependencies. Some libraries (like MIOpen) have a number of optional dependencies, which must be enabled manually if enabling/disabling individual features.
[!TIP] A report of enabled/disabled features and flags will be printed on every CMake configure.
By default, components are built from the sources fetched via the submodules. For some components, external sources can be used instead.
| External source settings | Description |
|---|---|
-DTHEROCK_USE_EXTERNAL_COMPOSABLE_KERNEL=OFF | Use external composable-kernel source location |
-DTHEROCK_USE_EXTERNAL_RCCL=OFF | Use external rccl source location |
-DTHEROCK_USE_EXTERNAL_RCCL_TESTS=OFF | Use external rccl-tests source location |
-DTHEROCK_COMPOSABLE_KERNEL_SOURCE_DIR=<PATH> | Path to composable-kernel sources |
-DTHEROCK_RCCL_SOURCE_DIR=<PATH> | Path to rccl sources |
-DTHEROCK_RCCL_TESTS_SOURCE_DIR=<PATH> | Path to rccl-tests sources |
Further flags allow to build components with specific features enabled.
| Other flags | Description |
|---|---|
-DTHEROCK_ENABLE_MPI=OFF | Enables building components with Message Passing Interface (MPI) support |
[!NOTE] Building components with MPI support, currently requires MPI to be pre-installed until issue #1284 is resolved.
For workflows that demand frequent rebuilds, it is recommended to build it with ccache enabled to speed up the build. See instructions in the next section for Linux and Windows.
Otherwise, ROCm/HIP can be configured and build with just the following commands:
cmake -B build -GNinja . -DTHEROCK_AMDGPU_FAMILIES=gfx110X-dgpu cmake --build build
To build with the ccache compiler cache:
--offload-compress option used for compressing
AMDGPU device code.export CCACHE_SLOPPINESS=include_file_ctime to support hard-linkingcompiler_check directive to do safe caching in the
presence of compiler bootstrappingSince these options are very fiddly and prone to change over time, we recommend
using the ./build_tools/setup_ccache.py script to create a .ccache directory
in the repository root with hard coded configuration suitable for the project.
Example:
# Any shell used to build must eval setup_ccache.py to set environment
# variables.
eval "$(./build_tools/setup_ccache.py)"
cmake -B build -GNinja -DTHEROCK_AMDGPU_FAMILIES=gfx110X-dgpu \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
.
cmake --build build
We are still investigating the exact proper options for ccache on Windows and do not currently recommend that end users enable it.
Project-wide testing can be controlled with the standard CMake -DBUILD_TESTING=ON|OFF flag. This gates both setup of build tests and compilation of installed testing artifacts.
Tests of the integrity of the build are enabled by default and can be run with ctest:
ctest --test-dir build
Testing functionality on an actual GPU is in progress and will be documented separately.