Skip to content

Commit

Permalink
Bump Docker's Lightning version & add Docker build workflow. (#593)
Browse files Browse the repository at this point in the history
* 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-actions[bot]@users.noreply.github.com>
  • Loading branch information
vincentmr and github-actions[bot] authored Jan 19, 2024
1 parent 2143239 commit 9c0ad27
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

---

Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/docker_linux_x86_64.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)' .
Expand Down
7 changes: 4 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.35.0-dev2"
__version__ = "0.35.0-dev3"

0 comments on commit 9c0ad27

Please sign in to comment.