Last active
May 3, 2023 22:38
-
-
Save splch/16c6d46983a88505f73c6d6363d6e218 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start with a base Ubuntu 22.04 image | |
# --platform=linux/amd64 | |
FROM ubuntu:22.04 | |
# Set environment variables | |
ENV DEBIAN_FRONTEND=noninteractive \ | |
LLVM_VERSION=c0b45fef155fbe3f17f9a6f99074682c69545488 \ | |
LLVM_INSTALL_PATH=/opt/llvm \ | |
CUDAQ_INSTALL_PATH=$HOME/.cudaq | |
# Install dependencies | |
RUN apt-get update && \ | |
apt-get install -y --no-install-recommends \ | |
gcc g++ \ | |
git \ | |
cmake \ | |
ninja-build \ | |
python3 \ | |
python3-pip \ | |
python3-dev \ | |
wget \ | |
libblas-dev \ | |
liblapack-dev && \ | |
rm -rf /var/lib/apt/lists/* | |
# Build LLVM / Clang / MLIR | |
RUN mkdir llvm-project && \ | |
cd llvm-project && \ | |
git init && \ | |
git remote add origin https://github.com/llvm/llvm-project && \ | |
git fetch origin --depth=1 ${LLVM_VERSION} && \ | |
git reset --hard FETCH_HEAD && \ | |
mkdir build && \ | |
cd build && \ | |
cmake ../llvm -G Ninja \ | |
-DLLVM_TARGETS_TO_BUILD="host" \ | |
-DCMAKE_INSTALL_PREFIX=${LLVM_INSTALL_PATH} \ | |
-DLLVM_ENABLE_PROJECTS="clang;mlir" \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DLLVM_ENABLE_ASSERTIONS=ON \ | |
-DLLVM_INSTALL_UTILS=TRUE && \ | |
ninja install && \ | |
cp bin/llvm-lit ${LLVM_INSTALL_PATH}/bin/ | |
RUN pip3 install lit numpy pytest | |
# Build CUDA Quantum | |
RUN git clone https://github.com/NVIDIA/cuda-quantum && \ | |
cd cuda-quantum && \ | |
mkdir build && \ | |
cd build && \ | |
cmake .. -G Ninja \ | |
-DCMAKE_INSTALL_PREFIX=${CUDAQ_INSTALL_PATH} \ | |
-DLLVM_DIR=${LLVM_INSTALL_PATH}/lib/cmake/llvm \ | |
-DCUDAQ_ENABLE_PYTHON=TRUE && \ | |
ninja install && \ | |
ctest -E ctest-nvqpp | |
# Set the working directory | |
WORKDIR /workspace | |
# Entry point | |
CMD ["/bin/bash"] |
Author
splch
commented
May 3, 2023
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment