Skip to content

Commit

Permalink
Upgrade/dockerfile v0.33 (#539)
Browse files Browse the repository at this point in the history
* Upgrade docker.

* Make sure same version of PennyLane is installed.

* Just upgrade pennylane for now.

* Auto update version

* trigger ci

* Update changelog [skip ci].

* Auto update version

* trigger ci

* Auto update version

* Auto update version

* Trigger CI

* Update Makefile [skip ci]

Co-authored-by: Amintor Dusko <[email protected]>

* Update docker/Dockerfile [skip ci]

Co-authored-by: Amintor Dusko <[email protected]>

* Trigger CI

---------

Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Amintor Dusko <[email protected]>
  • Loading branch information
3 people authored Nov 10, 2023
1 parent 23f9d92 commit 7442701
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 26 deletions.
7 changes: 5 additions & 2 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

### Improvements

* Update Dockerfile and rewrite the `build-wheel-lightning-gpu` stage to build Lightning-GPU from the `pennylane-lightning` monorepo.
[(#539)] (https://github.com/PennyLaneAI/pennylane-lightning/pull/539)

* Add the MPI test CI workflows of Lightning-GPU in compatibility cron jobs.
[(#536)] (https://github.com/PennyLaneAI/pennylane-lightning/pull/536)

Expand Down Expand Up @@ -111,7 +114,7 @@ Lee J. O'Riordan

### Improvements

* Improve Python testing for Lightning-GPU (+MPI) by adding jobs in Actions files and adding Python tests to increase code coverage.
* Improve Python testing for Lightning-GPU (+MPI) by adding jobs in Actions files and adding Python tests to increase code coverage.
[(#522)](https://github.com/PennyLaneAI/pennylane-lightning/pull/522)

* Add support for `pip install pennylane-lightning[kokkos]` for the OpenMP backend.
Expand Down Expand Up @@ -142,7 +145,7 @@ Lee J. O'Riordan

### Bug fixes

* Fix CI issues running python-cov with MPI.
* Fix CI issues running python-cov with MPI.
[(#535)](https://github.com/PennyLaneAI/pennylane-lightning/pull/535)

* Re-add support for `pip install pennylane-lightning[gpu]`.
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,24 @@ endif
ifdef version
VERSION := $(version)
else
VERSION := 0.32.0
VERSION := 0.33.1
endif
docker-build:
docker build -f docker/Dockerfile --tag=pennylaneai/pennylane:$(VERSION)-$(TARGET) --target wheel-$(TARGET) .
docker build -f docker/Dockerfile --tag=pennylaneai/pennylane:$(VERSION)-$(TARGET) --target wheel-$(TARGET) --build-arg='LIGHTNING_VERSION=$(VERSION)' .
docker-push:
docker push pennylaneai/pennylane:$(VERSION)-$(TARGET)
docker-build-all:
$(MAKE) docker-build target=lightning-qubit
$(MAKE) docker-build target=lightning-gpu
$(MAKE) docker-build target=lightning-kokkos-openmp
$(MAKE) docker-build target=lightning-kokkos-cuda
$(MAKE) docker-build target=lightning-kokkos-rocm
$(MAKE) docker-build target=lightning-kokkos-openmp
$(MAKE) docker-build target=lightning-qubit
docker-push-all:
$(MAKE) docker-push target=lightning-qubit
$(MAKE) docker-push target=lightning-gpu
$(MAKE) docker-push target=lightning-kokkos-openmp
$(MAKE) docker-push target=lightning-kokkos-cuda
$(MAKE) docker-push target=lightning-kokkos-rocm
$(MAKE) docker-push target=lightning-kokkos-openmp
$(MAKE) docker-push target=lightning-qubit
docker-all:
$(MAKE) docker-build-all
$(MAKE) docker-push-all
28 changes: 13 additions & 15 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.1.00
ARG LIGHTNING_VERSION=0.32.0
ARG LIGHTNING_VERSION=0.33.1
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 @@ -78,13 +78,14 @@ RUN pip install --no-cache-dir -r doc/requirements.txt
FROM base-build-python AS build-wheel-lightning-qubit
WORKDIR /opt/pennylane-lightning
RUN pip uninstall -y pennylane-lightning
RUN python setup.py build_ext --define="ENABLE_KOKKOS=OFF"
RUN python setup.py build_ext
RUN python setup.py bdist_wheel

# Install lightning-qubit backend
FROM base-runtime AS wheel-lightning-qubit
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

# Download Kokkos release and build OpenMP backend
FROM base-build as build-kokkos-openmp
Expand Down Expand Up @@ -120,6 +121,7 @@ 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/ /
RUN pip install --force-reinstall --no-cache-dir PennyLane_Lightning*.whl && rm PennyLane_Lightning*.whl
RUN pip install --no-cache-dir -U pennylane

# Install CUDA-12 in build venv image
FROM base-build-python as base-build-cuda
Expand Down Expand Up @@ -179,22 +181,15 @@ 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/ /
RUN pip install --force-reinstall --no-cache-dir PennyLane_Lightning*.whl && rm PennyLane_Lightning*.whl
RUN pip install --no-cache-dir -U pennylane

# Download and build Lightning-GPU release
FROM base-build-cuda AS build-wheel-lightning-gpu
WORKDIR /opt/pennylane-lightning-gpu
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN wget --progress=dot:giga https://github.com/PennyLaneAI/pennylane-lightning-gpu/archive/refs/tags/v${LIGHTNING_VERSION}.tar.gz
RUN tar -zxf v${LIGHTNING_VERSION}.tar.gz && ls -l
RUN mv pennylane-lightning-gpu-${LIGHTNING_VERSION}/* /opt/pennylane-lightning-gpu
RUN pip uninstall -y pennylane-lightning-gpu
WORKDIR /opt/pennylane-lightning
RUN pip install --no-cache-dir wheel custatevec-cu12
RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \
pip install --no-cache-dir -r requirements.txt
RUN python setup.py build_ext --cuquantum=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum/lib')")
RUN python setup.py bdist_wheel
RUN pip uninstall -y pennylane-lightning
RUN CUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum/lib')") PL_BACKEND=lightning_gpu python setup.py build_ext
RUN PL_BACKEND=lightning_gpu python setup.py bdist_wheel

# Install python3 and setup runtime virtual env in CUDA-12-runtime image (includes CUDA runtime and math libraries)
# Install lightning-kokkos CUDA backend
Expand All @@ -211,8 +206,10 @@ ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip install --no-cache-dir custatevec-cu12
COPY --from=build-wheel-lightning-gpu /opt/pennylane-lightning-gpu/dist/ /
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/ /
RUN pip install --no-cache-dir --force-reinstall PennyLane_Lightning*.whl && rm PennyLane_Lightning*.whl
RUN pip install --no-cache-dir -U pennylane

# Install ROCm in build venv image
FROM base-build-python as base-build-rocm
Expand Down Expand Up @@ -275,3 +272,4 @@ 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/ /
RUN pip install --force-reinstall --no-cache-dir PennyLane_Lightning*.whl && rm PennyLane_Lightning*.whl
RUN pip install --no-cache-dir -U pennylane
4 changes: 2 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ You can also check the Lightning-plugins documentation:
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:

- `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).
- `lightning-kokkos-cuda`: [pennylane-lightning-kokkos](https://github.com/PennyLaneAI/pennylane-lightning#lightning-kokkos-installation) parallelizes state-vector simulations using Kokkos' [CUDA](https://developer.nvidia.com/cuda-toolkit) backend.
- `lightning-kokkos-openmp`: [pennylane-lightning-kokkos](https://github.com/PennyLaneAI/pennylane-lightning#lightning-kokkos-installation) parallelizes state-vector simulations using Kokkos' [OpenMP](https://www.openmp.org/) backend.
- `lightning-kokkos-rocm`: [pennylane-lightning-kokkos](https://github.com/PennyLaneAI/pennylane-lightning#lightning-kokkos-installation) parallelizes state-vector simulations using Kokkos' [HIP](https://docs.amd.com/projects/HIP/en/docs-5.3.0/index.html) backend.
- `lightning-qubit`: [pennylane-lightning](https://github.com/PennyLaneAI/pennylane-lightning) provides a fast state-vector simulator written in C++.

If you have Docker installed, download and spawn a container with `pennylane-lightning` as follows

Expand Down Expand Up @@ -55,11 +55,11 @@ pl-device-test --device lightning.qubit --shots 10000

Decide on a target among:

- `wheel-lightning-qubit`
- `wheel-lightning-gpu`
- `wheel-lightning-kokkos-cuda`
- `wheel-lightning-kokkos-openmp`
- `wheel-lightning-kokkos-rocm`
- `wheel-lightning-qubit`

For instance `TARGET=wheel-lightning-qubit`.
Then the following command will build the target
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.34.0-dev5"
__version__ = "0.34.0-dev6"

0 comments on commit 7442701

Please sign in to comment.