Skip to content

Commit

Permalink
Build Qiskit for Grace Hopper (#50) (#53)
Browse files Browse the repository at this point in the history
* Bump pillow from 10.1.0 to 10.3.0 in /python/hpc-python

Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.1.0 to 10.3.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](python-pillow/Pillow@10.1.0...10.3.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...



* Bump jinja2 from 3.1.2 to 3.1.4 in /python/hpc-python

Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.4.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](pallets/jinja@3.1.2...3.1.4)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: direct:production
...



* Bump tornado from 6.4 to 6.4.1 in /python/hpc-python

Bumps [tornado](https://github.com/tornadoweb/tornado) from 6.4 to 6.4.1.
- [Changelog](https://github.com/tornadoweb/tornado/blob/master/docs/releases.rst)
- [Commits](tornadoweb/tornado@v6.4.0...v6.4.1)

---
updated-dependencies:
- dependency-name: tornado
  dependency-type: direct:production
...



* Bump urllib3 from 2.1.0 to 2.2.2 in /python/hpc-python

Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.1.0 to 2.2.2.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](urllib3/urllib3@2.1.0...2.2.2)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
...



* Bump scikit-learn from 1.3.2 to 1.5.0 in /python/hpc-python

Bumps [scikit-learn](https://github.com/scikit-learn/scikit-learn) from 1.3.2 to 1.5.0.
- [Release notes](https://github.com/scikit-learn/scikit-learn/releases)
- [Commits](scikit-learn/scikit-learn@1.3.2...1.5.0)

---
updated-dependencies:
- dependency-name: scikit-learn
  dependency-type: direct:production
...



* Update the logic of scripts. DATE_TAG will be used as image tag for image.

* Del duplicated script for qiskit under python/hpc-python. Move and extend to application folder.

* Bump zipp from 3.17.0 to 3.19.1 in /python/hpc-python

Bumps [zipp](https://github.com/jaraco/zipp) from 3.17.0 to 3.19.1.
- [Release notes](https://github.com/jaraco/zipp/releases)
- [Changelog](https://github.com/jaraco/zipp/blob/main/NEWS.rst)
- [Commits](jaraco/zipp@v3.17.0...v3.19.1)

---
updated-dependencies:
- dependency-name: zipp
  dependency-type: direct:production
...



* Bump certifi from 2023.11.17 to 2024.7.4 in /python/hpc-python

Bumps [certifi](https://github.com/certifi/python-certifi) from 2023.11.17 to 2024.7.4.
- [Commits](certifi/python-certifi@2023.11.17...2024.07.04)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: direct:production
...



* A Qiskit-aer-GPU (v0.15) built with a minimal image based on CUDA 12.5, compatible with Grace Hopper, and supporting aarch64 architectures. No MPI and Lustre supported.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Shusen Liu <shusen.liu@pawsey.org.au>
Co-authored-by: Alexis Espinosa <Alexis.Espinosa@pawsey.org.au>
  • Loading branch information
4 people authored Sep 6, 2024
1 parent c716d90 commit de0777e
Show file tree
Hide file tree
Showing 5 changed files with 499 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,80 @@ out_*
nohup.out
*.tgz
log.*

# Virtualenv
/.venv/
/venv/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
/bin/
/build/
/develop-eggs/
/dist/
/eggs/
/lib/
/lib64/
/output/
/parts/
/sdist/
/var/
/*.egg-info/
/.installed.cfg
/*.egg
/.eggs

# AUTHORS and ChangeLog will be generated while packaging
/AUTHORS
/ChangeLog

# BCloud / BuildSubmitter
/build_submitter.*
/logger_client_log

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
.tox/
.coverage
.cache
.pytest_cache
nosetests.xml
coverage.xml

# Translations
*.mo

# Sphinx documentation
/docs/_build/

# Study test
/study/

# JetBrains
/.idea/
/.run/

Output/
/Calibration/

.DS_Store

# Jupyter Notebook
/PatentResearch/.ipynb_checkpoints/

# log files
/ModelEvaluation/log/
Example/
*/Output/

# Environmental variables
.run/__init__.run.xml
131 changes: 131 additions & 0 deletions applications/qiskit/buildqiskit-cuda-aarch64.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# This recipe supports Qiskit-aer-GPU built with a minimal image based on CUDA 12.5, compatible with Grace Hopper, and supporting aarch64 architectures.
# NO MPI, NO LUSTRE, NO
# py version is allowed to be passed in as a build argument
ARG PY_VERSION="3.12"
# cuda version is allowed to be passed in as a build argument 12.5.0/12.6.0. For Grace Hopper, we recommand only these two versions.
ARG CUDA_VERSION="12.5.0"
# date tag is allowed to be passed in as a build argument
ARG DATE_TAG=2024-09

#----------------------------------------------------------------
#------------------------start stage------------------------
#----------------------------------------------------------------
FROM ubuntu:22.04
ARG PY_VERSION
ARG DATE_TAG
ARG CUDA_VERSION


# define some metadata
LABEL org.opencontainers.image.created="2024-09"
LABEL org.opencontainers.image.authors="Shusen Liu <shusen.liu@pawsey.org.au>"
LABEL org.opencontainers.image.documentation="https://github.com/PawseySC/pawsey-containers/"
LABEL org.opencontainers.image.source="https://github.com/PawseySC/pawsey-containers/applications/qiskit/buildqiskit-cuda.dockerfile"
LABEL org.opencontainers.image.vendor="Pawsey Supercomputing Research Centre"
LABEL org.opencontainers.image.licenses="GNU GPL3.0"
LABEL org.opencontainers.image.title="Qiskit - Grace Hopper with CUDA ${CUDA_VERSION}"
LABEL org.opencontainers.image.description="A Qiskit-aer-GPU built with a minimal image based on CUDA 12.5, compatible with Grace Hopper, and supporting aarch64 architectures."
LABEL org.opencontainers.image.base.name="ubuntu2204"

# run apt-get install on a few packages
ENV DEBIAN_FRONTEND="noninteractive"

RUN apt-get update -qq \
&& apt-get install -y --no-install-recommends software-properties-common gpg-agent \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update -qq \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
wget \
git \
python3 python3-dev python3-pip python3-setuptools python3-venv \
sudo \
curl \
libtool \
make \
cmake \
openssh-server \
vim \
ninja-build \
libblas-dev libopenblas-dev \
python${PY_VERSION}-dev \
python${PY_VERSION}-distutils \
python${PY_VERSION}-full \
&& wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/sbsa/cuda-keyring_1.1-1_all.deb \
&& dpkg -i cuda-keyring_1.1-1_all.deb \
&& apt-get update \
&& if [ "${CUDA_VERSION}" = "12.5.0" ]; then \
apt-get -y install cuda-compiler-12-5; \
elif [ "${CUDA_VERSION}" = "12.6.0" ]; then \
apt-get -y install cuda-compiler-12-6; \
else \
echo "Unsupported CUDA version: ${CUDA_VERSION}"; \
exit 1; \
fi \
&& pip install --upgrade pip setuptools \
&& pip install nvidia-cuda-runtime-cu12 nvidia-nvjitlink-cu12 nvidia-cublas-cu12 nvidia-cusolver-cu12 nvidia-cusparse-cu12 pip-tools \
&& update-alternatives --install /usr/bin/python python /usr/bin/python${PY_VERSION} 1 \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PY_VERSION} 1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm cuda-keyring_1.1-1_all.deb

WORKDIR /opt/

RUN wget https://developer.download.nvidia.com/compute/cuquantum/redist/cuquantum/linux-sbsa/cuquantum-linux-sbsa-24.08.0.5_cuda12-archive.tar.xz -O cuquantum.tar.xz \
&& wget https://developer.download.nvidia.com/compute/cutensor/redist/libcutensor/linux-sbsa/libcutensor-linux-sbsa-2.0.2.5-archive.tar.xz -O libcutensor.tar.xz \
&& tar -xf cuquantum.tar.xz \
&& tar -xf libcutensor.tar.xz \
&& ls \
&& mv cuquantum-linux* /opt/cuquantum \
&& mv libcutensor-linux* /opt/libcutensor \
&& mkdir -p /opt/cuquantum/lib/12 \
&& cd /opt/cuquantum/lib \
&& for file in *; do ln -s ../$file 12/$file; done \
&& rm /opt/cuquantum.tar.xz /opt/libcutensor.tar.xz

RUN mkdir -p /opt/qiskit-aer-build \
&& git clone https://github.com/Qiskit/qiskit-aer /opt/qiskit-aer-build \
&& cd /opt/qiskit-aer-build \
## Only 0.15 For Grace Hopper
&& git checkout 0.15

RUN echo "Building Qiskit ... " \
&& python -m ensurepip --upgrade \
&& python -m pip install --upgrade setuptools

RUN pip --no-cache-dir install scikit-build>=0.11.0 conan==1.65.0 pybind11==2.13.4 numpy==2.0.1

# set the default Python version
RUN if [ ! -e /usr/bin/python ]; then ln -s /usr/bin/python3 /usr/bin/python; fi

RUN rm -rf /opt/qiskit-aer-build/_skbuild

ENV CC=/usr/bin/gcc \
CXX=/usr/bin/g++ \
CUDACXX=/usr/local/cuda/bin/nvcc

WORKDIR /opt/qiskit-aer-build
ENV LD_LIBRARY_PATH=/opt/cuquantum/lib:/usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib:/opt/libcutensor/lib/12:/usr/local/lib/python3.10/dist-packages/nvidia/cusolver/lib:/usr/local/lib/python3.10/dist-packages/nvidia/cusparse/lib:${LD_LIBRARY_PATH:-""}

RUN python ./setup.py bdist_wheel -vvv -- \
-DAER_THRUST_BACKEND=CUDA \
-DCUQUANTUM_ROOT=/opt/cuquantum \
-DCUTENSOR_ROOT=/opt/libcutensor \
-DAER_ENABLE_CUQUANTUM=true

# install qiskit-aer
RUN python -m pip install /opt/qiskit-aer-build/dist/qiskit_aer*.whl

RUN rm -rf /opt/qiskit-aer-build/_skbuild
#RUN python -m pip install -r /opt/qiskit-aer-build/requirements-dev.txt

RUN mkdir -p /container-scratch/

# and copy the recipe into the docker recipes directory
RUN mkdir -p /opt/docker-recipes/
COPY buildqiskit-cuda.dockerfile /opt/docker-recipes/

# final
CMD ["/bin/bash"]
32 changes: 32 additions & 0 deletions cuda/cuda-lustre-mpich/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

# Get today's date in yyyy/mm format
DATE_TAG=$(date +%Y/%m)

# Replace slashes with dashes for Docker tag compatibility
DATE_TAG=$(echo $DATE_TAG | tr '/' '-')

# Execute download.sh
echo "Executing download.sh..."
bash $script_dir/download.sh

# Check if download.sh executed successfully
if [ $? -ne 0 ]; then
echo "download.sh execution failed. Exiting."
exit 1
fi

# Based nvidia/cuda:12.5.0-devel-ubuntu22.04
BASE_NAME="nvidia/cuda:12.5.0-devel-ubuntu22.04"
# Build Docker image with the date tag
echo "Building Docker image on ${BASE_NAME} with tag ${DATE_TAG}..."
docker build -t cuda-lustre-mpich:${DATE_TAG} -f buildcudalustrempich.dockerfile --build-arg DATE_TAG=${DATE_TAG} .

# Check if Docker build was successful
if [ $? -ne 0 ]; then
echo "Docker build failed. Exiting."
exit 1
fi

echo "Docker image built successfully with tag ${DATE_TAG}."
Loading

0 comments on commit de0777e

Please sign in to comment.