Installing hipCIM#

2025-12-17

4 min read time

Applies to Linux

This topic discusses how to install hipCIM using the following options:

System requirements#

ROCm version

Ubuntu version

Python version

AMD Instinct GPU

6.4.3

22.04

3.10

MI325X

Setting up the environment#

  1. Optional: Use ROCm Docker to get started.

    docker pull rocm/dev-ubuntu-22.04:6.4.3-complete
    docker run --cap-add=SYS_PTRACE --ipc=host --privileged=true   \
          --shm-size=128GB --network=host --device=/dev/kfd     \
          --device=/dev/dri --group-add video -it               \
          -v $HOME:$HOME  --name ${LOGNAME}_rocm                \
                                           rocm/dev-ubuntu-22.04:6.4.3-complete
    

    For bare metal, skip this step.

  2. Install system dependencies.

    sudo apt update
    sudo apt install -y lsb-release software-properties-common libopenslide0 python3.10-venv rocjpeg
    sudo apt install -y rocthrust-dev hipcub hipblas \
                hipblas-dev hipfft hipsparse      \
                hiprand rocsolver rocrand-dev git git-lfs
    pip install --upgrade pip
    
  3. Create the Python virtual environment.

    python3 -m venv hipcim_dev
    source hipcim_dev/bin/activate
    
  4. Set up the environment variables.

    export ROCM_HOME=/opt/rocm
    export AMDGPU_TARGETS=gfx942
    

Building hipCIM from source#

To build hipCIM from source, follow the steps given in this section. hipCIM developers should use this installation method. hipCIM users should use the Installing hipCIM using AMD PyPI.

  1. Install the required system dependencies.

    pip install --upgrade pip
    
  2. Download the latest version of hipCIM from the git repository.

    git clone git@github.com:ROCm-LS/hipCIM.git
    cd hipCIM
    
  3. Install the rest of the dependencies.

    pip install -r ./requirements.txt
    
  4. Build and install hipCIM.

    To build the hipCIM library on a ROCm-based AMD system using the development environment, follow these steps:

    1. Build the base C++ libraries.

    ./run_amd build_local cpp release
    
    1. Build the Python bindings.

    ./run_amd build_local hipcim release
    
    1. Install the Python bindings.

    python3 -m pip install python/cucim --extra-index-url https://pypi.amd.com/simple
    
  5. Verify the installation.

    To verify the installation, follow these steps:

    1. Execute the tests in the base C++ libraries.

    ./run_amd test cpp release
    
    1. Execute the Python tests.

    ./run_amd test_python
    

Getting started#

Here is a sample Python code and its expected output to help you get started.

  • Sample code:

    from cucim import CuImage
    img = CuImage("sample_image/oxford.tif")
    resolutions = img.resolutions
    level_dimensions = resolutions["level_dimensions"]
    level_count = resolutions["level_count"]
    print(resolutions)
    print(level_count)
    print(level_dimensions)
    region = img.read_region([0,0], level_dimensions[level_count - 1], level_count - 1, device="cuda")
    print(region.device)
    
  • Expected output:

    {'level_count': 1, 'level_dimensions': ((601, 81),), 'level_downsamples': (1.0,), 'level_tile_sizes': ((0, 0),)}
    1
    ((601, 81),)
    [Warning] Loading image('sample_image/oxford.tif') with a slow-path. The pixel format of the loaded image would be RGBA (4 channels) instead of RGB!
    cuda