27 KiB
page-title, url, date
| page-title | url | date |
|---|---|---|
| How to Install ROCm | https://docs.amd.com/bundle/ROCm-Installation-Guide-v5.4.3/page/How_to_Install_ROCm.html | 2023-04-23 18:20:24 |
How to Install ROCm
You may use the following installation methods to install ROCm:
• Installer script method
• Package manager method
Installer Script Method
The installer script method automates the installation process for the AMDGPU and ROCm stack. The installer script handles the complete installation process for ROCm, including setting up the repository, cleaning the system, updating, and installing the desired drivers and meta-packages. With this approach, the system has more control over the ROCm installation process. Thus, those who are less familiar with the Linux standard commands can choose this method for ROCm installation.
For AMDGPU and ROCm installation using the installer script method on Linux distribution, follow these steps:
1. Meet p****rerequisites – Ensure the Prerequisites are met before downloading and installing the installer using the installer script method.
2. Download and i****nstall the i****nstaller – Ensure you download and install the installer script from the recommended URL.
NOTE:
The installer package is updated periodically to resolve known issues and add new features. The links for each Linux distribution always point to the latest available build.
3. Us****e the i****nstaller s****cript on Linux d****istributions – Ensure you execute the script for installing use cases.
Download and Install the Installer
To download the amdgpu-install script on the system, use the following commands.
Downloading and Installing the Installer Script on Ubuntu
Ubuntu v****20.04
To download and install the installer, use the following commands:
Ubuntu v22**.04**
To download and install the installer, use the following commands:
Downloading and Installing the Installer Script on RHEL
RHEL v8.6
To download and install the installer for RHEL v8.6 distribution, type the following command:
RHEL **v****8.**7
To download and install the installer for RHEL v8.7 distribution, type the following command:
**RHEL v****9.**1
To download and install the installer for RHEL v9.1 distribution, type the following command:
Downloading and Installing the Installer Script on SLES 15
To download and install the installer on SLES, type the following command:
SLES 15 Service Pack 4
Using the Installer Script for Single-version ROCm Installation
To install use cases specific to your requirements, use the installer amdgpu-install as follows:
• To install a single use case:
• To install kernel-mode driver:
• To install multiple use cases:
• To display a list of available use cases:
NOTE:
The list in this section represents only a sample of available use cases for ROCm:
Following is a sample of output listed by the command above:
NOTE:
Adding -y as a parameter to amdgpu-install skips user prompts (for automation). Example:
amdgpu-install -y --usecase=rocm
Using Installer Script in Docker
When the installation is initiated in Docker, the installer tries to install the use case along with the kernel-mode driver. However, you cannot install the kernel-mode driver in a Docker container. To skip the installation of the kernel-mode driver, proceed with the --no-dkms option, as shown below:
Using the Installer Script for Multiversion ROCm Installation
The multiversion ROCm installation requires you to download and install the latest ROCm release installer from the list of ROCm releases you want to install simultaneously on your system.
Example: If you want to install ROCm releases 4.5.0, 4.5.1, and 5.4.3 simultaneously, you are required to download the installer from the latest ROCm release v5.4.3.
To download and install the installer, refer to the Download and Install the Installer section.
NOTE:
If the existing ROCm release contains non-versioned ROCm packages, uninstall those packages before proceeding with the multiversion installation to avoid conflicts.
Add Required ROCm Repositories
Add the required repositories using the following steps:
NOTE:
Add the AMDGPU and ROCm repositories manually for all ROCm releases you want to install except the latest one. The amdgpu-install script automatically adds the required repositories for the latest release.
Adding ROCm Repositories on Ubuntu
Add the ROCm repositories for the releases you want to install by choosing <Release-1 specific rocm baseurl> and <Release-2 specific rocm baseurl> from the given Base URLs for AMDGPU and ROCm Stack Repositories:
Ubuntu v20.04
Ubuntu v22.04
Adding ROCm Repositories on RHEL
To add the desired ROCm repositories, follow these steps:
1. Create a /etc/yum.repos.d/rocm.repo file with the following content:
2. To clean the cached files from enabled repositories, execute the command below:
Adding ROCm Repositories on SLES/OpenSUSE
To add new ROCm repositories for the releases you want to install, follow these steps.
1. Create a /etc/zypp/repos.d/amdgpu.repo file with the following content:
2. To update the added repositories, use the following command:
Use the Installer to Install Multiversion ROCm Meta-packages
Use the installer script as given below:
NOTE:
If the kernel-mode driver is already present on the system and you do not want to upgrade it, use the --no-dkms option to skip the installation of the kernel-mode driver, as shown in the following samples:
• sudo amdgpu-install --usecase=rocm --rocmrelease=4.5.0 --no-dkms
• sudo amdgpu-install --usecase=rocm --rocmrelease=5.4.3 --no-dkms
Following are examples of ROCm multiversion installation. The kernel-mode driver, associated with the ROCm release v5.4.3, will be installed as its latest release in the list.
• sudo amdgpu-install --usecase=rocm --rocmrelease=4.5.0
• sudo amdgpu-install --usecase=rocm --rocmrelease=4.5.2
• sudo amdgpu-install --usecase=rocm --rocmrelease=5.4.3
Package Manager Method
The package manager method involves a manual setup of the repository, which includes setting up the repository, updating, and installing/uninstalling meta-packages. This involves using standard commands such as yum, apt, and others respective to the Linux distribution.
The functions of a package manager installation system are:
• Grouping packages based on function
• Extracting package archives
• Ensuring a package is installed with all necessary packages and dependencies are managed
• From a remote repository, looking up, downloading, installing, or updating existing packages
• Ensuring the authenticity and integrity of the package
Installing ROCm on Linux Distributions
For a fresh ROCm installation using the package manager method on a Linux distribution, follow the steps below:
1. Meet p****rerequisites – Ensure the Prerequisites are met before the ROCm installation.
2. Install kernel headers and development packages – Ensure kernel headers and development packages are installed on the system.
3. Select the base URLs for AMDGPU and ROCm stack repository – Ensure the base URLs for AMDGPU and ROCm stack repositories are selected.
4. Add the AMDGPU s****tack repository – Ensure the AMDGPU stack repository is added.
5. Install the k****ernel-mode driver and reboot the system – Ensure the kernel-mode driver is installed and the system is rebooted.
6. Add ROCm stack repository – Ensure the ROCm stack repository is added.
7. Install single-version or multiversion ROCm meta-packages – Install the desired meta-packages.
8. Verify installation for the applicable distributions – Verify if the installation is successful.
NOTE:
You cannot install a kernel-mode driver in a Docker container. Refer to the sections below for specific commands to install the AMDGPU and ROCm stack on various Linux distributions.
Understanding the Release-specific AMDGPU and ROCm Stack Repositories on Linux Distributions
The release-specific repositories consist of packages from a specific release of the AMDGPU stack and ROCm stack. The repositories are not updated for the latest packages with subsequent releases. When a new ROCm release is available, the new repository, specific to that release, is added. You can select a specific release to install, update the previously installed single version to the later available release, or add the latest version of ROCm along with the currently installed version by using the multiversion ROCm packages.
NOTE:
Users installing multiple versions of the ROCm stack must use the release-specific base URL.
Using Package Manager on Ubuntu
To install ROCm on the Ubuntu systems, follow these steps.
Installation of Kernel Headers and Development Packages on Ubuntu
The following instructions to install kernel headers and development packages apply to all versions and kernels of Ubuntu. The ROCm installation requires you to install the Linux-headers and Linux-modules-extra package with the correct version corresponding to the kernel's version.
Example: If the system is running the Linux kernel version 5.15.0-41-generic, you must install the identical versions of Linux-headers and development packages. Refer to the Kernel Information section to check the system's kernel version.
To check the kernel-headers and linux-modules-extra package versions, follow these steps:
1. For the Ubuntu/Debian environment, execute the following command to verify the kernel headers and development packages are installed with the respective versions:
The command indicates if there are Linux headers installed as shown below:
2. Execute the following command to check whether the development packages are installed:
The command mentioned above lists the installed linux-modules-extra packages like the output below:
3. If the supported version installation of Linux headers and development packages are not installed on the system, execute the following command to install the packages:
Base URLs for AMDGPU and ROCm Stack Repositories
The following URLs point to the release-specific AMDGPU and ROCm repositories:
Ubuntu v20.04/22.04
amdgpu base URL= https://repo.radeon.com/amdgpu/5.4.3/ubuntu
rocm base URL= https://repo.radeon.com/rocm/apt/5.4.3
Adding the AMDGPU Stack Repository
Add GPG Key for AMDGPU and ROCm Stack
Add the gpg key for AMDGPU and ROCm repositories. For Debian-based systems like Ubuntu, configure the Debian ROCm repository as follows:
NOTE:
The gpg key may change; ensure it is updated when installing a new release. If the key signature verification fails while updating, re-add the key from the ROCm to the apt repository as mentioned above. The current rocm.gpg.key is not available in a standard key ring distribution but has the following sha1sum hash:
Add the AMDGPU Stack Repository
If:
Then:
You have a version of the kernel-mode driver installed
Skip this section.
You do not have a version of the kernel-mode driver installed
Follow the commands below to add the AMDGPU stack repository.
Ubuntu v****20.04
Ubuntu v22.04
To update the package list, execute the command below:
Install the Kernel-mode Driver and Reboot System
If:
Then:
You have the kernel-mode driver installed on your system
Skip this section.
You do not have the kernel-mode driver on your system
Follow the instructions below.
1. Install the kernel-mode driver.
2. Reboot the system.
Add ROCm Stack Repository
To add the ROCm repository, use the following steps:
Ubuntu v20.04
Ubuntu v22.04
Install ROCm Meta-packages
This section provides the instructions for single-version and multiversion ROCm packages installation.
Single-version ROCm Packages Installation
Install ROCm meta-packages. Specify the name of the meta-package you want to install as , as shown below:
E****xample:
• sudo apt install rocm-hip-sdk
• sudo apt install rocm-hip-sdk rocm-opencl-sdk
ROCm Packages Installation
To install multiversion ROCm packages, execute the following steps:
NOTE:
If the existing ROCm release contains non-versioned ROCm packages, you must uninstall those packages before proceeding to the multiversion installation to avoid conflicts.
Adding N****ew ROCm Repositories
Add the ROCm repository using the following steps. Choose <Release-1 specific rocm baseurl> and <Release-2 specific rocm baseurl> from the given Base URLs for AMDGPU and ROCm Stack Repositories:
Ubuntu v20.04
Ubuntu v22.04
NOTE:
You must repeat the step above to add the repository for each release you want to install.
Installing Multiversion ROCm Package
Install the desired packages using the command below:
Example:
• sudo apt install rocm-hip-sdk4.5.0 rocm-hip-sdk5.4.3
Verify the Installation
To verify if the installation is successful, refer to the Post-install Actions and Verification Process section.
Using Package Manager on RHEL
To install ROCm on RHEL systems, follow these steps.
Installation of Kernel Headers and Development Packages on RHEL
The ROCm installation requires that you install the kernel headers and linux-modules-extra package with the correct version corresponding to the kernel's version.
Example: If the system is running Linux kernel version 3.10.0-1160.el7.x86_64, you must install the identical versions of kernel headers and development packages.
NOTE:
To check the kernel version on your system, refer to the Kernel Information section.
To check the kernel headers and linux-modules-extra package versions, follow these steps:
1. To verify you have the supported version of the installed kernel headers, type the following on the command line:
The command mentioned above displays the list of kernel headers versions currently present on your system. Verify if the listed kernel headers have the same versions as the kernel.
2. The following command lists the development packages on your system. Verify if the listed development package's version number matches the kernel version number:
3. If the supported version installation of kernel headers and development packages does not exist on the system, execute the command below to install:
Base URLs for AMDGPU and ROCm Stack Repositories
The following URLs point to the release-specific AMDGPU and ROCm repositories:
RHEL v8.6
amdgpu base URL= https://repo.radeon.com/amdgpu/5.4.3/rhel/8.6/main/x86_64/
rocm base URL= https://repo.radeon.com/rocm/rhel8/5.4.3/main/
RHEL v8.7
amdgpu base URL= https://repo.radeon.com/amdgpu/5.4.3/rhel/8.7/main/x86_64
rocm base URL= https://repo.radeon.com/rocm/rhel8/5.4.3/main/
RHEL v9.1
amdgpu base URL= https://repo.radeon.com/amdgpu/5.4.3/rhel/9.1/main/x86_64
rocm base URL= https://repo.radeon.com/rocm/rhel9/5.4.3/main/
Adding the AMDGPU Stack Repository
If:
Then:
You have a kernel-model driver installed
Skip this section.
You do not have a version of the kernel-mode driver installed
Follow the commands below to add the AMDGPU stack repository.
To add the AMDGPU stack repository, follow these steps:
1. Create a /etc/yum.repos.d/amdgpu.repo file with the following content. For <amdgpu baseurl> in the command below, refer to the AMDGPU base URLs as documented in the Base URLs for AMDGPU and ROCm Stack Repositories:
NOTE:
The gpg key may change; ensure it is updated when installing a new release. If the key signature verification fails while updating, re-add the key from the ROCm to the yum repository as mentioned above. The current rocm.gpg.key is not available in a standard key ring distribution but has the following sha1sum hash:
2. To clean the cached files from enabled repositories, execute the command below:
Install the Kernel-mode Driver and Reboot System
If:
Then:
The kernel-mode driver is installed on your system
Skip this section.
You do not have a version of the kernel-mode driver installed
Follow the command below to install the kernel-mode driver.
After the completion of driver installation, reboot the system:
Add the ROCm Stack Repository
To add the ROCm stack repository, execute these steps:
1. Create a /etc/yum.repos.d/rocm.repo file with the following content.
For <rocm baseurl> in the command below, refer to the ROCm base URLs documented in Base URLs for AMDGPU and ROCm Stack Repositories:
NOTE:
The gpg key may change; ensure it is updated when installing a new release. If the key signature verification fails while updating, re-add the key from the ROCm yum repository as mentioned above. The current rocm.gpg.key is not available in a standard key ring distribution but has the following sha1sum hash:
2. To clean the cached files from enabled repositories, execute the command below:
Install ROCm Meta-packages
You can install either single-version or multiversion ROCm meta-packages using the following commands.
ROCm Packages Installation
Use the following command to install the ROCm packages:
Specify the meta-package name as , which you want to install, in the command given above.
Example:
• sudo yum install rocm-hip-sdk
• sudo yum install rocm-hip-sdk rocm-opencl-sdk
ROCm Meta-packages Installation
To install multiversion ROCm packages, execute the following steps.
NOTE:
If the existing ROCm release contains non-versioned ROCm packages, uninstall those packages before proceeding to the multiversion installation to avoid conflicts.
Adding N****ew ROCm R****epositories
To add the ROCm stack repositories, follow these steps:
1. Create a /etc/yum.repos.d/rocm.repo file with the following content:
NOTE:
You must repeat the step above to add the repository for each release you want to install.
2. To clean the cached files from enabled repositories, execute the command below:
Installing Multiversion ROCm Meta-package
To install the required meta-packages, use the following commands:
E****xample:
• sudo yum install rocm-hip-sdk4.5.0 rocm-hip-sdk5.4.3
Verify the Installation
To verify if the installation is successful, refer to the Post-install Actions and Verification Process section.
Using Package Manager on SLES/OpenSUSE
This section introduces the ROCm installation process on SLES/OpenSUSE.
Installation of Kernel Headers and Development Packages
ROCm installation requires you to install linux-headers and linux-modules-extra package with the correct version corresponding to the kernel's version.
Example: If the system is running the Linux kernel version 5.3.18-57_11.0.18, you must install the same versions of linux-headers and development packages.
NOTE:
To check the kernel version on your system, refer to the Kernel Information section.
To check the kernel-headers and linux-modules-extra package versions, follow these steps:
1. Ensure that the correct version of the latest kernel-default-devel and kernel-default packages are installed. The following command lists the installed kernel-default-devel and kernel-default package:
NOTE:
This next step is only required if you find from the above command that the kernel-default-devel and kernel-default versions of the package, corresponding to the kernel release version, do not exist on your system.
2. If the required version of packages does not exist on the system, install with the command below:
Base URLs for AMDGPU and ROCm Stack Repositories
The following URLs point to the release-specific AMDGPU and ROCm repositories:
SLES 15 Service Pack 4
amdgpu base URL= https://repo.radeon.com/amdgpu/5.4.3/sle/15.4/main/x86_64
rocm base URL= https://repo.radeon.com/rocm/zyp/5.4.3/main/
Adding the AMDGPU Stack Repository
If:
Then:
You have a version of the kernel-mode driver installed
Skip this section.
You do not have a version of the kernel-mode driver installed
Follow the commands below to add the AMDGPU stack repository.
To add the AMDGPU stack repository, follow these steps:
1. Create a /etc/zypp/repos.d/amdgpu.repo file with the following content:
NOTE:
The gpg key may change; ensure it is updated when installing a new release. If the key signature verification fails while updating, re-add the key from the ROCm zypp repository as mentioned above. The current rocm.gpg.key is not available in a standard key ring distribution but has the following sha1sum hash:
2. To update the added repository, use the following command:
Install the Kernel-mode Driver and Reboot System
If:
Then:
You already have a version of the kernel-mode driver installed
Skip this section.
You do not have a version of the kernel-mode driver installed
Follow the commands below to install and reboot the system.
Add the ROCm Stack Repository
Add the ROCm repository by executing the following commands:
1. Create a /etc/zypp/repos.d/rocm.repo file with the following content:
NOTE:
The gpg key may change. Ensure it is updated when installing a new release. If the key signature verification fails while updating, re-add the key from the ROCm zypp repository as mentioned above. The current rocm.gpg.key is not available in a standard key ring distribution but has the following sha1sum hash:
2. To update the added repository, use the following command:
Install ROCm Meta-packages
Single-version ROCm Packages Installation
For single-version ROCm packages installation, follow these steps:
1. Install the ROCm package by typing the command below:
2. Specify the name of the meta-package as , which you want to install, in the command given above.
Example:
• sudo zypper --gpg-auto-import-keys install rocm-hip-sdk
• sudo zypper --gpg-auto-import-keys install rocm-hip-sdk rocm-opencl-sdk
ROCm Packages Installation
To install multiversion ROCm packages, execute the following steps.
NOTE:
If the existing ROCm release contains non-versioned ROCm packages, uninstall those packages before proceeding to the multiversion installation to avoid conflicts.
Adding N****ew ROCm Repositories
To add the ROCm stack repositories, follow these steps.
1. Add new ROCm repositories for the release you want to install simultaneously. Create a /etc/zypp/repos.d/rocm.repo file with the following content:
Select the <Release-1 specific rocm baseurl> and <Release-2 specific rocm baseurl> from Base URLs for AMDGPU and ROCm Stack Repositories:
NOTE:
You must repeat the step above to add the repository for each release you want to install.
2. To update the added repositories, use the following command:
Installing Multiversion ROCm P****ackage
Install ROCm meta-packages using the command below:
E****xample:
• sudo zypper --gpg-auto-import-keys install rocm-hip-sdk4.5.0 rocm-hip-sdk5.4.3
Verify the Installation
To verify if the installation is successful, refer to the Post-install Actions and Verification Process section.
Post-install Actions and Verification Process
Execute post-install actions and verify ROCm installation using the following steps.
Post-install Actions
You might set LD_LIBRARY_PATH to load the desired ROCm library version:
NOTE:
For convenience, you may also add the ROCm binaries in your PATH, as shown in the example below:
Verifying Kernel-mode Driver Installation
Check the installation of the kernel-mode driver by typing the command given below:
Verifying ROCm Installation
After completing the ROCm installation, execute the following commands on the system to verify if the installation is successful. If you see your GPUs listed by both commands, the installation is considered successful:
Verifying Package Installation
To ensure the packages are installed successfully, use the following commands:
Table 4**.** Commands to V****erify I****nstalled P****ackages
Linux Distro
Command
Ubuntu/Debian
sudo apt list --installed
RHEL
sudo yum list installed
SLES /OpenSUSE
sudo zypper search --installed-only