SWDEV-287830 - Remove hardcoding of /opt/rocm path (#2390)
Change-Id: If96739816b56e4cec58f457a91f18411075b2eb4
Dieser Commit ist enthalten in:
@@ -1,7 +1,8 @@
|
||||
# Contributor Guidelines
|
||||
|
||||
## Make Tips
|
||||
When building HIP, you will likely want to build and install to a local user-accessible directory (rather than /opt/rocm).
|
||||
ROCM_PATH is path where ROCM is installed. BY default ROCM_PATH is /opt/rocm.
|
||||
When building HIP, you will likely want to build and install to a local user-accessible directory (rather than <ROCM_PATH>).
|
||||
This can be easily be done by setting the -DCMAKE_INSTALL_PREFIX variable when running cmake. Typical use case is to
|
||||
set CMAKE_INSTALL_PREFIX to your HIP git root, and then ensure HIP_PATH points to this directory. For example
|
||||
|
||||
@@ -31,7 +32,7 @@ In some cases new HIP-Clang features are tied to specified releases, and it can
|
||||
HIP runtime version
|
||||
|
||||
```
|
||||
> cat /opt/rocm/hip/bin/.hipVersion
|
||||
> cat <ROCM_PATH>/hip/bin/.hipVersion
|
||||
# Auto-generated by cmake
|
||||
HIP_VERSION_MAJOR=3
|
||||
HIP_VERSION_MINOR=9
|
||||
@@ -41,11 +42,11 @@ HIP_VERSION_PATCH=20345-519ef3f2
|
||||
HIP-Clang compiler version
|
||||
|
||||
```
|
||||
$ /opt/rocm/llvm/bin/clang -v
|
||||
$ <ROCM_PATH>/llvm/bin/clang -v
|
||||
clang version 11.0.0 (/src/external/llvm-project/clang 075fedd3fd2f4d9d8cca79d0cd51f64c5ef21432)
|
||||
Target: x86_64-unknown-linux-gnu
|
||||
Thread model: posix
|
||||
InstalledDir: /opt/rocm/llvm/bin
|
||||
InstalledDir: <ROCM_PATH>/llvm/bin
|
||||
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
|
||||
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
|
||||
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
|
||||
@@ -73,8 +74,8 @@ For applications and benchmarks outside the directed test environment, developme
|
||||
|
||||
## Environment Variables
|
||||
- **HIP_PATH** : Location of HIP include, src, bin, lib directories.
|
||||
- **HCC_ROCCLR_HOME** : Path to HIP/ROCclr directory, used on AMD platforms. Default /opt/rocm/rocclr.
|
||||
- **HSA_PATH** : Path to HSA include, lib. Default /opt/rocm/hsa.
|
||||
- **HCC_ROCCLR_HOME** : Path to HIP/ROCclr directory, used on AMD platforms. Default <ROCM_PATH>/rocclr.
|
||||
- **HSA_PATH** : Path to HSA include, lib. Default <ROCM_PATH>/hsa.
|
||||
- **CUDA_PATH* : On nvcc system, this points to root of CUDA installation.
|
||||
|
||||
## Contribution guidelines ##
|
||||
|
||||
+14
-14
@@ -21,7 +21,7 @@ HIP can be easily installed using pre-built binary packages using the package ma
|
||||
HIP code can be developed either on AMD ROCm platform using HIP-Clang compiler, or a CUDA platform with nvcc installed.
|
||||
|
||||
## AMD Platform
|
||||
|
||||
ROCM_PATH is path where ROCM is installed. BY default ROCM_PATH is /opt/rocm.
|
||||
```
|
||||
sudo apt install mesa-common-dev
|
||||
sudo apt install clang
|
||||
@@ -38,17 +38,17 @@ HIP-Clang can be built manually:
|
||||
git clone -b amd-stg-open https://github.com/RadeonOpenCompute/llvm-project.git
|
||||
cd llvm-project
|
||||
mkdir -p build && cd build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=1 -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" -DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" ../llvm
|
||||
cmake -DCMAKE_INSTALL_PREFIX=<ROCM_PATH>/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=1 -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" -DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" ../llvm
|
||||
make -j
|
||||
sudo make install
|
||||
```
|
||||
Rocm device library can be manually built as following,
|
||||
```
|
||||
export PATH=/opt/rocm/llvm/bin:$PATH
|
||||
export PATH=<ROCM_PATH>/llvm/bin:$PATH
|
||||
git clone -b amd-stg-open https://github.com/RadeonOpenCompute/ROCm-Device-Libs.git
|
||||
cd ROCm-Device-Libs
|
||||
mkdir -p build && cd build
|
||||
CC=clang CXX=clang++ cmake -DLLVM_DIR=/opt/rocm/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_WERROR=1 -DLLVM_ENABLE_ASSERTIONS=1 -DCMAKE_INSTALL_PREFIX=/opt/rocm ..
|
||||
CC=clang CXX=clang++ cmake -DLLVM_DIR=<ROCM_PATH>/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_WERROR=1 -DLLVM_ENABLE_ASSERTIONS=1 -DCMAKE_INSTALL_PREFIX=<ROCM_PATH> ..
|
||||
make -j
|
||||
sudo make install
|
||||
```
|
||||
@@ -64,8 +64,8 @@ apt-get install hip-runtime-nvidia hip-devel
|
||||
```
|
||||
* Default paths and environment variables:
|
||||
* By default HIP looks for CUDA SDK in /usr/local/cuda (can be overriden by setting CUDA_PATH env variable).
|
||||
* By default HIP is installed into /opt/rocm/hip (can be overridden by setting HIP_PATH environment variable).
|
||||
* Optionally, consider adding /opt/rocm/bin to your path to make it easier to use the tools.
|
||||
* By default HIP is installed into <ROCM_PATH>/hip (can be overridden by setting HIP_PATH environment variable).
|
||||
* Optionally, consider adding <ROCM_PATH>/bin to your path to make it easier to use the tools.
|
||||
|
||||
# Building HIP from source
|
||||
|
||||
@@ -98,21 +98,21 @@ See https://github.com/ROCm-Developer-Tools/hipamd
|
||||
```
|
||||
cd "$HIPAMD_DIR"
|
||||
mkdir -p build; cd build
|
||||
cmake -DHIP_COMMON_DIR=$HIP_DIR -DAMD_OPENCL_PATH=$OPENCL_DIR -DROCCLR_PATH=$ROCCLR_DIR -DCMAKE_PREFIX_PATH="/opt/rocm/" -DCMAKE_INSTALL_PREFIX=$PWD/install ..
|
||||
cmake -DHIP_COMMON_DIR=$HIP_DIR -DAMD_OPENCL_PATH=$OPENCL_DIR -DROCCLR_PATH=$ROCCLR_DIR -DCMAKE_PREFIX_PATH="<ROCM_PATH>/" -DCMAKE_INSTALL_PREFIX=$PWD/install ..
|
||||
make -j$(nproc)
|
||||
sudo make install
|
||||
```
|
||||
|
||||
Note: If you don't specify CMAKE_INSTALL_PREFIX, hip runtime will be installed to "/opt/rocm/hip".
|
||||
Note: If you don't specify CMAKE_INSTALL_PREFIX, hip runtime will be installed to "<ROCM_PATH>/hip".
|
||||
By default, release version of AMDHIP is built.
|
||||
|
||||
## Default paths and environment variables
|
||||
|
||||
* By default HIP looks for HSA in /opt/rocm/hsa (can be overridden by setting HSA_PATH environment variable).
|
||||
* By default HIP is installed into /opt/rocm/hip (can be overridden by setting HIP_PATH environment variable).
|
||||
* By default HIP looks for clang in /opt/rocm/llvm/bin (can be overridden by setting HIP_CLANG_PATH environment variable)
|
||||
* By default HIP looks for device library in /opt/rocm/lib (can be overridden by setting DEVICE_LIB_PATH environment variable).
|
||||
* Optionally, consider adding /opt/rocm/bin to your PATH to make it easier to use the tools.
|
||||
* By default HIP looks for HSA in <ROCM_PATH>/hsa (can be overridden by setting HSA_PATH environment variable).
|
||||
* By default HIP is installed into <ROCM_PATH>/hip (can be overridden by setting HIP_PATH environment variable).
|
||||
* By default HIP looks for clang in <ROCM_PATH>/llvm/bin (can be overridden by setting HIP_CLANG_PATH environment variable)
|
||||
* By default HIP looks for device library in <ROCM_PATH>/lib (can be overridden by setting DEVICE_LIB_PATH environment variable).
|
||||
* Optionally, consider adding <ROCM_PATH>/bin to your PATH to make it easier to use the tools.
|
||||
* Optionally, set HIPCC_VERBOSE=7 to output the command line for compilation.
|
||||
|
||||
After installation, make sure HIP_PATH is pointed to /where/to/install/hip
|
||||
@@ -121,7 +121,7 @@ After installation, make sure HIP_PATH is pointed to /where/to/install/hip
|
||||
|
||||
Run hipconfig (instructions below assume default installation path) :
|
||||
```shell
|
||||
/opt/rocm/bin/hipconfig --full
|
||||
<ROCM_PATH>/bin/hipconfig --full
|
||||
```
|
||||
|
||||
Compile and run the [square sample](https://github.com/ROCm-Developer-Tools/HIP/tree/main/samples/0_Intro/square).
|
||||
|
||||
@@ -87,6 +87,7 @@ endif()
|
||||
find_path(HSA_HEADER hsa/hsa.h
|
||||
PATHS
|
||||
"${_IMPORT_PREFIX}/../include"
|
||||
"${ROCM_PATH}/include"
|
||||
/opt/rocm/include
|
||||
)
|
||||
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren