diff --git a/.github/workflows/deployments.yml b/.github/workflows/deployments.yml index 5505abb6f4..d3e636298c 100644 --- a/.github/workflows/deployments.yml +++ b/.github/workflows/deployments.yml @@ -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: @@ -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 @@ -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: @@ -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 @@ -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: @@ -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: diff --git a/.github/workflows/docker_images.yml b/.github/workflows/docker_images.yml index 278178b0e5..5ed80a92cc 100644 --- a/.github/workflows/docker_images.yml +++ b/.github/workflows/docker_images.yml @@ -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 @@ -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 }} @@ -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 }}} @@ -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 @@ -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 diff --git a/.github/workflows/prebuilt_binaries.yml b/.github/workflows/prebuilt_binaries.yml index c1414757e1..e7bb617b79 100644 --- a/.github/workflows/prebuilt_binaries.yml +++ b/.github/workflows/prebuilt_binaries.yml @@ -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 diff --git a/.github/workflows/python_wheels.yml b/.github/workflows/python_wheels.yml index 0c7dce1d64..f9c92baeab 100644 --- a/.github/workflows/python_wheels.yml +++ b/.github/workflows/python_wheels.yml @@ -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 @@ -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 diff --git a/docker/build/assets.Dockerfile b/docker/build/assets.Dockerfile index 4ec56f81f1..8f14d77342 100644 --- a/docker/build/assets.Dockerfile +++ b/docker/build/assets.Dockerfile @@ -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. diff --git a/docker/build/cudaq.dev.Dockerfile b/docker/build/cudaq.dev.Dockerfile index a3b9f32dbc..c5c25340a2 100644 --- a/docker/build/cudaq.dev.Dockerfile +++ b/docker/build/cudaq.dev.Dockerfile @@ -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 diff --git a/docker/build/devdeps.ext.Dockerfile b/docker/build/devdeps.ext.Dockerfile index 94ee9d3420..f785391e8c 100644 --- a/docker/build/devdeps.ext.Dockerfile +++ b/docker/build/devdeps.ext.Dockerfile @@ -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. @@ -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/* @@ -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 \ @@ -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" diff --git a/docker/build/devdeps.manylinux.Dockerfile b/docker/build/devdeps.manylinux.Dockerfile index 9a040d37e7..e12a438fcd 100644 --- a/docker/build/devdeps.manylinux.Dockerfile +++ b/docker/build/devdeps.manylinux.Dockerfile @@ -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. diff --git a/docker/build/devdeps.ompi.Dockerfile b/docker/build/devdeps.ompi.Dockerfile index 529b379323..1aba3d2bd2 100644 --- a/docker/build/devdeps.ompi.Dockerfile +++ b/docker/build/devdeps.ompi.Dockerfile @@ -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" diff --git a/pyproject.toml b/pyproject.toml index 47af11178d..194750ad58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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', diff --git a/scripts/configure_build.sh b/scripts/configure_build.sh index deafb645df..1ee4dbadb8 100644 --- a/scripts/configure_build.sh +++ b/scripts/configure_build.sh @@ -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