Google Quantum Programming Framework Cirq tooling
99
Development and test image with the purpose of supporting Google's Quantum Programming Framework cirq and qsim
NOTE: Quantum computing does cost money. So if you are using any image here to perform actual development or testing on pyhsical hardware you and you alone are responsible for the payment of those resource.
These links will provide guidance and a starting point for using cirq and qsim
Currently there are built images for amd64 and arm64
To run the built images from this repo run the following:
docker run --rm -it --platform linux/amd64 thpang/cirq:0.1.0
# Copyright © 2024, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
ARG UBUNTU_VERSION=22.04
FROM ubuntu:$UBUNTU_VERSION
# Environmental flags
ENV DEBIAN_FRONTEND noninteractive
#
# Update and install baseline items to run Googles Cirq framework
#
# NOTE: Python 3.12 has an issue with some depricated items and usage for Google Cirq
# waiting for fix to be put in place. This is why Ubuntu 22.04 is being used
# as a base at this point and not 24.04
#
# NOTE: qsimcirq also has an issue on arm64 architectures so if you are looking
# for gvms you'll need to run on amd64 architecture images for now ;)
#
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y python3-full python3-dev python3-pip virtualenv curl unzip gnupg git cmake texlive-latex-base latexmk neofetch vim \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy over entrypoint script
COPY ./docker-entrypoint.sh ./docker-entrypoint.sh
RUN chmod 755 ./docker-entrypoint.sh
#
# Adding ubuntu user
#
# NOTE: If you change the UBUNTU_VERSION from 22.04 -> 24.04 the
# ubuntu user is already defined so this code will need to change
#
RUN useradd --create-home --shell /bin/bash ubuntu && su - ubuntu -c "virtualenv cirq" && su - ubuntu -c "cd $HOME; . ./cirq/bin/activate && python -m pip install --upgrade pip && python -m pip install cirq && python -m pip install qsimcirq"
RUN su - ubuntu -c "pip install 'cirq-core[contrib]'"
USER ubuntu
ENTRYPOINT [ "./docker-entrypoint.sh" ]
#!/usr/bin/env bash
set -e
cd $HOME
. $HOME/cirq/bin/activate
exec /usr/bin/bash "$@"
The build process supports both amd64 and arm64 images. Create both the Dockerfile and docker-entrypoint.sh file in the same directory.
NOTE: Currently the arm64 image does not work because of a qsim issue with the ARM architecture.
You must have the use containerd for pulling and storing images option checked in the General setting section of the docker desktop to use the --platform option in order to build cross platform images.
docker build --platform linux/amd64 --no-cache --tag cirq:latest
To run the local image you built:
docker run --rm -it --platform linux/amd64 cirq:latest
# Copyright © 2022-2024, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
Content type
Image
Digest
sha256:dccdb54b3…
Size
1 GB
Last updated
over 2 years ago
docker pull thpang/cirq:0.1.0