Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All tags allowed for LIGHTNING_VERSION Docker build argument. #598

Merged
merged 4 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
* OpenMP acceleration can now be enabled at compile time for all `lightning.qubit` gate kernels using the "-DLQ_ENABLE_KERNEL_OMP=1" CMake argument.
[(#510)](https://github.com/PennyLaneAI/pennylane-lightning/pull/510)

* Enable building Docker images for any branch or tag. Set the Docker build cron job to build images for the latest release and `master`.
[(#598)](https://github.com/PennyLaneAI/pennylane-lightning/pull/598)

* Enable choosing the PennyLane-Lightning version and disabling push to Docker Hub in the Docker build workflow. Add a cron job calling the Docker build workflow.
[(#597)](https://github.com/PennyLaneAI/pennylane-lightning/pull/597)

Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/compat-docker-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ on:
workflow_dispatch:

jobs:
docker_linux_x86_64:
name: Docker build tests - Linux::x86_64
docker_linux_x86_64_latest:
name: Docker latest - Linux::x86_64
uses: ./.github/workflows/docker_linux_x86_64.yml
with:
lightning-version: 0.34.0
push-to-dockerhub: false
secrets: inherit # pass all secrets
docker_linux_x86_64_develop:
name: Docker develop - Linux::x86_64
uses: ./.github/workflows/docker_linux_x86_64.yml
with:
lightning-version: master
push-to-dockerhub: false
secrets: inherit # pass all secrets
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.34.0
VERSION := v0.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
10 changes: 7 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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.2.00
ARG LIGHTNING_VERSION=0.34.0
ARG LIGHTNING_VERSION=v0.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 @@ -68,8 +68,8 @@ WORKDIR /opt/pennylane-lightning
ENV VIRTUAL_ENV=/opt/venv-build
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN wget --progress=dot:giga https://github.com/PennyLaneAI/pennylane-lightning/archive/refs/tags/v${LIGHTNING_VERSION}.tar.gz
RUN tar -zxf v${LIGHTNING_VERSION}.tar.gz && mv pennylane-lightning-${LIGHTNING_VERSION}/* /opt/pennylane-lightning
RUN rm -rf tmp && git clone --depth 1 --branch ${LIGHTNING_VERSION} https://github.com/PennyLaneAI/pennylane-lightning.git tmp\
&& mv tmp/* /opt/pennylane-lightning && rm -rf tmp
RUN pip install --no-cache-dir wheel
RUN pip install --no-cache-dir -r requirements-dev.txt
RUN pip install --no-cache-dir -r doc/requirements.txt
Expand Down Expand Up @@ -120,6 +120,7 @@ RUN PL_BACKEND=lightning_kokkos python setup.py bdist_wheel
FROM base-runtime AS wheel-lightning-kokkos-openmp
COPY --from=build-kokkos-openmp /opt/kokkos /opt/kokkos
COPY --from=build-wheel-lightning-kokkos-openmp /opt/pennylane-lightning/dist/ /
COPY --from=build-wheel-lightning-qubit /opt/pennylane-lightning/dist/ /
RUN pip install --force-reinstall --no-cache-dir PennyLane_Lightning*.whl && rm PennyLane_Lightning*.whl
RUN pip install --no-cache-dir -U pennylane

Expand Down Expand Up @@ -181,6 +182,7 @@ RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY --from=build-kokkos-cuda /opt/kokkos /opt/kokkos
COPY --from=build-wheel-lightning-kokkos-cuda /opt/pennylane-lightning/dist/ /
COPY --from=build-wheel-lightning-qubit /opt/pennylane-lightning/dist/ /
RUN pip install --force-reinstall --no-cache-dir PennyLane_Lightning*.whl && rm PennyLane_Lightning*.whl
RUN pip install --no-cache-dir -U pennylane

Expand Down Expand Up @@ -209,6 +211,7 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip install --no-cache-dir custatevec-cu12
ENV LD_LIBRARY_PATH="$VIRTUAL_ENV/lib/python3.10/site-packages/cuquantum/lib:$LD_LIBRARY_PATH"
COPY --from=build-wheel-lightning-gpu /opt/pennylane-lightning/dist/ /
COPY --from=build-wheel-lightning-qubit /opt/pennylane-lightning/dist/ /
RUN pip install --no-cache-dir --force-reinstall PennyLane_Lightning*.whl && rm PennyLane_Lightning*.whl
RUN pip install --no-cache-dir -U pennylane

Expand Down Expand Up @@ -272,5 +275,6 @@ RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY --from=build-kokkos-rocm /opt/kokkos /opt/kokkos
COPY --from=build-wheel-lightning-kokkos-rocm /opt/pennylane-lightning/dist/ /
COPY --from=build-wheel-lightning-qubit /opt/pennylane-lightning/dist/ /
RUN pip install --force-reinstall --no-cache-dir PennyLane_Lightning*.whl && rm PennyLane_Lightning*.whl
RUN pip install --no-cache-dir -U pennylane
14 changes: 10 additions & 4 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You can also check the Lightning-plugins documentation:
## Download & install

Each image contains PennyLane and one of several high-performance plugins.
Choose a version (e.g. `0.32.0`) and append a device (plugin) name among the following:
Choose a version (e.g. `v0.34.0`) and append a device (plugin) name among the following:

- `lightning-qubit`: [pennylane-lightning](https://github.com/PennyLaneAI/pennylane-lightning) provides a fast state-vector simulator written in C++.
- `lightning-gpu`: [pennylane-lightning-gpu](https://github.com/PennyLaneAI/pennylane-lightning-gpu) is a plugin based on the NVIDIA [cuQuantum SDK](https://developer.nvidia.com/cuquantum-sdk).
Expand All @@ -25,16 +25,16 @@ Choose a version (e.g. `0.32.0`) and append a device (plugin) name among the fol
If you have Docker installed, download and spawn a container with `pennylane-lightning` as follows

```shell
docker run -v pwd:/io -it pennylaneai/pennylane:0.32.0-lightning-qubit bash
docker run -v pwd:/io -it pennylaneai/pennylane:v0.34.0-lightning-qubit bash
```

On certain systems, there may be other solutions supporting Docker containers.
For instance, NERSC computers (e.g. Perlmutter) have [Shifter](https://docs.nersc.gov/development/shifter/) bringing containers to HPC.
In this case, spawning a container is simple as

```shell
shifterimg pull pennylaneai/pennylane:0.32.0-lightning-qubit
shifter --image=pennylaneai/pennylane:0.32.0-lightning-qubit /bin/bash
shifterimg pull pennylaneai/pennylane:v0.34.0-lightning-qubit
shifter --image=pennylaneai/pennylane:v0.34.0-lightning-qubit /bin/bash
```

where the first command downloads the image and the second spawns a container.
Expand Down Expand Up @@ -68,6 +68,12 @@ Then the following command will build the target
docker build -f docker/Dockerfile --tag=${TARGET} --target ${TARGET} .
```

You may also feed a git tag or version as follows

```shell
docker build -f docker/Dockerfile --tag=${TARGET} --target ${TARGET} --build-arg="LIGHTNING_VERSION=${VERSION}" .
```

To start a container with a `bash` shell use

```shell
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-dev5"
__version__ = "0.35.0-dev6"
Loading