From 31ba8e1bbf30daa2fb4b14392c0e6470725e75df Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Thu, 25 Jan 2024 11:40:27 -0600 Subject: [PATCH] Remove quantum circuit simulator example --- .../examples/quantum-circuit-simulator.yaml | 145 ------------------ examples/README.md | 22 --- .../daily-tests/builds/quantum-circuit.yaml | 55 ------- tools/cloud-build/daily-tests/tests/qsim.yml | 24 --- 4 files changed, 246 deletions(-) delete mode 100644 community/examples/quantum-circuit-simulator.yaml delete mode 100644 tools/cloud-build/daily-tests/builds/quantum-circuit.yaml delete mode 100644 tools/cloud-build/daily-tests/tests/qsim.yml diff --git a/community/examples/quantum-circuit-simulator.yaml b/community/examples/quantum-circuit-simulator.yaml deleted file mode 100644 index 2876ae5b16..0000000000 --- a/community/examples/quantum-circuit-simulator.yaml +++ /dev/null @@ -1,145 +0,0 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - ---- -blueprint_name: quantum-circuit - -# Please review https://cloud.google.com/compute/docs/regions-zones -# for availability of A2 machine types -vars: - project_id: ## Set project id here - deployment_name: qsim-demo - region: us-central1 - zone: us-central1-f - -# Documentation for each of the modules used below can be found at -# https://github.com/GoogleCloudPlatform/hpc-toolkit/blob/main/modules/README.md - -deployment_groups: -- group: primary - modules: - - id: network1 - source: modules/network/vpc - - - id: quantum-simulator-setup - source: modules/scripts/startup-script - settings: - runners: - - type: shell - destination: install-qsim.sh - content: | - #!/bin/bash - # This script implements https://quantumai.google/qsim/tutorials/gcp_gpu - # Disable any user interactive prompt during upgrade script. - export DEBIAN_FRONTEND=noninteractive - set -e -o pipefail - curl -O https://raw.githubusercontent.com/GoogleCloudPlatform/compute-gpu-installation/main/linux/install_gpu_driver.py - python3 install_gpu_driver.py - curl -O https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh - bash Miniconda3-py39_4.12.0-Linux-x86_64.sh -b -p /opt/conda - source /opt/conda/bin/activate base - conda init --system - conda config --system --set auto_activate_base False - # following channel ordering is important! use strict_priority! - # cuquantum comes from cuquantum label in nvidia channel - # libcutensor comes from main (default) label in nvidia channel - # cuda and all toolkit comes from cuda-11.5.2 label in nvidia channel - # everything else comes from conda-forge - conda config --system --set channel_priority strict - conda config --system --remove channels defaults - conda config --system --add channels conda-forge - conda config --system --add channels nvidia - conda config --system --add channels nvidia/label/cuda-11.5.2 - conda config --system --add channels nvidia/label/cuquantum-22.07.1 - conda update -n base conda --yes - conda create -n qsim python=3.9 --yes - conda install -n qsim cuda cuquantum make cmake cxx-compiler=1.5.1 --yes - echo "cuda ==11.5.*" > /opt/conda/envs/qsim/conda-meta/pinned - conda clean -p -t --yes - conda activate qsim - pip install pybind11 cirq - git clone -b v0.18.0 https://github.com/quantumlib/qsim.git /opt/qsim - cd /opt/qsim - export CUQUANTUM_ROOT=/opt/conda/envs/qsim - make - pip install . - - type: data - destination: /var/tmp/qsim-example.py - content: | - import sys - import time - import cirq, cirq_google - import qsimcirq - - def sim(width: int, height: int, reps: int, use_gpu: bool, gpu_mode: int): - rqc_fn = cirq.experiments.random_rotations_between_grid_interaction_layers_circuit - qvm_fn = cirq_google.engine.create_default_noisy_quantum_virtual_machine - - qubits = cirq.GridQubit.rect(width, height, 3, 2) - circuit = rqc_fn(qubits, depth=10, seed=0) + cirq.measure(*qubits, key="final_state") - - processor_id = "weber" - qsim_options = qsimcirq.QSimOptions(use_gpu=use_gpu, gpu_mode=gpu_mode) - # we do not recommend using seed=0 in production usage; in this - # example it helps compare performance between runs - qvm = qvm_fn(processor_id, qsimcirq.QSimSimulator, seed=0, qsim_options=qsim_options) - - start = time.time() - results = qvm.get_sampler(processor_id).run(circuit, repetitions=reps) - print(results) - print(f"elapsed: {time.time() - start:.03f}s") - - - if __name__ == "__main__": - width, height, reps = 5, 5, 10 - - print("This series of simulations should last approximately 1 minute on an A2 series VM\n") - print("Running on CPU:") - sys.stdout.flush() - sim(width=width, height=height, reps=reps, use_gpu=False, gpu_mode=0) - print("\nRunning on GPU (CUDA):") - sys.stdout.flush() - sim(width=width, height=height, reps=reps, use_gpu=True, gpu_mode=0) - print("\nRunning on GPU (CUDA + cuQuantum):") - sys.stdout.flush() - sim(width=width, height=height, reps=reps, use_gpu=True, gpu_mode=1) - - type: shell - destination: run-qsim.sh - content: | - #!/bin/bash -i - # The -i above (for interactive) is required so that conda command will be accessible. - # this script demonstrates how to run the qsim example application and - # also "warms up" the GPU to give reliable performance metrics - conda activate qsim - python /var/tmp/qsim-example.py - - - id: qsimvm - source: modules/compute/vm-instance - use: - - network1 - - quantum-simulator-setup - settings: - machine_type: n1-standard-32 - guest_accelerator: - - type: nvidia-tesla-t4 - count: 1 - instance_image: - project: ubuntu-os-cloud - family: ubuntu-2004-lts - - - id: wait - source: community/modules/scripts/wait-for-startup - settings: - instance_name: $(qsimvm.name[0]) - timeout: 2400 diff --git a/examples/README.md b/examples/README.md index 76368a0f05..be8eacbed6 100644 --- a/examples/README.md +++ b/examples/README.md @@ -25,7 +25,6 @@ md_toc github examples/README.md | sed -e "s/\s-\s/ * /" * [pfs-daos.yaml](#pfs-daosyaml-) ![community-badge] * [hpc-slurm-daos.yaml](#hpc-slurm-daosyaml-) ![community-badge] * [hpc-amd-slurm.yaml](#hpc-amd-slurmyaml-) ![community-badge] - * [quantum-circuit-simulator.yaml](#quantum-circuit-simulatoryaml-) ![community-badge] * [client-google-cloud-storage.yaml](#client-google-cloud-storageyaml--) ![community-badge] ![experimental-badge] * [hpc-slurm-gromacs.yaml](#hpc-slurm-gromacsyaml--) ![community-badge] ![experimental-badge] * [omnia-cluster.yaml](#omnia-clusteryaml--) ![community-badge] ![experimental-badge] @@ -666,27 +665,6 @@ examples][amd-examples-readme]. [AOCC]: https://developer.amd.com/amd-aocc/ [amd-examples-readme]: ../community/examples/AMD/README.md -### [quantum-circuit-simulator.yaml] ![community-badge] - -This blueprint provisions a [N1 series VM with NVIDIA T4 GPU accelerator][t4] -and compiles [qsim], a [Google Quantum AI][gqai]-developed tool that simulates -quantum circuits using CPUs and GPUs. The installation of qsim, the [CUDA -Toolkit][cudatk], and the [cuQuantum SDK][cqsdk] is fully automated but takes a -significant time (approx. 20 minutes). Once complete, a qsim example can be run -by connecting to the VM by SSH and running - -```shell -conda activate qsim -python /var/tmp/qsim-example.py -``` - -[gqai]: https://quantumai.google/ -[quantum-circuit-simulator.yaml]: ../community/examples/quantum-circuit-simulator.yaml -[t4]: https://cloud.google.com/compute/docs/gpus#nvidia_t4_gpus -[qsim]: https://quantumai.google/qsim -[cqsdk]: https://developer.nvidia.com/cuquantum-sdk -[cudatk]: https://developer.nvidia.com/cuda-toolkit - ### [client-google-cloud-storage.yaml] ![community-badge] ![experimental-badge] [client-google-cloud-storage.yaml]: ../community/examples/client-google-cloud-storage.yaml diff --git a/tools/cloud-build/daily-tests/builds/quantum-circuit.yaml b/tools/cloud-build/daily-tests/builds/quantum-circuit.yaml deleted file mode 100644 index 2d72aee381..0000000000 --- a/tools/cloud-build/daily-tests/builds/quantum-circuit.yaml +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - ---- -timeout: 14400s # 4hr -steps: -## Test simple golang build -- id: build_ghpc - waitFor: ["-"] - name: "golang:bullseye" - entrypoint: /bin/bash - args: - - -c - - | - cd /workspace - make -- id: fetch_builder - waitFor: ["-"] - name: >- - us-central1-docker.pkg.dev/$PROJECT_ID/hpc-toolkit-repo/hpc-toolkit-builder - entrypoint: /bin/bash - args: - - -c - - echo "done fetching builder" - -# test quantum circuit simulator example (startup-script runs example code after -# compiling libraries) -- id: quantum-circuit - waitFor: ["fetch_builder", "build_ghpc"] - name: us-central1-docker.pkg.dev/$PROJECT_ID/hpc-toolkit-repo/hpc-toolkit-builder - entrypoint: /bin/bash - env: - - "ANSIBLE_HOST_KEY_CHECKING=false" - - "ANSIBLE_CONFIG=/workspace/tools/cloud-build/ansible.cfg" - args: - - -c - - | - set -x -e - BUILD_ID_FULL=$BUILD_ID - BUILD_ID_SHORT=$${BUILD_ID_FULL:0:6} - - ansible-playbook tools/cloud-build/daily-tests/ansible_playbooks/base-integration-test.yml \ - --user=sa_106486320838376751393 --extra-vars="project=${PROJECT_ID} build=$${BUILD_ID_SHORT}" \ - --extra-vars="@tools/cloud-build/daily-tests/tests/qsim.yml" diff --git a/tools/cloud-build/daily-tests/tests/qsim.yml b/tools/cloud-build/daily-tests/tests/qsim.yml deleted file mode 100644 index e6eca65caa..0000000000 --- a/tools/cloud-build/daily-tests/tests/qsim.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - ---- - -test_name: quantum-circuit -deployment_name: "qsim-{{ build }}" -zone: us-central1-f -workspace: /workspace -blueprint_yaml: "{{ workspace }}/community/examples/quantum-circuit-simulator.yaml" -network: "{{ deployment_name }}-net" -remote_node: "{{ deployment_name }}-0" -post_deploy_tests: []