Skip to content

Commit

Permalink
[Enhancement] Simplify dependencies to build using rbuild (#1233)
Browse files Browse the repository at this point in the history
* Simplify dependencies to build

* Set build_dev Use newer rbuild

* Change the location of rocm-recipes

* Move cmake to develop

* Silence removal of non-existent files

* Ignore pcre dependency since it isn't needed
  • Loading branch information
pfultz2 authored and junliume committed Dec 20, 2021
1 parent dea91c9 commit 5d26505
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 60 deletions.
29 changes: 14 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unau
rocm-device-libs \
rocm-opencl \
rocm-opencl-dev \
rocm-cmake \
rocblas \
zlib1g-dev \
kmod && \
apt-get remove -y rocm-cmake && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

Expand All @@ -79,35 +79,34 @@ ENV LANG=C.UTF-8
RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb
RUN dpkg -i dumb-init_*.deb && rm dumb-init_*.deb

# Install cget
RUN pip3 install cget
# Install rbuild
RUN pip3 install https://github.com/RadeonOpenCompute/rbuild/archive/6d78a0553babdaea8d2da5de15cbda7e869594b8.tar.gz

# Add symlink to /opt/rocm
RUN [ -d /opt/rocm ] || ln -sd $(realpath /opt/rocm-*) /opt/rocm

# Make sure /opt/rcom is in the paths
ENV PATH="/opt/rocm:${PATH}"

# Build using hip-clang
RUN cget -p $PREFIX init --cxx /opt/rocm/llvm/bin/clang++ --std=c++14 -DAMDGPU_TARGETS=${GPU_ARCH}

# Add requirements files
ADD rbuild.ini /rbuild.ini
ADD requirements.txt /requirements.txt
ADD dev-requirements.txt /dev-requirements.txt
# Install dependencies
RUN cget -p $PREFIX install pfultz2/rocm-recipes
# Install a newer version of cmake for libMLIRMIOpen
RUN cget -p $PREFIX install kitware/[email protected]

ADD min-requirements.txt /min-requirements.txt
RUN CXXFLAGS='-isystem $PREFIX/include' cget -p $PREFIX install -f /min-requirements.txt
RUN if [ "$USE_FIN" = "ON" ]; then cget -p $PREFIX install nlohmann/json@350ff4f7ced7c4117eae2fb93df02823c8021fcb; fi
RUN cget -p $PREFIX install danmar/cppcheck@dd05839a7e63ef04afd34711cb3e1e0ef742882f
# TODO: Add --std=c++14
RUN if [ "$USE_FIN" = "ON" ]; then \
rbuild prepare -s fin -d $PREFIX -DAMDGPU_TARGETS=${GPU_ARCH}; \
else \
rbuild prepare -s develop -d $PREFIX -DAMDGPU_TARGETS=${GPU_ARCH}; \
fi

# Install doc requirements
ADD doc/requirements.txt /doc-requirements.txt
RUN pip3 install -r /doc-requirements.txt

# Use parallel job to accelerate tensile build
# Workaround for Tensile with TargetID feature
RUN if [ "$USE_TARGETID" = "ON" ] ; then export HIPCC_LINK_FLAGS_APPEND='-O3 -parallel-jobs=4' && export HIPCC_COMPILE_FLAGS_APPEND='-O3 -Wno-format-nonliteral -parallel-jobs=4' && rm /usr/bin/hipcc; fi
RUN if [ "$USE_TARGETID" = "ON" ] ; then export HIPCC_LINK_FLAGS_APPEND='-O3 -parallel-jobs=4' && export HIPCC_COMPILE_FLAGS_APPEND='-O3 -Wno-format-nonliteral -parallel-jobs=4' && rm -f /usr/bin/hipcc; fi

# install last released miopentensile in default (master), install latest commits when MIOTENSILE_VER="latest" (develop)
RUN if [ "$USE_TARGETID" = "OFF" ] ; then echo "MIOpenTensile is not installed."; elif [ "$MIOTENSILE_VER" = "latest" ] ; then cget -p $PREFIX install ROCmSoftwarePlatform/MIOpenTensile@94a9047741d16a8eccd290131b78fb1aa69cdcdf; else cget -p $PREFIX install ROCmSoftwarePlatform/MIOpenTensile@94a9047741d16a8eccd290131b78fb1aa69cdcdf; fi
Expand Down
29 changes: 0 additions & 29 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,6 @@ This prefix can used to specify the dependency path during the configuration pha
MIOpen's HIP backend uses [rocBlas](https://github.com/ROCmSoftwarePlatform/rocBLAS) by default. Users can install rocBlas minimum release by using `apt-get install rocblas`. To disable using rocBlas set the configuration flag `-DMIOPEN_USE_ROCBLAS=Off`. rocBlas is *not* available for the OpenCL backend.


## Installing minimum dependencies in ROCm environment

Users who are working in a fully installed and up to date ROCm environment may not wish to additionally install rocm-cmake, clang-ocl, MIOpenGEMM, MIOpenTensile or rocBLAS. This can be done by simply inserting the command `--minimum` into the cmake command as shown below:

```
cmake -P install_deps.cmake --minimum --prefix /some/local/dir
```

This will build the Boost and half libraries.


## Building MIOpen from source

### Configuring with cmake
Expand Down Expand Up @@ -113,24 +102,6 @@ And an example setting the dependency path for an envirnment in ROCm 3.5 and lat
cmake -DMIOPEN_BACKEND=OpenCL -DMIOPEN_HIP_COMPILER=/opt/rocm/llvm/bin/clang++ -DCMAKE_PREFIX_PATH=/some/local/dir ..
```

For ROCm 3.3 and earlier:
```
cmake -DMIOPEN_BACKEND=OpenCL -DCMAKE_PREFIX_PATH=/some/local/dir ..
```

### For the HIP backend on ROCm 3.3 and earlier, run:

Set the C++ compiler to `hcc`.
```
export CXX=<location-of-hcc-compiler>
cmake -DMIOPEN_BACKEND=HIP -DCMAKE_PREFIX_PATH="<hip-installed-path>;<hcc-installed-path>;<clang-ocl-installed-path>;<miopen-dependency-path>" ..
```

An example cmake step can be:
```
CXX=/opt/rocm/hcc/bin/hcc cmake -DMIOPEN_BACKEND=HIP -DCMAKE_PREFIX_PATH="/opt/rocm/hcc;/opt/rocm/hip;/some/local/dir" ..
```

### For the HIP backend on ROCm 3.5 and later, run:
Set the C++ compiler to `clang++`.
```
Expand Down
4 changes: 2 additions & 2 deletions dev-requirements.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pfultz2/rocm-recipes
ROCm-Developer-Tools/[email protected]
ROCmSoftwarePlatform/rocm-recipes
RadeonOpenCompute/rocm-cmake@cdd0f632b3a65bd4411593bb827eb664e25c80bc --build
-f requirements.txt
# 1.90+
danmar/cppcheck@dd05839a7e63ef04afd34711cb3e1e0ef742882f
6 changes: 1 addition & 5 deletions install_deps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,4 @@ cget(init ${TOOLCHAIN_FLAG} -DCMAKE_INSTALL_RPATH=${PREFIX}/lib ${PARSE_UNPARSED

# Install dependencies
cget(install -U pfultz2/rocm-recipes)
if(PARSE_--minimum)
cget(install -U -f min-requirements.txt)
else()
cget(install -U -f requirements.txt)
endif()
cget(install -U -f requirements.txt)
5 changes: 2 additions & 3 deletions min-requirements.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
sqlite3,https://sqlite.org/2017/sqlite-autoconf-3170000.tar.gz -H sha256:a4e485ad3a16e054765baf6371826b5000beed07e626510896069c0bf013874c -X autotools -DCMAKE_POSITION_INDEPENDENT_CODE=On
[email protected] -DCMAKE_POSITION_INDEPENDENT_CODE=On --build
half,https://github.com/pfultz2/half/archive/1.12.0.tar.gz -X header -H sha256:0a08660b68abb176ebc2a0cdf8de46e3182a7f46c66443bb80dbfaaec98cf969 --build
# This file should be removed in the future
-f requirements.txt
27 changes: 27 additions & 0 deletions rbuild.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[main]
cxx = ${rocm_path}/llvm/bin/clang++
cc = ${rocm_path}/llvm/bin/clang
deps =
ROCmSoftwarePlatform/rocm-recipes
-f requirements.txt

[develop]
cxx = ${rocm_path}/llvm/bin/clang++
cc = ${rocm_path}/llvm/bin/clang
ignore = pcre
deps =
kitware/[email protected]
-f dev-requirements.txt
define =
BUILD_DEV=On

[fin]
cxx = ${rocm_path}/llvm/bin/clang++
cc = ${rocm_path}/llvm/bin/clang
ignore = pcre
deps =
ROCmSoftwarePlatform/rocm-recipes
kitware/[email protected]
-f dev-requirements.txt
nlohmann/json@350ff4f7ced7c4117eae2fb93df02823c8021fcb

9 changes: 3 additions & 6 deletions requirements.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
-f min-requirements.txt
RadeonOpenCompute/rocm-cmake@cdd0f632b3a65bd4411593bb827eb664e25c80bc --build
RadeonOpenCompute/clang-ocl@930015924b012c332d373535ff31a663b6ad2c64
ROCmSoftwarePlatform/MIOpenGEMM@0eb1257cfaef83ea155aabd67af4437c0028db48
ROCmSoftwarePlatform/rocBLAS@9790a8658341bc665c11c311129ad0dfc533d5c4
# ROCmSoftwarePlatform/MIOpenTensile@master
sqlite3,https://sqlite.org/2017/sqlite-autoconf-3170000.tar.gz -H sha256:a4e485ad3a16e054765baf6371826b5000beed07e626510896069c0bf013874c -X autotools -DCMAKE_POSITION_INDEPENDENT_CODE=On
boost@1.72 -DCMAKE_POSITION_INDEPENDENT_CODE=On --build
half,https://github.com/pfultz2/half/archive/1.12.0.tar.gz -X header -H sha256:0a08660b68abb176ebc2a0cdf8de46e3182a7f46c66443bb80dbfaaec98cf969 --build

0 comments on commit 5d26505

Please sign in to comment.