ソースを参照

Update HIP notes

Håvard Ose Nordstrand 2 年 前
コミット
bdd52156ad
2 ファイル変更40 行追加38 行削除
  1. 18 23
      hpc/hip.md
  2. 22 15
      hpc/rocm.md

+ 18 - 23
hpc/hip.md

@@ -23,41 +23,36 @@ Compared to OpenCL (which is also supported by both NVIDIA and AMD), it's much m
 - HIP code can be compiled for AMD ROCm using the HIP-Clang compiler or for CUDA using the NVCC compiler.
 - If using both CUDA with an NVIDIA GPU and ROCm with an AMD GPU in the same system, HIP seems to prefer ROCm with the AMD GPU when building application. I found not way of changing the target platform (**TODO**).
 
-## Setup
+## Setup (Debian)
 
-### Linux Installation (Debian)
+### Install for AMD GPUs
 
-#### Common Steps Before
+1. Install ROCm: See [ROCm](../rocm/).
 
-1. Add the ROCm package repo (overlaps with ROCm installation):
-    1. Install requirements: `sudo apt install libnuma-dev wget gnupg2`
-    1. Add public key: `wget -q -O - https://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add -`
-    1. Add repo: `echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/debian/ ubuntu main' | sudo tee /etc/apt/sources.list.d/rocm.list`
-    1. Update cache: `sudo apt update`
-
-#### Steps for NVIDIA Paltforms
+### Install for NVIDIA GPUs
 
 1. Install the CUDA toolkit and the NVIDIA driver: See [CUDA](/config/hpc/cuda/).
+1. Add the ROCm package repo (same as ROCm installation):
+    1. Install requirements: `sudo apt install curl libnuma-dev wget gnupg2`
+    1. Add repo key: `curl -sSf https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor > /usr/share/keyrings/rocm.gpg`
+    1. Add repo: `echo 'deb [signed-by=/usr/share/keyrings/rocm.gpg arch=amd64] https://repo.radeon.com/rocm/apt/debian/ ubuntu main' | sudo tee /etc/apt/sources.list.d/rocm.list`
+    1. Update cache: `apt update`
 1. Install: `sudo apt install hip-nvcc`
+1. Add to PATH: See [ROCm](../rocm/).
 
-#### Steps for AMD Paltforms
-
-1. Install stuff: `sudo apt install mesa-common-dev clang comgr`
-1. Install ROCm: See [ROCm](/config/hpc/rocm/).
-
-#### Common Steps After
+### Post-Install Verification
 
