diff --git a/.github/workflows/actions.yml b/.github/workflows/lint_test.yml similarity index 97% rename from .github/workflows/actions.yml rename to .github/workflows/lint_test.yml index 450965c..4f064ac 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/lint_test.yml @@ -1,4 +1,4 @@ -name: GitHub Actions Demo +name: Lint and test run-name: CI/CD for ${{ github.ref_name }} on: pull_request: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..2964d1c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +name: Publish repo + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + workflow_dispatch: {} + +concurrency: + group: fast-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + deploy_docs: + name: Deploy docs (ubuntu) + runs-on: ubuntu-latest + steps: + - name: Checkout emulators + uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' + - name: Setup environment + run: | + pip install -r doc_requirements.txt + pip install -e . + - name: Deploy docs + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git fetch origin gh-pages + mike deploy --push --update-aliases ${{ github.ref_name }} latest diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6bec92c --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +PASQAL OPEN-SOURCE SOFTWARE LICENSE AGREEMENT (MIT-derived) + +The author of the License is: + Pasqal, a Société par Actions Simplifiée (Simplified Joint Stock Company) registered under number 849 441 522 at the Registre du commerce et des sociétés (Trade and Companies Register) of Evry – France, headquartered at 7 rue Leonard de Vinci – 91300 – Massy – France, duly represented by its Président, M. Georges-Olivier REYMOND, + +Hereafter referred to as « the Licensor » + +- Permission is hereby granted, free of charge, to any person obtaining a copy of this software (the “Licensee”) and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software is “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non-infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise arising from, out of or in connection with the Software or the use or other dealings in the Software. + +- If use of the Software leads to the necessary use of any patent of the Licensor and/or any of its Affiliates (defined as a company owned or controlled by the Licensor), the Licensee is granted a royalty-free license, in any country where such patent is in force, to use the object of such patent; or use the process covered by such patent, + +- Such a patent license is granted for internal research or academic use of the Licensee's, which includes use by employees and students of the Licensee, acting on behalf of the Licensee, for research purposes only. + +- The License is governed by the laws of France. Any dispute relating to the License, notably its execution, performance and/or termination shall be brought to, heard and tried by the Tribunal Judiciaire de Paris, regardless of the rules of jurisdiction in the matter. diff --git a/ci/emu_base/gitlab-ci-publish.yml b/ci/emu_base/gitlab-ci-publish.yml deleted file mode 100644 index 5d593bb..0000000 --- a/ci/emu_base/gitlab-ci-publish.yml +++ /dev/null @@ -1,27 +0,0 @@ -variables: - PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - REPOSITORY_NAME: $REPOSITORY_BASE_URL/emulators/emu-mps - PIP_EXTRA_INDEX_URL: "https://gitlab.pasqal.com/api/v4/projects/597/packages/pypi/simple" - -default: - interruptible: true - -cache: - paths: - - .cache/pip - -publish-package: - rules: - - if: $CI_PIPELINE_SOURCE == "parent_pipeline" - image: python:3.10 - script: - - export - - python -m pip install --upgrade pip - - python -m pip install hatch - - cd ci/emu_base - - python -m hatch build - - python -m hatch publish - variables: - HATCH_INDEX_USER: $CI_DEPLOY_USER - HATCH_INDEX_AUTH: $CI_DEPLOY_PASSWORD - HATCH_INDEX_REPO: https://gitlab.pasqal.com/api/v4/projects/597/packages/pypi diff --git a/ci/emu_mps/gitlab-ci-benchmarks.yml b/ci/emu_mps/gitlab-ci-benchmarks.yml deleted file mode 100644 index 061ef93..0000000 --- a/ci/emu_mps/gitlab-ci-benchmarks.yml +++ /dev/null @@ -1,199 +0,0 @@ -# Change pip's cache directory to be inside the project directory since we can -# only cache local items. -variables: - PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - REPOSITORY_BASE_URL: 9ygszqk0.gra7.container-registry.ovh.net - REPOSITORY_NAME: $REPOSITORY_BASE_URL/emulators/emu-mps - PIP_EXTRA_INDEX_URL: "https://gitlab.pasqal.com/api/v4/projects/597/packages/pypi/simple" - -default: - interruptible: true - -.id_token: - id_tokens: - CI_JOB_JWT: - aud: https://gitlab.pasqal.com - -# Include templates for running jobs on the dgx cluster -include: - - project: pasqal/dgx-cluster-support - ref: main - file: /gitlab-templates/dgx-runner.yml - -cache: - paths: - - .cache/pip - -workflow: - rules: - # https://gitlab.com/gitlab-org/gitlab/-/issues/385676 - # Due to the bug above, those conditional variables need to stay in `workflow` - # and cannot be put into a job's rules. - - if: $CI_PIPELINE_SOURCE == "parent_pipeline" && $IS_SCHEDULED_BENCHMARK == "true" - variables: - PROTECTED_RUNNER_TAG: protected - - if: $CI_PIPELINE_SOURCE == "parent_pipeline" - variables: - PROTECTED_RUNNER_TAG: slurm - -.benchmark: - artifacts: - paths: - - ci/emu_mps/benchmarks/${JOB_NAME}/${JOB_NAME}.out - - ci/emu_mps/benchmarks/${JOB_NAME}/results/* - when: on_success - access: all - # 7 days as package job will compile everything and store it for longer time - expire_in: "7 days" - tags: - # Run this job on the cluster with the dedicated runners using tags. - # There are two runners: both require the "slurm" tag - # and the "protected" one is special for the main branch. - - slurm - - $PROTECTED_RUNNER_TAG - cache: - paths: - - .cache/pip - - ci/emu_mps/benchmarks/framework/benchmarkutils/__pycache__/ - rules: - # Automatically run on main - - if: $CI_PIPELINE_SOURCE == "parent_pipeline" && $IS_SCHEDULED_BENCHMARK == "true" - # Manually run on merge requests - - if: $CI_PIPELINE_SOURCE == "parent_pipeline" - when: manual - allow_failure: true - before_script: - - export - - module purge - - !reference [ .template-jacamar-minimal, before_script ] - - module load devel/python/${PYTHON_VERSION} - - python3 -m venv venv - - . venv/bin/activate - - cp /home/emuteam/.venv/pip.conf venv/pip.conf - - cd ci/emu_mps/benchmarks/${JOB_NAME}/ - - pip install -e ../../../../ - - pip install -e ../framework - script: - - python3 benchmark.py | tee ${JOB_NAME}.out - after_script: - - !reference [ .template-jacamar-minimal, after_script ] - # Maximum and default runtime on the cluster of a job - timeout: 96h - variables: - PYTHON_VERSION: "3.10.4" - id_tokens: !reference [.id_token, id_tokens] - -benchmark_adiabatic_afm_state_cpu: - extends: .benchmark - variables: - SCHEDULER_PARAMETERS: "-N1 -c 16" - JOB_NAME: "adiabatic_afm_state_cpu" - -benchmark_adiabatic_afm_state_gpu: - extends: .benchmark - variables: - SCHEDULER_PARAMETERS: "-N1 -c 1 -G 1" - JOB_NAME: "adiabatic_afm_state_gpu" - -benchmark_afm_state_fidelity: - extends: .benchmark - variables: - SCHEDULER_PARAMETERS: "-N1 -c 16" - JOB_NAME: "afm_state_fidelity" - -benchmark_afm_state_fidelity_with_noise: - extends: .benchmark - variables: - SCHEDULER_PARAMETERS: "-N1 -c 16" - JOB_NAME: "afm_state_fidelity_with_noise" - -benchmark_afm_state_gpu_with_noise: - extends: .benchmark - variables: - SCHEDULER_PARAMETERS: "-N1 -c 1 -G 1" - JOB_NAME: "afm_state_gpu_with_noise" - -benchmark_qubit_shuffling_cpu: - extends: .benchmark - variables: - SCHEDULER_PARAMETERS: "-N1 -c 16" - JOB_NAME: "qubit_shuffling_cpu" - -benchmark_quench_fidelity: - extends: .benchmark - variables: - SCHEDULER_PARAMETERS: "-N1 -c 32" - JOB_NAME: "quench_fidelity" - timeout: 96h - -benchmark_quench_performance_cpu: - extends: .benchmark - variables: - SCHEDULER_PARAMETERS: "-N1 -c 32" - JOB_NAME: "quench_performance_cpu" - -benchmark_quench_performance_gpu: - extends: .benchmark - variables: - SCHEDULER_PARAMETERS: "-N1 -c 4 -G 1" - JOB_NAME: "quench_performance_gpu" - -benchmark_quench_perf_obs_cpuVSgpu: - extends: .benchmark - variables: - SCHEDULER_PARAMETERS: "-N1 -c 24 -G 2" - JOB_NAME: "quench_perf_obs_cpuVSgpu" - -package_benchmark_artifacts: - id_tokens: !reference [.id_token, id_tokens] - tags: - - slurm - - protected - rules: - # Run on the main branch, including when benchmarks fail - - if: $CI_PIPELINE_SOURCE == "parent_pipeline" && $IS_SCHEDULED_BENCHMARK == "true" - when: always - script: - - export - - echo "Packaging everything and backing up on the cluster" - after_script: - - timestamp=$(date +"%Y%m%dT%H%M") - - archivedir=/home/emuteam/archive - - mkdir -p ${archivedir}/${timestamp} - - cp -rva ci/emu_mps/benchmarks/*/results ${archivedir}/${timestamp} - - FILES=$(find $archivedir/$timestamp -type f -name *.png) - - for file in $FILES ; do echo -n " -a $file" >> commands.txt ; done - - FILES_CMD=$(cat commands.txt) - - msg="Hello Emulation Team!\n\nSee attachments for the emu-ct benchmark. \n\nDo not reply to this automatic email." - - SUBJECT='[no-reply] Emu-MPS weekly benchmark' - - echo -e "$msg" | mailx -r emuteam@admin-pasqal -s "$SUBJECT" $FILES_CMD emulation@pasqal.com - - rm commands.txt - needs: - - benchmark_adiabatic_afm_state_cpu - - benchmark_adiabatic_afm_state_gpu - - benchmark_afm_state_fidelity - - benchmark_afm_state_fidelity_with_noise - - benchmark_qubit_shuffling_cpu - - benchmark_quench_fidelity - - benchmark_quench_performance_cpu - - benchmark_quench_performance_gpu - - benchmark_quench_perf_obs_cpuVSgpu - artifacts: - name: all-benchmarks - paths: - - "ci/emu_mps/benchmarks/**/*.log" - - "ci/emu_mps/benchmarks/**/*.out" - - "ci/emu_mps/benchmarks/**/*.png" - - "ci/emu_mps/benchmarks/**/*.json" - expire_in: "30 days" - -success: - # This job is here to mark the pipeline as successful (instead of "passed with warnings") - # even though no (manual) benchmark ran. - rules: - - if: $CI_PIPELINE_SOURCE == "parent_pipeline" && $IS_SCHEDULED_BENCHMARK == "true" - when: never - - if: $CI_PIPELINE_SOURCE == "parent_pipeline" - script: - - export - - "true" diff --git a/ci/emu_mps/gitlab-ci-publish.yml b/ci/emu_mps/gitlab-ci-publish.yml deleted file mode 100644 index 95f5aee..0000000 --- a/ci/emu_mps/gitlab-ci-publish.yml +++ /dev/null @@ -1,41 +0,0 @@ -# Change pip's cache directory to be inside the project directory since we can -# only cache local items. -variables: - PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - REPOSITORY_BASE_URL: 9ygszqk0.gra7.container-registry.ovh.net - REPOSITORY_NAME: $REPOSITORY_BASE_URL/emulators/emu-mps - PIP_EXTRA_INDEX_URL: "https://gitlab.pasqal.com/api/v4/projects/597/packages/pypi/simple" - -cache: - paths: - - .cache/pip - -publish_cloud_image: - image: docker:20.10.18 - rules: - - if: $CI_PIPELINE_SOURCE == "parent_pipeline" - services: - - docker:20.10.18-dind - variables: - DOCKER_TLS_CERTDIR: "/certs" - script: - - export - - echo $HARBOR_TOKEN | docker login -u $HARBOR_USERNAME --password-stdin $REPOSITORY_BASE_URL - - docker build --build-arg SSH_PRIVATE_KEY="${SSH_PRIVATE_KEY}" -t $REPOSITORY_NAME:latest -t $REPOSITORY_NAME:$CI_COMMIT_TAG . - - docker push --all-tags $REPOSITORY_NAME - -publish-package: - image: python:3.10 - rules: - - if: $CI_PIPELINE_SOURCE == "parent_pipeline" - script: - - export - - python -m pip install --upgrade pip - - python -m pip install hatch - - cd ci/emu_mps - - python -m hatch build - - python -m hatch publish - variables: - HATCH_INDEX_USER: $CI_DEPLOY_USER - HATCH_INDEX_AUTH: $CI_DEPLOY_PASSWORD - HATCH_INDEX_REPO: https://gitlab.pasqal.com/api/v4/projects/597/packages/pypi diff --git a/doc_requirements.txt b/doc_requirements.txt index b71a6c9..c9d4c7c 100644 --- a/doc_requirements.txt +++ b/doc_requirements.txt @@ -8,3 +8,4 @@ mkdocs-exclude notebook<7 markdown-exec jupyter_contrib_nbextensions +mike diff --git a/docs/benchmarks/performance.md b/docs/benchmarks/performance.md index 24aeb67..f4ce31c 100644 --- a/docs/benchmarks/performance.md +++ b/docs/benchmarks/performance.md @@ -28,7 +28,7 @@ In the right column (both CPU and GPU figure), we explore the available register Let us now analyze the performance of the simulation for a much larger system. We show results for the adiabatic sequence with 49 qubits arranged in a 7x7 grid. The parameters of the simulation were `max_bond_dim = 1600`, `extra_krylov_tolerance=1e-5` and `precision=1e-6`, and we ran the simulation on 2 GPUs. The maximum bond dimension of the state, its size in memory, the total memory consumption of the program on GPU 1, and the time taken per emulation timestep (there are 390 timesteps of `dt=10 ns` each) are shown in the graph below.
- +
First off, note that the peak memory consumption on GPU 1 reaches almost 30GB at the end of the simulation and the memory profile on GPU 2 will be very similar. Note that this memory consumption can be estimated ([see here](../advanced/memory.md#an-example)), and that the simulation would not have fit on a single GPU. Next, the memory consumption stops increasing as quickly when the maximum bond dimension plateaus, but it does not stop increasing entirely. This is because when the maximum bond dimension reaches the cutoff value of `1600`, most of the tensors in the MPS will not have reached maximum size yet. However, the rate of memory consumption growth will decrease as more of the tensors reach this maximum size. @@ -67,7 +67,9 @@ The unshuffled register ordering is that given by `Register.rectangle` as used i 5 1 9 8 3 6 - +
+ +
The left column of the image shows no accuracy degradation from the qubit shuffling, returning equivalent observables. That is expected since both runs were able to converge to the desired precision. diff --git a/mkdocs.yml b/mkdocs.yml index 5550b9f..ee1b864 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,5 +1,5 @@ site_name: Emu-MPS -repo_url: "https://gitlab.pasqal.com/emulation/rydberg-atoms/emu-ct" +repo_url: "https://github.com/pasqal-io/emulators" repo_name: "emu-mps" nav: