|
| 1 | +<!--- |
| 2 | +Copyright (c) 2023 Advanced Micro Devices, Inc. (AMD) |
| 3 | +
|
| 4 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | +of this software and associated documentation files (the "Software"), to deal |
| 6 | +in the Software without restriction, including without limitation the rights |
| 7 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 8 | +copies of the Software, and to permit persons to whom the Software is |
| 9 | +furnished to do so, subject to the following conditions: |
| 10 | +
|
| 11 | +The above copyright notice and this permission notice shall be included in all |
| 12 | +copies or substantial portions of the Software. |
| 13 | +
|
| 14 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 20 | +SOFTWARE. |
| 21 | +---> |
| 22 | +# AMD ROCm™ Installation |
| 23 | + |
| 24 | +AMD ROCm™ is the first open-source software development platform for HPC/Hyperscale-class GPU computing. AMD ROCm™ brings the UNIX philosophy of choice, minimalism and modular software development to GPU computing. Please see the AMD [Open Software Platform for GPU](https://www.amd.com/en/graphics/servers-solutions-rocm) and [ROCm Informational Portal](https://docs.amd.com/) pages for more information. |
| 25 | + |
| 26 | +Installation of the AMD ROCm™ software package can be challenging without a clear understanding of the pieces involved and the flow of the installation process. This introductory material shows how to install ROCm on a workstation with an AMD GPU card that supports the AMD GFX9 architecture. A follow on blog will discuss installing ROCm in other environments, such as a Docker Container, Linux LXC or a full HPC installation. |
| 27 | + |
| 28 | +The website https://docs.amd.com/ contains links to the Release, Support and API documentation for ROCm. Please refer to the [Installaton Guide](https://docs.amd.com/bundle/ROCm-Installation-Guide-v5.4/page/Introduction_to_ROCm_Installation_Guide_for_Linux.html) and [Hardware / Software Support Guide](https://docs.amd.com/bundle/Hardware_and_Software_Reference_Guide/page/Hardware_and_Software_Support.html) for the software and hardware supported by the V 5.4 release of ROCm. This post will be based on an Ubuntu 20.04 operating system and the AMD MI50 GPU card. The full installation process is documented at [How to Install](https://docs.amd.com/bundle/ROCm-Installation-Guide-v5.4/page/How_to_Install_ROCm.html#_How_to_Install) page. |
| 29 | + |
| 30 | +AMD ROCm™ is a brand name for the ROCm open software platform supporting GPUs using AMD's CDNA, and RDNA GPU architectures. The platform includes drivers and runtimes for libraries and developer tools. |
| 31 | + |
| 32 | + Three installation options will be described in this blog post: |
| 33 | + |
| 34 | + 1. Installation of ROCm using an AMD provided script |
| 35 | + 2. Support for multiple ROCm versions on one system |
| 36 | + 3. Installation of ROCm using Ubuntu's apt-get |
| 37 | + |
| 38 | +## Option 1: |
| 39 | + |
| 40 | +AMD provides an installation script for specific operating system and ROCm versions. The script name and download location can be different for each combination of O/S and ROCm so check the [How to Install page](https://docs.amd.com/bundle/ROCm-Installation-Guide-v5.4/page/How_to_Install_ROCm.html#_How_to_Install) for your specific combination. We are using Ubuntu 20.04 and installing ROCm 5.4 and find that the script is named *amdgpu-install_5.4.50400-1_all*. |
| 41 | + |
| 42 | +```plaintext |
| 43 | +sudo apt-get update |
| 44 | +wget https://repo.radeon.com/amdgpu-install/5.4/ubuntu/focal/amdgpu-install_5.4.50400-1_all.deb |
| 45 | +sudo apt-get install ./amdgpu-install_5.4.50400-1_all.deb |
| 46 | +``` |
| 47 | +Once the amdgpu-install script has been extracted, it can be used to install the kernel code, libraries and developer code. For a typical HPC environment HIP, ROCm and the kernel drivers should be sufficient: |
| 48 | +```plaintext |
| 49 | +sudo amdgpu-install --usecase=hiplibsdk,rocm,dkms |
| 50 | +``` |
| 51 | +Additional libraries can be installed and the list of available use cases can be found using: |
| 52 | +```plaintext |
| 53 | +sudo amdgpu-install --list-usecase |
| 54 | +``` |
| 55 | +The ROCm code installs to /opt/rocm by default. You can verify that ROCm is installed by running |
| 56 | +```plaintext |
| 57 | +/opt/rocm/bin/rocminfo |
| 58 | +``` |
| 59 | +and checking that the card was detected by the software. The supported GPU card will start with "GFX9". |
| 60 | + |
| 61 | +## Option 2: |
| 62 | + |
| 63 | +If ROCm is already installed, an old version can be removed and a new version may be installed. Alternatively, an additional version may be installed while keeping the old version. Installing an additional version creates a multi-version system and care must be used to ensure the proper paths are in the environment variables. For example, the current ```/opt/rocm``` may now be ```/opt/rocm-5.4.0``` or ```/opt/rocm-5.3.2``` depending on the installed ROCm versions. |
| 64 | + |
| 65 | +To remove all old versions use: |
| 66 | +``` |
| 67 | +sudo amdgpu-uninstall --rocmrelease=all |
| 68 | +``` |
| 69 | + |
| 70 | +AMD provides an installation script for specific operating system and ROCm versions. The script name and download location can be different for each combination of O/S and ROCm so check the [How to Install page](https://docs.amd.com/bundle/ROCm-Installation-Guide-v5.4/page/How_to_Install_ROCm.html#_How_to_Install) for your specific combination. We are using Ubuntu 20.04 and installing ROCm 5.4 and find that the script is named *amdgpu-install_5.4.50400-1_all*. |
| 71 | + |
| 72 | +```plaintext |
| 73 | +sudo apt-get update |
| 74 | +wget https://repo.radeon.com/amdgpu-install/5.4/ubuntu/focal/amdgpu-install_5.4.50400-1_all.deb |
| 75 | +sudo apt-get install ./amdgpu-install_5.4.50400-1_all.deb |
| 76 | +``` |
| 77 | +Once the amdgpu-install script has been extracted, it can be used to install the kernel code, libraries and developer code. |
| 78 | +The steps below will install the kernel driver code at level 5.4.0 and the libraries at level 5.4.0, 5.3.2 and 5.2.3. For a typical HPC environment HIP and the ROCm libraries should be sufficient: |
| 79 | +```plaintext |
| 80 | +sudo amdgpu-install --usecase=hiplibsdk,rocm,dkms --rocmrelease=5.4.0 |
| 81 | +sudo amdgpu-install --usecase=hiplibsdk,rocm --rocmrelease=5.3.2 --no-dkms |
| 82 | +sudo amdgpu-install --usecase=hiplibsdk,rocm --rocmrelease=5.2.3 --no-dkms |
| 83 | +``` |
| 84 | +Additional libraries can be installed and the list of available use cases can be found using: |
| 85 | +```plaintext |
| 86 | +sudo amdgpu-install --list-usecase |
| 87 | +``` |
| 88 | +The ROCm code installs to /opt/rocm by default. You can verify that ROCm is installed by running |
| 89 | +```plaintext |
| 90 | +/opt/rocm-5.4.0/bin/rocminfo |
| 91 | +``` |
| 92 | +and checking that the card was detected by the software. The supported GPU card will start with "GFX9". |
| 93 | + |
| 94 | +## Option 3: |
| 95 | + |
| 96 | +While AMD provides an installation script for specific operating system and ROCm versions, the script will ultimately install the software using the O/S standard installation software. In the case of Ubuntu, the script will use *apt-get* to install ROCm. |
| 97 | +The full apt-get process is shown on the [How to Install page](https://docs.amd.com/bundle/ROCm-Installation-Guide-v5.4/page/How_to_Install_ROCm.html#_How_to_Install). The steps below will install ROCm 5.4 with a custom version of the apt-get commands. |
| 98 | + |
| 99 | +Determine the location of the ROCm software to install and HIP and the related ROCm software: |
| 100 | +``` |
| 101 | +export ROCM_REPO_BASEURL="https://repo.radeon.com/rocm/apt/5.4/" |
| 102 | +export ROCM_REPO_COMP="ubuntu" |
| 103 | +export ROCM_REPO_BUILD="main" |
| 104 | +echo "deb [arch=amd64 trusted=yes] ${ROCM_REPO_BASEURL} ${ROCM_REPO_COMP} ${ROCM_REPO_BUILD}" > /etc/apt/sources.list.d/rocm.list |
| 105 | +sudo apt-get update |
| 106 | +DEBIAN_FRONTEND=noninteractive apt-get install -y \ |
| 107 | + libdrm-amdgpu* \ |
| 108 | + initramfs-tools \ |
| 109 | + libtinfo* \ |
| 110 | + initramfs-tools \ |
| 111 | + rocm-llvm \ |
| 112 | + rocm-hip-runtime \ |
| 113 | + rocm-hip-sdk \ |
| 114 | + roctracer-dev |
| 115 | +``` |
| 116 | +To find a list of other parts of ROCm that can also be installed using apt-get try using apt-cache: |
| 117 | +``` |
| 118 | +apt-cache search rocm |
| 119 | +``` |
| 120 | +The ROCm code installs to /opt/rocm by default. You can verify that ROCm is installed by running |
| 121 | +```plaintext |
| 122 | +/opt/rocm/bin/rocminfo |
| 123 | +``` |
| 124 | +and checking that the card was detected by the software. The supported GPU card will start with "GFX9". |
| 125 | + |
| 126 | +Note: It is not recommended to mix the apt-get and amdgpu-install methods. Pick one or the other approach for installing ROCm. |
| 127 | + |
| 128 | +If you have any questions or comments, you can reach out to us on our [mailing list ](mailto:[email protected]) |
0 commit comments