-1. Fix symlinks and PATH:
-    - (NVIDIA platforms only) CUDA symlink (`/usr/local/cuda`): Should already point to the right thing.
-    - (AMD platforms only) ROCm symlink (`/opt/rocm`): `sudo ln -s /opt/rocm-4.2.0 /opt/rocm` (example)
-    - Add to PATH: `echo 'export PATH=$PATH:/opt/rocm/bin:/opt/rocm/rocprofiler/bin:/opt/rocm/opencl/bin' | sudo tee -a /etc/profile.d/rocm.sh`
-1. Verify installation: `/opt/rocm/bin/hipconfig --full`
-1. (Optional) Try to build the square example program: [square (ROCm HIP samples)](https://github.com/ROCm-Developer-Tools/HIP/tree/master/samples/0_Intro/square)
+1. Verify installation: `hipconfig --full`
+1. (Optional) Try to build a HIP sample program:
+    1. `git clone https://github.com/ROCm-Developer-Tools/HIP`
+    1. `cd HIP/samples/0_Intro/square`
+    1. `make`
+    1. `./square.out`
 
 ## Usage and Tools
 
 - Show system info:
-    - Show lots of HIP stuff: `hipconfig --config`
+    - Show HIP details: `hipconfig --full`
     - Show platform (`amd` or `nvidia`): `hipconfig --platform`
 - Convert CUDA program to HIP: `hipify-perl input.cu > output.cpp`
 

+ 22 - 15
hpc/rocm.md

@@ -17,15 +17,13 @@ It uses the runtime API and kernel language HIP, which is compilable for both AM
 
 - [ROCm Documentation (AMD ROCm Docs)](https://rocmdocs.amd.com/)
 - [ROCm Installation (AMD ROCm Docs)](https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html)
+- [ROCm_Installation_Guidev5.0: How To Install ROCm](https://docs.amd.com/bundle/ROCm_Installation_Guidev5.0/page/How_To_Install_ROCm.html)
 
 ## Setup
 
-### Installation (Debian)
+Updated for ROCm 5.0.
 
-#### Notes
-
-- Official installation instructions: [ROCm Installation (AMD ROCm Docs)](https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html)
-- **TODO** `video` and `render` groups required to use it? Using `sudo` as a temporary solution works.
+### Installation (Debian/Ubuntu)
 
 #### Steps
 
@@ -33,17 +31,26 @@ It uses the runtime API and kernel language HIP, which is compilable for both AM
 1. If using Mellanox ConnectX NICs then Mellanox OFED must be installed before ROCm.
 1. Add the ROCm package repo:
     1. Install requirements: `sudo apt install curl libnuma-dev wget gnupg2`
-    1. Add repo key: `curl -sSf https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor > /usr/share/keyrings/rocm.gpg`
-    1. Add repo: `echo 'deb [signed-by=/usr/share/keyrings/rocm.gpg arch=amd64] https://repo.radeon.com/rocm/apt/debian/ ubuntu main' | sudo tee /etc/apt/sources.list.d/rocm.list`
-    1. Update cache: `apt update`
-1. Install: `sudo apt install rocm-dkms`
-1. Fix symlinks and PATH:
-    - ROCm symlink (`/opt/rocm`): `sudo ln -s /opt/rocm-4.2.0 /opt/rocm` (example) (**TODO** Will this automatically point to the right thing?)
-    - Add to PATH: `echo 'export PATH=$PATH:/opt/rocm/bin:/opt/rocm/rocprofiler/bin:/opt/rocm/opencl/bin' | sudo tee -a /etc/profile.d/rocm.sh`
+    1. Add repo key: `curl -sSf https://repo.radeon.com/rocm/rocm.gpg.key | sudo gpg --dearmor --output /usr/share/keyrings/rocm.gpg`
+    1. Add AMDGPU repo: `echo 'deb [signed-by=/usr/share/keyrings/rocm.gpg arch=amd64] https://repo.radeon.com/amdgpu/latest/ubuntu focal main' | sudo tee /etc/apt/sources.list.d/amdgpu.list`
+    1. Add ROCm repo: `echo 'deb [signed-by=/usr/share/keyrings/rocm.gpg arch=amd64] https://repo.radeon.com/rocm/apt/debian/ ubuntu main' | sudo tee /etc/apt/sources.list.d/rocm.list`
+    1. Update cache: `sudo apt update`
+1. Install extras: `sudo apt install mesa-common-dev clang comgr`
+1. Install kernel-mode GPU driver: `sudo apt install amdgpu-dkms`
+1. Install desired ROCm meta-packages: `sudo apt install <meta-packages>`
+    - For basics: `rocm-language-runtime rocm-developer-tools rocm-llvm`
+    - For HIP: `rocm-hip-runtime rocm-hip-libraries rocm-hip-sdk`
+    - For OpenCL: `rocm-opencl-runtime rocm-opencl-sdk`
+    - For OpenMP: `rocm-openmp-sdk`
+    - For ML: `rocm-ml-sdk rocm-ml-libraries`
+    - Note: ROCm depends on `python`, which in Ubuntu installs `python-is-python2`.
+1. Add ROCm to PATH: `echo "export PATH=$PATH:/opt/rocm/bin:/opt/rocm/opencl/bin" | sudo tee -a /etc/profile.d/rocm.sh`
+1. Add yourself to the relevant groups to use ROCm: `sudo usermod -aG video,render <username>`
 1. Reboot.
-1. Verify:
-    - `sudo /opt/rocm/bin/rocminfo` (should show e.g. one agent for the CPU and one for the GPU)
-    - `sudo /opt/rocm/opencl/bin/clinfo`
+1. Verify AMDGPU DKMS install: `sudo dkms status`
+1. Verify ROCm install: `rocminfo`
+    - This should show you AMD GPU as an agent (and also you AMD CPU if you have one).
+1. (Optional) Verify HIP: See [HIP](../HIP/).
 
 ## Usage and Tools