conda-forge / conda-forge.github.io

The conda-forge website.
https://conda-forge.org
BSD 3-Clause "New" or "Revised" License
120 stars 268 forks source link

Support for HIP/ROCm #1923

Open peastman opened 1 year ago

peastman commented 1 year ago

Your question:

I'm interested in distributing packages that use HIP, AMD's framework for GPU compute. It's basically their equivalent of CUDA. There are a couple of packages on conda-forge related to it (https://anaconda.org/conda-forge/hip, https://anaconda.org/conda-forge/rocm-comgr), but neither one has been updated in several years.

Is there a currently supported way to build packages that use HIP?

If not, are there any plans to add support in the future?

isuruf commented 1 year ago

No plans. PRs are welcome to update those packages.

ex-rzr commented 9 months ago

@isuruf

For the OpenMM-HIP package (https://anaconda.org/streamhpc/openmm-hip) we use this script: build.sh.txt

It is generated using smithy and mostly based on the openmm package, it uses the regular conda-forge container (linux_64: cos7) but there is a difference: it also downloads and installs a few ROCm-related packages:

# Install ROCm if inside conda-forge docker (CI or build-locally.py)
if [[ ! -z "$CONFIG" ]]; then
    # EPEL repository is required for perl-File-BaseDir and perl-URI-Encode
    sudo yum -y install epel-release
    sudo yum -y repolist
    # Install all required ROCm packages
    sudo yum -y install https://repo.radeon.com/amdgpu-install/5.4.2/rhel/7.9/amdgpu-install-5.4.50402-1.el7.noarch.rpm
    sudo yum -y install rocm-device-libs hip-devel hip-runtime-amd rocfft-devel hipfft-devel
fi

I don't know exactly how much data it needs to download, likely about 2GB.

It works well when I build the package locally (conda smithy rerender --feedstock_directory . && python3 build-locally.py).

Is this way appropriate to be used with the conda-forge infrastructure? I don't like that it requires to download so much additional packages but I can't find a way how to work it around.

isuruf commented 9 months ago

Is this way appropriate to be used with the conda-forge infrastructure?

No, we prefer to build all the dependencies as conda packages.

peastman commented 9 months ago

Would it be possible to have ROCm components preinstalled in the image, the same way that's been done for CUDA?

isuruf commented 9 months ago

CUDA was done that way because it is proprietary software and we couldn't re-distribute it. However, we are distributing the CUDA compilers since CUDA 12 with permission from NVIDIA and once we drop CUDA 11, we will not preinstall CUDA at all.

ROCM is not proprietary and we already have really old version of ROCM packaged. So, it's not impossible. We definitely don't want to preinstall them when it's possible to package ROCM.

zklaus commented 2 months ago

There is renewed effort on getting ROCm into conda-forge. The involved feedstocks are shown below. Currently we are updating to the latest ROCm 6.1.0 and will move on to some basic libraries hopefully soon.

%%{init: {'securityLevel': 'loose'}}%%
flowchart TD
  subgraph hip-feedstock["hip-feedstock (6.0.2)"]
  hip-runtime-amd
  hip-devel --> hip-runtime-amd
  hipcc --> hip-devel
  rocm-opencl
  rocm-opencl-runtime --> rocm-opencl
  end
  hip-feedstock --> rocminfo & rocr-runtime & rocm-comgr & rocm-cmake
  rocm-cmake["rocm-cmake (6.1.2)"]
  rocminfo["rocminfo (6.1.0)"] --> rocr-runtime
  rocm-comgr["rocm-comgr (6.0.2)"] --> rocm-device-libs & rocm-cmake
  rocr-runtime["rocr-runtime (6.1.0)"] --> roct-thunk-interface & rocm-device-libs
  rocm-device-libs["rocm-device-libs (6.1.0)"] --> rocm-cmake
  roct-thunk-interface["roct-thunk-interface (6.1.2)"]

  click hip-runtime-amd "https://github.com/conda-forge/hip-feedstock" "hip-feedstock"
  click hip-devel "https://github.com/conda-forge/hip-feedstock" "hip-feedstock"
  click hipcc "https://github.com/conda-forge/hip-feedstock" "hip-feedstock"
  click rocm-opencl "https://github.com/conda-forge/hip-feedstock" "hip-feedstock"
  click rocm-opencl-runtime "https://github.com/conda-forge/hip-feedstock" "hip-feedstock"
  click rocminfo "https://github.com/conda-forge/rocminfo-feedstock" "rocminfo-feedstock"
  click rocr-runtime "https://github.com/conda-forge/rocr-runtime-feedstock" "rocr-runtime-feedstock"
  click rocm-comgr "https://github.com/conda-forge/rocm-comgr-feedstock" "rocm-comgr-feedstock"
  click roct-thunk-interface "https://github.com/conda-forge/roct-thunk-interface-feedstock" "roct-thunk-interface-feedstock"
  click rocm-device-libs "https://github.com/conda-forge/rocm-device-libs-feedstock" "rocm-device-libs-feedstock"
  click rocm-cmake "https://github.com/conda-forge/rocm-cmake-feedstock" "rocm-cmake-feedstock"