Step-by-Step: Building MIOpen and hipDNN with Ninja
Step 1: Navigate to the monorepo
git clone https://github.com/ROCm/rocm-libraries.git
>cd rocm-libraries
Step 2: Create a build directoryWhat this does: Or if you want to limit parallel jobs (e.g., for memory constraints):
If you need more control, you can add these flags:
After successful build, you'll have:
mkdir -p build_miopen_hipdnn
cd build_miopen_hipdnn
Step 3: Configure with CMake using Ninja
cmake -GNinja -B . -S .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/rocm \
-DCMAKE_PREFIX_PATH=/opt/rocm \
-DROCM_LIBS_ENABLE_COMPONENTS="miopen;hipdnn"
- -GNinja - Use Ninja build system (faster than Make)
- -DCMAKE_BUILD_TYPE=Release - Optimized build
- -DCMAKE_INSTALL_PREFIX=/opt/rocm - Install location
- -DCMAKE_PREFIX_PATH=/opt/rocm - Where to find ROCm dependencies
- -DROCM_LIBS_ENABLE_COMPONENTS="miopen;hipdnn" - Build only these two projects + their dependencies
Step 4: Build both projects
ninja -j$(nproc)
ninja -j8
Step 5: Run tests (optional)
# Test everything
ninja check
# Or test specific components
ninja test
Step 6: Install (optional)
sudo ninja install
Alternative: Build with specific options
cmake -GNinja -B . -S .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/rocm \
-DCMAKE_PREFIX_PATH=/opt/rocm \
-DROCM_LIBS_ENABLE_COMPONENTS="miopen;hipdnn" \
-DBUILD_DEV=ON \
-DCMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc \
-DMIOPEN_BACKEND=HIP
Useful Ninja Commands
# Build only MIOpen
ninja miopen
# Build only hipDNN
ninja hipdnn
# Clean build
ninja clean
# Verbose output (see actual commands)
ninja -v
# Dry run (show what would be built)
ninja -n
# Build specific target
ninja MIOpenDriver
Expected Build Time
- Configuration (CMake): ~30 seconds to 2 minutes
- MIOpen build: ~20-40 minutes (first time)
- hipDNN build: ~5-10 minutes
- Total: ~30-50 minutes on MI250X system
What Gets Built
build_miopen_hipdnn/
├── projects/
│ ├── miopen/
│ │ ├── lib/libMIOpen.so
│ │ ├── bin/MIOpenDriver
│ │ └── test/
│ └── hipdnn/
│ ├── backend/src/libhipdnn.so
│ ├── frontend/
│ ├── plugins/
│ └── tests/
If You Encounter Issues
- Missing dependencies error:# The superbuild should handle this, but if needed:cmake -DROCM_LIBS_ENABLE_COMPONENTS="rocblas;hipblas;composablekernel;miopen;hipdnn" ...
- Out of memory during build:ninja -j4 # Reduce parallel jobs
- See what would be built:ninja -n | grep -E "(miopen|hipdnn)"
No comments:
Post a Comment