{"id":21930725,"url":"https://github.com/previsionio/damavand","last_synced_at":"2025-04-19T19:10:50.241Z","repository":{"id":45081783,"uuid":"440848904","full_name":"previsionio/damavand","owner":"previsionio","description":"Damavand is a quantum circuit simulator. It can  run on laptops or High Performance Computing architectures, such CPU distributed architectures or multi GPU distributed architectures.","archived":false,"fork":false,"pushed_at":"2022-01-11T14:59:00.000Z","size":13506,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-30T20:09:21.898Z","etag":null,"topics":["cuda","distributed-computing","hpc","multi-gpu","multithreading","quantum-computing","rust","simulator"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/previsionio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-22T12:22:03.000Z","updated_at":"2023-08-21T08:02:51.000Z","dependencies_parsed_at":"2022-08-12T11:40:59.385Z","dependency_job_id":null,"html_url":"https://github.com/previsionio/damavand","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/previsionio%2Fdamavand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/previsionio%2Fdamavand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/previsionio%2Fdamavand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/previsionio%2Fdamavand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/previsionio","download_url":"https://codeload.github.com/previsionio/damavand/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227003748,"owners_count":17715748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuda","distributed-computing","hpc","multi-gpu","multithreading","quantum-computing","rust","simulator"],"created_at":"2024-11-28T23:11:14.102Z","updated_at":"2024-11-28T23:11:14.840Z","avatar_url":"https://github.com/previsionio.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"![damavand-main](figures/damavand_main.png)\n\nDamavand is a code that simulates quantum circuits.\nIn order to learn more about damavand, refer to the [documentation](https://previsionio.github.io/damavand/).\n\n## Development status\n\n1. Core features:\n  * single node CPU multithreading ✔️\n  * single node GPU ✔️\n  * multiple nodes CPU multithreading ✔️\n  * single node multiple GPUs ✔️\n  * multiple nodes multiple GPUs ✔️\n2. pypi  ✔️\n3. README.md ✔️\n3. Documentation 🛠️ (under construction)\n\n## Installation\n\n### From pypi\n```bash\npip3 install damavand\n```\n\n### From sources\n\n```bash\ngit clone https://github.com/previsionio/damavand.git\ncd damavand/\npython3 setup.py install\n```\n\n## Example\nDamavand can be executed with different \"apply methods\". These refer to the algorithms used to update a quantum state by\napplying a given quantum gate. The different apply methods are:\n\n1. `brute_force` brute matrix vector multiplication (requires a lot of memory).\n2. `shuffle` smart implementation of matrix vector multiplication where the matrix is the result of a series of\n   kronecker products (requires less memory but is still a bit slow).\n3. `multithreading` runs on a single node multi CPUs.\n4. `gpu` runs on a single node single GPU.\n5. `distributed_cpu` runs on a multiple nodes multiple CPUs.\n6. `distributed_gpu` runs on a single node multiple GPUs or on multiple nodes multiple GPUs.\n\nThe default `apply_method` is `multithreading`. this can be changes by providing it as an option to the Circuit\nbuilder, as shown in the following example:\n\n```python\nfrom damavand import Circuit\n\n# initialize MPI\nfrom mpi4py import MPI\n\nnum_qubits = 1\ncircuit = Circuit(num_qubits, apply_method=\"distributed_gpu\")\n\ncircuit.add_hadamard_gate(0)\n\ncircuit.forward()\ncircuit.measure()\n\nnum_samples=10\nsamples = circuit.sample(num_samples)\n\nobservables = circuit.extract_expectation_values(samples)\n```\n\n## Slurm workload run:\n\nHere is a simple slurm example that shows how to run a simulation on 2 nodes, with multithreading.\n\n```bash\n#!/bin/bash\n\n#SBATCH --job-name=two_nodes\n#SBATCH --qos=qos_cpu-dev\n#SBATCH --ntasks=2\n#SBATCH --ntasks-per-node=1\n#SBATCH --cpus-per-task=40\n#SBATCH --output=two_nodes.listing\n#SBATCH --time=5:00\n\nmodule purge\n\nmodule load openmpi/3.1.4\nmodule load cuda/10.2\n\nsrun python3 two_nodes.py\n```\nRun `sbatch run.sh` to lounch the script\n\n## Pennylane Integration\n\nDamavand is linked to pennylane [PennyLane](https://pennylane.ai/), a library with many tools to approach qubit based\nand continuous-variable based quantum architectures.\n\nThe plugin that allows this can be found [here](https://github.com/previsionio/pennylane-damavand).\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"figures/damavand_gradient_descent.png\" width=\"400em\" /\u003e\n\u003c/p\u003e\n\nWith this plugin, one can use pennylane with the `damavand.qubit` backend.\n\n```python\ndev = qml.device(\"damavand.qubit\", wires=10, apply_method=\"gpu\")\n```\n\n## Sun rising on mount damavand\n\n![damavand-sunrise](figures/damavand_2016_sunrise.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprevisionio%2Fdamavand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprevisionio%2Fdamavand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprevisionio%2Fdamavand/lists"}