Install ONNX Runtime for Radeon GPUs#

Refer to this section to install ONNX via the PIP installation method.

Overview#

Ensure that the following prerequisite installations are successful before proceeding to install ONNX Runtime for use with ROCm™ on Radeon™ GPUs.

Prerequisites#

  • Radeon Software for Linux (with ROCm) is installed.

  • MIGraphX is installed. This enables ONNX Runtime to build the correct MIGraphX EP.

  • The half library is installed.

    NOTE The half library is installed with MIGraphX. If the half library install is not verified, use the following install command:

    $ sudo apt install half
    
  • If the prerequisite installations are successful, proceed to install ONNX Runtime.

    NOTE Unless adding custom features, use the pre-built Python wheel files provided in the PIP installation method.

Install ONNX Runtime#

Important!

  • Use the provided pre-built Python wheel files from the PIP installation method, unless adding custom features.

  • The wheel file contains the MIGraphX and ROCm Execution Providers (EP). Refer to Install MIGraphX for ONNX RT for more information.

  • Refer to ONNX Runtime Documentation for additional information on ONNX Runtime topics.

  • See ONNX Runtime Tutorials to try out real applications and tutorials on how to get started.

ONNX Runtime install via PIP installation method#

Use the PIP install method to create an ONNX Runtime environment.

To install via PIP,

Enter this command to download and install the ONNX Runtime wheel.

pip3 install https://repo.radeon.com/rocm/manylinux/rocm-rel-6.0.2/onnxruntime_rocm-inference-1.17.0-cp310-cp310-linux_x86_64.whl

Next, verify your ONNX Runtime installation.

Verify ONNX Runtime installation#

Confirm if ONNX Runtime is correctly installed.

$ python3
$ import onnxruntime as ort
  ort.get_available_providers()

Expected result: The following EPs are displayed.

>>> ort.get_available_providers()
['MIGraphXExecutionProvider', 'ROCMExecutionProvider', 'CPUExecutionProvider']

Environment set-up is complete, and the system is ready for use with ONNX Runtime to work with machine learning models, and algorithms.