Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit 0bbe54b

Browse files
committed
document CUDA only install
Document installing from sources for use with NVIDIA CUDA. Adds instructions to INSTALL.md and a link to the README.md.
1 parent d2d2cac commit 0bbe54b

File tree

2 files changed

+92
-7
lines changed

2 files changed

+92
-7
lines changed

INSTALL.md

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
## Prerequisites
1+
## Installation for use with AMD GPUs
2+
This section describes installing for use with AMD GPUs. For use with NVIDIA
3+
GPUs see [here](INSTALL.md#installation-for-use-with-nvidia-gpus).
4+
5+
### Prerequisites
26

37
- Install mesa-common-dev
48
- Either build or install [COMGR](https://github.com/RadeonOpenCompute/ROCm-CompilerSupport), [CLANG](https://github.com/RadeonOpenCompute/llvm-project) and [Device Library](https://github.com/RadeonOpenCompute/ROCm-Device-Libs)
59

6-
## Getting the source code
10+
### Getting the source code
711

812
```bash
913
git clone -b develop https://github.com/ROCm-Developer-Tools/hipamd.git
@@ -12,7 +16,7 @@ git clone -b develop https://github.com/ROCm-Developer-Tools/ROCclr.git
1216
git clone -b develop https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime.git
1317
```
1418

15-
## Set the environment variables
19+
### Set the environment variables
1620

1721
```bash
1822
export HIPAMD_DIR="$(readlink -f hipamd)"
@@ -21,7 +25,7 @@ export ROCclr_DIR="$(readlink -f ROCclr)"
2125
export OPENCL_DIR="$(readlink -f ROCm-OpenCL-Runtime)"
2226
```
2327

24-
## Build HIPAMD
28+
### Build HIPAMD
2529
Commands to build hipamd are as following,
2630

2731
```bash
@@ -36,3 +40,79 @@ Note,
3640
HIP_COMMON_DIR looks for hip common ([HIP](https://github.com/ROCm-Developer-Tools/HIP/)) source codes.
3741
By default, release version of hipamd is built.
3842

43+
44+
45+
46+
## Installation for use with NVIDIA GPUs
47+
48+
This section describes installing for use with NVIDIA GPUs. For use with NVIDIA GPUs see [here](INSTALL.md#installation-for-use-with-amd-gpus).
49+
50+
### Prerequisites
51+
52+
- The NVIDIA CUDA toolkit with the `nvcc` compiler should be installed and in
53+
the `PATH` and `LD_LIBRARY_PATH`
54+
55+
### Installation
56+
57+
One needs both the `hip` and `hipamd` source code repositories. These need to
58+
be made known to `hipamd` during the CMake configure phase. The key CMake variables
59+
are `HIP_PLATFORM=nvidia` and `HIP_COMMON=<path to the clone of hip repo>`.
60+
61+
The following shell script illustrates a minimal CUDA backed HIP install from
62+
sources. The script will clone the sources, configure, and install HIP for use
63+
with CUDA in the current directory. You may want to modify `BUILD_DIR`,
64+
`INSTALL_DIR`, and `BRANCH` to suit your needs. NOTE: This script will only
65+
set you up to use HIP with CUDA.
66+
67+
```bash
68+
#!/bin/bash
69+
70+
set -exuo pipefail
71+
72+
# the directory where to compile and install
73+
BUILD_DIR=`pwd`/hip_nvidia/build
74+
INSTALL_DIR=`pwd`/hip_nvidia/install
75+
76+
# the branch to use. the two HIP source repos should be checked out to the
77+
# same branch.
78+
BRANCH=rocm-4.5.x
79+
80+
# make the directories for the sources, build, and install
81+
mkdir -p ${BUILD_DIR}
82+
mkdir -p ${INSTALL_DIR}
83+
84+
# download the hip sources
85+
cd ${BUILD_DIR}
86+
87+
git clone -b "${BRANCH}" --single-branch \
88+
https://github.com/ROCm-Developer-Tools/hip.git
89+
90+
git clone -b "${BRANCH}" --single-branch \
91+
https://github.com/ROCm-Developer-Tools/hipamd.git
92+
93+
# create the build directory
94+
mkdir -p ${BUILD_DIR}/build_${BRANCH}
95+
cd ${BUILD_DIR}/build_${BRANCH}
96+
97+
# configure, make, make install
98+
cmake \
99+
-DCMAKE_BUILD_TYPE=Release \
100+
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
101+
-DHIP_COMMON_DIR="${BUILD_DIR}/hip" \
102+
-DHIP_PLATFORM=nvidia \
103+
../hipamd
104+
105+
make -j install
106+
107+
```
108+
109+
### Post install and use
110+
111+
In order for tools such as `hipify-perl` and `hipcc` to work, the following
112+
environment variables should be propagated to the runtime environment.
113+
114+
```
115+
export HIP_PATH=${INSTALL_DIR}
116+
export PATH=${HIP_PATH}/bin/:$PATH
117+
export HIP_PLATFORM=nvidia
118+
```

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
## What is this repository for? ###
1+
## What is this repository for?
2+
3+
This repository provides [HIP](https://github.com/ROCm-Developer-Tools/HIP) implementation specifically for AMD and NVIDIA platforms.
4+
5+
## Install
6+
7+
See [INSTALL.md](INSTALL.md)
28

3-
This repository provides [HIP](https://github.com/ROCm-Developer-Tools/HIP) implementation specifically for AMD platform.
49

510
## DISCLAIMER
611

@@ -21,4 +26,4 @@ The hipamd repository maintains several branches. The branches that are of impor
2126
hipamd releases are typically naming convention for each ROCM release to help differentiate them.
2227

2328
* rocm x.yy: These are the stable releases based on the ROCM release.
24-
This type of release is typically made once a month.*
29+
This type of release is typically made once a month.*

0 commit comments

Comments
 (0)