Skip to content

Commit

Permalink
CUDA 11 and CUDA 12 tags for Docker image and cuQuantum version update (
Browse files Browse the repository at this point in the history
#2333)

Signed-off-by: Bettina Heim <[email protected]>
  • Loading branch information
bettinaheim authored Oct 31, 2024
1 parent da81ca6 commit c5f09eb
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 30 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/deployments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ jobs:
strategy:
matrix:
platform: ${{ fromJson(needs.metadata.outputs.multi_platform || needs.metadata.outputs.platforms).ids }}
cuda_version: ["11.8", "12.0"]
fail-fast: false
uses: ./.github/workflows/dev_environment.yml
secrets:
Expand All @@ -272,11 +273,14 @@ jobs:
with:
platforms: ${{ fromJson(needs.metadata.outputs.multi_platform || needs.metadata.outputs.platforms)[format('{0}', matrix.platform)].docker_flag }}
dockerfile: build/devdeps.ompi.Dockerfile
build_config_id: cu${{ matrix.cuda_version }}
build_args: |
cuda_version=${{ matrix.cuda_version }}
registry_cache_from: ${{ needs.metadata.outputs.cache_base }}
update_registry_cache: ${{ needs.metadata.outputs.cache_target }}
environment: ${{ needs.metadata.outputs.environment }}
# needed only for the cloudposse GitHub action
matrix_key: ${{ matrix.platform }}-ompi
matrix_key: ${{ matrix.platform }}-cu${{ matrix.cuda_version }}-ompi

dispatch:
name: Dispatch deployments
Expand Down Expand Up @@ -327,6 +331,7 @@ jobs:
strategy:
matrix:
platform: ${{ fromJson(needs.metadata.outputs.multi_platform || needs.metadata.outputs.platforms).ids }}
cuda_version: ["11.8", "12.0"]
fail-fast: false
uses: ./.github/workflows/dev_environment.yml
secrets:
Expand All @@ -335,15 +340,17 @@ jobs:
with:
platforms: ${{ fromJson(needs.metadata.outputs.multi_platform || needs.metadata.outputs.platforms)[format('{0}', matrix.platform)].docker_flag }}
dockerfile: build/devdeps.ext.Dockerfile
build_config_id: ${{ needs.config.outputs.devdeps_toolchain }}
build_config_id: cu${{ matrix.cuda_version }}-${{ needs.config.outputs.devdeps_toolchain }}
build_args: |
cuda_version=${{ matrix.cuda_version }}
base_image=${{ fromJson(needs.config.outputs.json).image_hash[format('{0}-{1}', matrix.platform, needs.config.outputs.devdeps_toolchain)] }}
ompidev_image=${{ fromJson(needs.config.outputs.json).image_hash[format('{0}-ompi', matrix.platform)] }}
ompidev_image=${{ fromJson(needs.config.outputs.json).image_hash[format('{0}-cu{1}-ompi', matrix.platform, matrix.cuda_version)] }}
${{ matrix.cuda_version != '11.8' && 'cuda_packages=cuda-cudart cuda-compiler libcublas-dev libcusolver libnvjitlink' || '' }}
registry_cache_from: ${{ needs.metadata.outputs.cache_base }}
update_registry_cache: ${{ needs.metadata.outputs.cache_target }}
environment: ${{ needs.metadata.outputs.environment }}
# needed only for the cloudposse GitHub action
matrix_key: ${{ matrix.platform }}-ext
matrix_key: ${{ matrix.platform }}-cu${{ matrix.cuda_version }}-ext

# This job is needed only when using the cloudposse GitHub action to read
# the output of a matrix job. This is a workaround due to current GitHub
Expand All @@ -369,6 +376,7 @@ jobs:
strategy:
matrix:
platform: ${{ fromJson(needs.metadata.outputs.multi_platform || needs.metadata.outputs.platforms).ids }}
cuda_version: ["11.8", "12.0"]
fail-fast: false
uses: ./.github/workflows/docker_images.yml
secrets:
Expand All @@ -377,9 +385,10 @@ jobs:
DOCKERHUB_READONLY_TOKEN: ${{ secrets.DOCKERHUB_READONLY_TOKEN }}
with:
platforms: ${{ fromJson(needs.metadata.outputs.multi_platform || needs.metadata.outputs.platforms)[format('{0}', matrix.platform)].docker_flag }}
ompidev_image: ${{ fromJson(needs.config.outputs.json).image_hash[format('{0}-ompi', matrix.platform)] }}
devdeps_image: ${{ fromJson(needs.ext_config.outputs.json).image_hash[format('{0}-ext', matrix.platform)] }}
build_docs: true
cuda_version: ${{ matrix.cuda_version }}
ompidev_image: ${{ fromJson(needs.config.outputs.json).image_hash[format('{0}-cu{1}-ompi', matrix.platform, matrix.cuda_version)] }}
devdeps_image: ${{ fromJson(needs.ext_config.outputs.json).image_hash[format('{0}-cu{1}-ext', matrix.platform, matrix.cuda_version)] }}
build_docs: ${{ matrix.cuda_version == '11.8' }}
environment: ghcr-deployment

python_wheels:
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ on:
build_docs:
required: false
type: string
cuda_version:
required: false
type: string
description: The CUDA version with which the development dependencies were built.
environment:
required: false
type: string
Expand Down Expand Up @@ -165,8 +169,8 @@ jobs:
file: ./docker/build/devdeps.ext.Dockerfile
build-args: |
ompidev_image=${{ inputs.ompidev_image }}
base_image=nvidia/cuda:11.8.0-runtime-ubuntu22.04
cuda_root=/usr/local/cuda-11.8
base_image=nvidia/cuda:${{ inputs.cuda_version }}.0-runtime-ubuntu22.04
cuda_version=${{ inputs.cuda_version }}
cuda_packages=
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
Expand Down Expand Up @@ -470,7 +474,8 @@ jobs:
image_description="CUDA Quantum toolkit for heterogeneous quantum-classical workflows"
platform_tag=${{ needs.metadata.outputs.platform_tag }}
image_tag=${platform_tag:+$platform_tag-}
cuda_major=`echo ${{ inputs.cuda_version }} | cut -d . -f1`
image_tag=${platform_tag:+$platform_tag-}${cuda_major:+cu${cuda_major}-}
if ${{ github.event.pull_request.number != '' }} || [ -n "$(echo ${{ github.ref_name }} | grep pull-request/)" ]; then
pr_number=`echo ${{ github.ref_name }} | grep -o [0-9]*`
image_tag+=pr-${pr_number:-${{ github.event.pull_request.number }}}
Expand Down Expand Up @@ -841,7 +846,8 @@ jobs:
run: |
cudaqdev_hash=${{ needs.cudaqdev_image.outputs.image_hash }}
cudaq_hash=${{ needs.cudaq_image.outputs.image_hash }}
artifact_name=image_publishing # changing the artifact name requires updating other workflows
cuda_major=`echo ${{ inputs.cuda_version }} | cut -d . -f1`
artifact_name=image_${cuda_major:+cu${cuda_major}_}publishing # changing the artifact name requires updating other workflows
echo "artifact_name=$artifact_name" >> $GITHUB_OUTPUT
info_file="$artifact_name.txt"
echo "info_file=$info_file" >> $GITHUB_OUTPUT
Expand All @@ -852,6 +858,7 @@ jobs:
echo "cuda-quantum-dev-image: $cudaqdev_hash" >> "$info_file"
echo "cuda-quantum-devdeps-image: ${{ inputs.devdeps_image }}" >> "$info_file"
echo "platforms: ${{ inputs.platforms }}" >> "$info_file"
echo "cuda-version: ${{ inputs.cuda_version }}" >> "$info_file"
cat .github/workflows/config/gitlab_commits.txt >> "$info_file"
- name: Upload build info
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/prebuilt_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,8 @@ jobs:
staging:
name: Staging
needs: [build_installer, build_openmpi, create_test_config, validation]
if: inputs.environment
# Allow staging even if there are not validations configured.
if: always() && !cancelled() && inputs.environment && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/python_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,9 @@ jobs:
run: |
wheeldeps_hash=${{ inputs.devdeps_image }}
platform_id=`echo "${{ inputs.platform }}" | sed 's/linux\///g' | tr -d ' ' | tr ',' -`
cuda_major=`echo ${{ inputs.cuda_version }} | cut -d . -f1`
build_config_id=${{ inputs.build_config_id }}
build_config_id=${build_config_id:-cu${{ inputs.cuda_version }}}
build_config_id=${build_config_id:-cu$cuda_major}
artifact_name=python_${platform_id}_${build_config_id}_publishing # changing the artifact name requires updating other workflows
echo "platform_id=$platform_id" >> $GITHUB_OUTPUT
Expand All @@ -393,6 +394,7 @@ jobs:
echo "source-sha: ${{ github.sha }}" >> "$info_file"
echo "cuda-quantum-wheeldeps-image: $wheeldeps_hash" >> "$info_file"
echo "platform: ${{ inputs.platform }}" >> "$info_file"
echo "cuda-version: ${{ inputs.cuda_version }}" >> "$info_file"
cat .github/workflows/config/gitlab_commits.txt >> "$info_file"
- name: Upload build info
Expand Down
2 changes: 1 addition & 1 deletion docker/build/assets.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
ARG base_image=amd64/almalinux:8
FROM ${base_image} AS prereqs
SHELL ["/bin/bash", "-c"]
ARG cuda_version
ARG cuda_version=11.8
ENV CUDA_VERSION=${cuda_version}

# When a dialogue box would be needed during install, assume default configurations.
Expand Down
2 changes: 1 addition & 1 deletion docker/build/cudaq.dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# 3) set the CC and CXX environment variable to use the same compiler toolchain
# as the LLVM dependencies have been built with.

ARG base_image=ghcr.io/nvidia/cuda-quantum-devdeps:ext-gcc11-main
ARG base_image=ghcr.io/nvidia/cuda-quantum-devdeps:ext-cu11-gcc11-main
FROM $base_image

ENV CUDAQ_REPO_ROOT=/workspaces/cuda-quantum
Expand Down
34 changes: 24 additions & 10 deletions docker/build/devdeps.ext.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,24 @@
# Must be built from the repo root with:
# docker build -t ghcr.io/nvidia/cuda-quantum-devdeps:ext -f docker/build/devdeps.ext.Dockerfile .

ARG cuda_version=11.8
ARG base_image=ghcr.io/nvidia/cuda-quantum-devdeps:llvm-main
ARG ompidev_image=ghcr.io/nvidia/cuda-quantum-devdeps:ompi-main
ARG ompidev_image=ghcr.io/nvidia/cuda-quantum-devdeps:cu11-ompi-main
FROM $ompidev_image AS ompibuild
ARG cuda_version
RUN if [ -z "${cuda_version}" ]; then \
echo -e "\e[01;31mError: Missing argument cuda_version.\e[0m" >&2 && \
exit 1; \
fi && \
if [ -n "${CUDA_VERSION}" ] && [ "${CUDA_VERSION}" != "${cuda_version}" ]; then \
echo -e "\e[01;31mError: CUDA version ${CUDA_VERSION} in ompidev_image does not match ${cuda_version}.\e[0m" >&2 && \
exit 1; \
fi

FROM $base_image
SHELL ["/bin/bash", "-c"]
ARG cuda_version
ENV CUDA_VERSION=${cuda_version}

# When a dialogue box would be needed during install, assume default configurations.
# Set here to avoid setting it for all install commands.
Expand Down Expand Up @@ -125,12 +137,13 @@ ENV CUQUANTUM_PATH="$CUQUANTUM_INSTALL_PREFIX"
ENV LD_LIBRARY_PATH="$CUQUANTUM_INSTALL_PREFIX/lib:$LD_LIBRARY_PATH"
ENV CPATH="$CUQUANTUM_INSTALL_PREFIX/include:$CPATH"

ENV CUQUANTUM_VERSION=24.03.0.4_cuda11
ENV CUQUANTUM_VERSION=24.08.0.5
RUN apt-get update && apt-get install -y --no-install-recommends xz-utils \
&& arch_folder=$([ "$(uname -m)" == "aarch64" ] && echo sbsa || echo x86_64) \
&& wget -q "https://developer.download.nvidia.com/compute/cuquantum/redist/cuquantum/linux-$arch_folder/cuquantum-linux-$arch_folder-$CUQUANTUM_VERSION-archive.tar.xz" \
&& mkdir -p "$CUQUANTUM_INSTALL_PREFIX" && tar xf cuquantum-linux-$arch_folder-$CUQUANTUM_VERSION-archive.tar.xz --strip-components 1 -C "$CUQUANTUM_INSTALL_PREFIX" \
&& rm cuquantum-linux-$arch_folder-$CUQUANTUM_VERSION-archive.tar.xz \
&& cuda_major=$(echo $CUDA_VERSION | cut -d . -f1) \
&& wget -q "https://developer.download.nvidia.com/compute/cuquantum/redist/cuquantum/linux-$arch_folder/cuquantum-linux-$arch_folder-${CUQUANTUM_VERSION}_cuda${cuda_major}-archive.tar.xz" \
&& mkdir -p "$CUQUANTUM_INSTALL_PREFIX" && tar xf cuquantum-linux-$arch_folder-${CUQUANTUM_VERSION}_cuda${cuda_major}-archive.tar.xz --strip-components 1 -C "$CUQUANTUM_INSTALL_PREFIX" \
&& rm cuquantum-linux-$arch_folder-${CUQUANTUM_VERSION}_cuda${cuda_major}-archive.tar.xz \
&& apt-get remove -y xz-utils \
&& apt-get autoremove -y --purge && apt-get clean && rm -rf /var/lib/apt/lists/*

Expand All @@ -145,19 +158,20 @@ ENV CPATH="$CUTENSOR_INSTALL_PREFIX/include:$CPATH"
ENV CUTENSOR_VERSION=2.0.1.2
RUN apt-get update && apt-get install -y --no-install-recommends xz-utils \
&& arch_folder=$([ "$(uname -m)" == "aarch64" ] && echo sbsa || echo x86_64) \
&& cuda_major=$(echo $CUDA_VERSION | cut -d . -f1) \
&& wget -q "https://developer.download.nvidia.com/compute/cutensor/redist/libcutensor/linux-$arch_folder/libcutensor-linux-$arch_folder-$CUTENSOR_VERSION-archive.tar.xz" \
&& tar xf libcutensor-linux-$arch_folder-$CUTENSOR_VERSION-archive.tar.xz && cd libcutensor-linux-$arch_folder-$CUTENSOR_VERSION-archive \
&& mkdir -p "$CUTENSOR_INSTALL_PREFIX" && mv include "$CUTENSOR_INSTALL_PREFIX" && mv lib/11 "$CUTENSOR_INSTALL_PREFIX/lib" \
&& mkdir -p "$CUTENSOR_INSTALL_PREFIX" && mv include "$CUTENSOR_INSTALL_PREFIX" && mv lib/${cuda_major} "$CUTENSOR_INSTALL_PREFIX/lib" \
&& cd / && rm -rf libcutensor-linux-$arch_folder-$CUTENSOR_VERSION-archive* \
&& apt-get remove -y xz-utils \
&& apt-get autoremove -y --purge && apt-get clean && rm -rf /var/lib/apt/lists/*

# Install CUDA 11.8.
# Install CUDA

ARG cuda_root=/usr/local/cuda-11.8
ARG cuda_packages="cuda-cudart-11-8 cuda-compiler-11-8 libcublas-dev-11-8 libcusolver-11-8"
ARG cuda_packages="cuda-cudart cuda-compiler libcublas-dev libcusolver"
RUN if [ -n "$cuda_packages" ]; then \
arch_folder=$([ "$(uname -m)" == "aarch64" ] && echo sbsa || echo x86_64) \
&& cuda_packages=`printf '%s\n' $cuda_packages | xargs -I {} echo {}-$(echo ${CUDA_VERSION} | tr . -)` \
&& wget -q "https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/$arch_folder/cuda-keyring_1.0-1_all.deb" \
&& dpkg -i cuda-keyring_1.0-1_all.deb \
&& apt-get update && apt-get install -y --no-install-recommends $cuda_packages \
Expand All @@ -178,7 +192,7 @@ RUN if [ -z "$CUDA_ROOT" ]; then \
/usr/local/cuda/compat/lib; \
fi

ENV CUDA_INSTALL_PREFIX="$cuda_root"
ENV CUDA_INSTALL_PREFIX="/usr/local/cuda-${CUDA_VERSION}"
ENV CUDA_HOME="$CUDA_INSTALL_PREFIX"
ENV CUDA_ROOT="$CUDA_INSTALL_PREFIX"
ENV CUDA_PATH="$CUDA_INSTALL_PREFIX"
Expand Down
2 changes: 1 addition & 1 deletion docker/build/devdeps.manylinux.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ RUN bash /scripts/install_prerequisites.sh

# Install CUDA

ARG cuda_version
ARG cuda_version=11.8
ENV CUDA_VERSION=${cuda_version}

# Note that pip packages are available for all necessary runtime components.
Expand Down
7 changes: 5 additions & 2 deletions docker/build/devdeps.ompi.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
# Must be built from the repo root with:
# docker build -t ghcr.io/nvidia/cuda-quantum-devdeps:ompi -f docker/build/devdeps.ompi.Dockerfile .

FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
ARG cuda_version=11.8
FROM nvidia/cuda:${cuda_version}.0-devel-ubuntu22.04
SHELL ["/bin/bash", "-c"]
ARG DEBIAN_FRONTEND=noninteractive
ARG cuda_version
ENV CUDA_VERSION=${cuda_version}

ARG TARGETARCH
ENV CUDA_INSTALL_PREFIX=/usr/local/cuda-11.8
ENV CUDA_INSTALL_PREFIX=/usr/local/cuda-${CUDA_VERSION}
ENV COMMON_COMPILER_FLAGS="-march=x86-64-v3 -mtune=generic -O2 -pipe"
ENV COMMON_COMPILER_FLAGS_ARM="-march=armv8-a -mtune=generic -O2 -pipe"

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ requires-python = ">=3.10"
license = { file="LICENSE" }
dependencies = [
'astpretty ~= 3.0',
'cuquantum-cu11 ~= 24.03',
'cuquantum-cu11 ~= 24.08',
'graphlib-backport >= 1.0',
'numpy >= 1.24',
'requests >= 2.31',
Expand Down
2 changes: 1 addition & 1 deletion scripts/configure_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if [ "$1" == "install-cuquantum" ]; then
CUDA_ARCH_FOLDER=$([ "$(uname -m)" == "aarch64" ] && echo sbsa || echo x86_64)

# [>cuQuantumInstall]
CUQUANTUM_VERSION=24.03.0.4
CUQUANTUM_VERSION=24.08.0.5
CUQUANTUM_DOWNLOAD_URL=https://developer.download.nvidia.com/compute/cuquantum/redist/cuquantum

cuquantum_archive=cuquantum-linux-${CUDA_ARCH_FOLDER}-${CUQUANTUM_VERSION}_cuda$(echo ${CUDA_VERSION} | cut -d . -f1)-archive.tar.xz
Expand Down

0 comments on commit c5f09eb

Please sign in to comment.