JM

Table of Contents

AMDGPU.jl

AMDGPU.jl is Julia’s interface to AMD GPUs through the ROCm software stack. It follows the same array-programming model as CUDA.jl: transfer data to a device array, use generic Julia operations, and synchronize only when a result or measurement requires it.

Installing AMDGPU.jl

AMDGPU.jl requires a supported AMD GPU and a working ROCm installation. On Linux, rocminfo is a useful first check that ROCm can see the device. Follow the AMDGPU.jl installation guide for the supported operating systems, ROCm versions, and GPU architectures.

Install the Julia package with:

julia
using Pkg
Pkg.add("AMDGPU")

Then confirm that Julia can use the device:

julia
using AMDGPU
AMDGPU.versioninfo()
@show AMDGPU.functional()

Device Arrays

ROCArray is AMDGPU.jl’s device-array type. The following is the AMD-specific spelling for transferring a host array:

julia
using AMDGPU
x = AMDGPU.ROCArray(rand(Float32, 1_000_000))

Most numerical code should not need to mention ROCArray directly. Generic broadcast, map!, similar, and LinearAlgebra operations dispatch to GPU implementations based on the input array types. The portable examples in the CUDA.jl and kernel sections select either CuArray or ROCArray in a hidden setup block, then use this common programming model.

AMDGPU.jl also provides low-level ROCm-specific APIs for cases where a vendor library or feature is required. The custom kernels in this course use KernelAbstractions.jl instead, allowing the same source to compile for both AMD and NVIDIA devices.