From 9c0ad276c0d660a49084ebaec132926e33d870ca Mon Sep 17 00:00:00 2001 From: Vincent Michaud-Rioux Date: Fri, 19 Jan 2024 10:05:18 -0500 Subject: [PATCH] Bump Docker's Lightning version & add Docker build workflow. (#593) * Bump Docker's Lightning version & add Docker build workflow. * Auto update version * Mod pull_request triggers. * No sudo. * run on ubuntu-22.04 * Put back sudo. * Install wget. * Build lightning-qubit only. * apt-get -y * Fix LIGHTNING_VERSION * test and push * Use docker actions * Fix l_version * Add dockerfile path * Add test. * ubuntu-latest * Fix cmake/support_kokkos.cmake for kokkos-cuda. * Remove test which does not test much. * Revert triggers * Auto update version * trigger ci * save disk with no-cache=true * commet pull_req trigger. * Use GHA cache. * Do not test. * Fix trig. * Fix trig. * Revert trigs. * runs-on: * revert triggers * Add latest tag. * push: true --------- Co-authored-by: Dev version update bot --- .github/CHANGELOG.md | 5 +- .github/workflows/docker_linux_x86_64.yml | 79 +++++++++++++++++++++++ Makefile | 2 +- docker/Dockerfile | 7 +- pennylane_lightning/core/_version.py | 2 +- 5 files changed, 89 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/docker_linux_x86_64.yml diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 6ace55d89b..7618e08bfe 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -19,11 +19,14 @@ ### Bug fixes +* Fix `lightning-kokkos-cuda` Docker build and add CI workflow to build images and push to Docker Hub. + [(#593)](https://github.com/PennyLaneAI/pennylane-lightning/pull/593) + ### Contributors This release contains contributions from (in alphabetical order): -Amintor Dusko, Lee J. O'Riordan, Shuli Shu +Amintor Dusko, Vincent Michaud-Rioux, Lee J. O'Riordan, Shuli Shu --- diff --git a/.github/workflows/docker_linux_x86_64.yml b/.github/workflows/docker_linux_x86_64.yml new file mode 100644 index 0000000000..c98e21bd41 --- /dev/null +++ b/.github/workflows/docker_linux_x86_64.yml @@ -0,0 +1,79 @@ +name: Docker::Linux::x86_64 + +# **What it does**: Builds Docker images for Linux (ubuntu-22.04) architecture x86_64 and store it as artifacts. +# **Why we have it**: To build Docker images to be uploaded to Docker Hub. +# **Who does it impact**: Docker images uploaded to Docker Hub provide yet another way to install and use PennyLane + Lightning. It is especially useful on HPC platforms where environments can be difficult to set up. + +on: + release: + types: [published] + workflow_dispatch: + +concurrency: + group: docker_linux_x86_64-${{ github.ref }} + cancel-in-progress: true + +jobs: + + docker: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + pl_version: ["0.34.0"] + pl_backend: ["lightning-qubit", "lightning-gpu", "lightning-kokkos-openmp", "lightning-kokkos-cuda", "lightning-kokkos-rocm"] + timeout-minutes: 180 + name: docker::${{ matrix.os }}::${{ matrix.pl_backend }}::${{ matrix.pl_version }} + runs-on: + group: 'Lightning Additional Runners' + steps: + + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and export to Docker + uses: docker/build-push-action@v5 + with: + load: true + push: false + context: . + file: docker/Dockerfile + tags: test:${{ matrix.pl_version }}-${{ matrix.pl_backend }} + target: wheel-${{ matrix.pl_backend }} + build-args: | + LIGHTNING_VERSION=${{ matrix.pl_version }} + + - name: Test + run: | + docker run --rm test:${{ matrix.pl_version }}-${{ matrix.pl_backend }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + context: . + file: docker/Dockerfile + tags: pennylaneai/pennylane:${{ matrix.pl_version }}-${{ matrix.pl_backend }} + target: wheel-${{ matrix.pl_backend }} + build-args: | + LIGHTNING_VERSION=${{ matrix.pl_version }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + context: . + file: docker/Dockerfile + tags: pennylaneai/pennylane:latest-${{ matrix.pl_backend }} + target: wheel-${{ matrix.pl_backend }} + build-args: | + LIGHTNING_VERSION=${{ matrix.pl_version }} diff --git a/Makefile b/Makefile index 38c5f6114f..7e933488b6 100644 --- a/Makefile +++ b/Makefile @@ -138,7 +138,7 @@ endif ifdef version VERSION := $(version) else - VERSION := 0.33.1 + VERSION := 0.34.0 endif docker-build: docker build -f docker/Dockerfile --tag=pennylaneai/pennylane:$(VERSION)-$(TARGET) --target wheel-$(TARGET) --build-arg='LIGHTNING_VERSION=$(VERSION)' . diff --git a/docker/Dockerfile b/docker/Dockerfile index 8454df7047..60d6493fec 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,8 +20,8 @@ ARG AMD_ARCH=AMD_GFX90A ARG CUDA_ARCH=AMPERE80 ARG CUDA_INSTALLER=https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda_12.2.2_535.104.05_linux.run ARG GCC_VERSION=11 -ARG KOKKOS_VERSION=4.1.00 -ARG LIGHTNING_VERSION=0.33.1 +ARG KOKKOS_VERSION=4.2.00 +ARG LIGHTNING_VERSION=0.34.0 ARG ROCM_INSTALLER=https://repo.radeon.com/amdgpu-install/5.7/ubuntu/jammy/amdgpu-install_5.7.50700-1_all.deb RUN apt-get update \ && apt-get install --no-install-recommends -y \ @@ -137,7 +137,7 @@ FROM base-build-cuda as build-kokkos-cuda WORKDIR /opt/kokkos-${KOKKOS_VERSION} # RUN wget --progress=dot:giga https://github.com/kokkos/kokkos/archive/refs/tags/${KOKKOS_VERSION}.tar.gz # RUN tar -zxf ${KOKKOS_VERSION}.tar.gz && mv /opt/kokkos-${KOKKOS_VERSION}/kokkos-${KOKKOS_VERSION}/* /opt/kokkos-${KOKKOS_VERSION} -RUN git clone --branch fix-rtld-deepbind https://github.com/cz4rs/kokkos.git /opt/kokkos-${KOKKOS_VERSION} +RUN git clone --branch lightning https://github.com/vincentmr/kokkos.git /opt/kokkos-${KOKKOS_VERSION} RUN cmake -S /opt/kokkos-${KOKKOS_VERSION} -B /opt/kokkos-${KOKKOS_VERSION}/build \ -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ @@ -161,6 +161,7 @@ WORKDIR /opt/pennylane-lightning COPY --from=build-kokkos-cuda /opt/kokkos /opt/kokkos ENV CMAKE_PREFIX_PATH=/opt/kokkos:$CMAKE_PREFIX_PATH RUN pip uninstall -y pennylane-lightning +RUN echo >> cmake/support_kokkos.cmake && echo "find_package(CUDAToolkit REQUIRED)" >> cmake/support_kokkos.cmake RUN PL_BACKEND=lightning_kokkos python setup.py build_ext RUN PL_BACKEND=lightning_kokkos python setup.py bdist_wheel diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index b13eb0fd7c..2c4b62861a 100644 --- a/pennylane_lightning/core/_version.py +++ b/pennylane_lightning/core/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.35.0-dev2" +__version__ = "0.35.0-dev3"