qiskit-aer-gpu


Nameqiskit-aer-gpu JSON
Version 0.14.1 PyPI version JSON
download
home_pagehttps://github.com/Qiskit/qiskit-aer
SummaryAer - High performance simulators for Qiskit
upload_time2024-04-30 05:23:24
maintainerNone
docs_urlNone
authorAER Development Team
requires_python>=3.7
licenseApache 2.0
keywords qiskit simulator quantum computing backend
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Aer - high performance quantum circuit simulation for Qiskit

[![License](https://img.shields.io/github/license/Qiskit/qiskit-aer.svg?style=popout-square)](https://opensource.org/licenses/Apache-2.0)
[![Build](https://github.com/Qiskit/qiskit-aer/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/Qiskit/qiskit-aer/actions/workflows/build.yml)
[![Tests](https://github.com/Qiskit/qiskit-aer/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/Qiskit/qiskit-aer/actions/workflows/tests.yml)
[![](https://img.shields.io/github/release/Qiskit/qiskit-aer.svg?style=popout-square)](https://github.com/Qiskit/qiskit-aer/releases)
[![](https://img.shields.io/pypi/dm/qiskit-aer.svg?style=popout-square)](https://pypi.org/project/qiskit-aer/)

**Aer** is a high performance simulator for quantum circuits written in Qiskit, that includes realistic noise models.

## Installation

We encourage installing Aer via the pip tool (a python package manager):

```bash
pip install qiskit-aer
```

Pip will handle all dependencies automatically for us, and you will always install the latest (and well-tested) version.

To install from source, follow the instructions in the [contribution guidelines](CONTRIBUTING.md).

## Installing GPU support

In order to install and run the GPU supported simulators on Linux, you need CUDA® 11.2 or newer previously installed.
CUDA® itself would require a set of specific GPU drivers. Please follow CUDA® installation procedure in the NVIDIA® [web](https://www.nvidia.com/drivers).

If you want to install our GPU supported simulators, you have to install this other package:

```bash
pip install qiskit-aer-gpu
```

The package above is for CUDA&reg 12, so if your system has CUDA® 11 installed, install separate package:
```bash
pip install qiskit-aer-gpu-cu11
```

This will overwrite your current `qiskit-aer` package installation giving you
the same functionality found in the canonical `qiskit-aer` package, plus the
ability to run the GPU supported simulators: statevector, density matrix, and unitary.

**Note**: This package is only available on x86_64 Linux. For other platforms
that have CUDA support, you will have to build from source. You can refer to
the [contributing guide](CONTRIBUTING.md#building-with-gpu-support)
for instructions on doing this.

## Simulating your first Qiskit circuit with Aer
Now that you have Aer installed, you can start simulating quantum circuits using primitives and noise models. Here is a basic example:

```
$ python
```

```python
from qiskit import transpile
from qiskit.circuit.library import RealAmplitudes
from qiskit.quantum_info import SparsePauliOp
from qiskit_aer import AerSimulator

sim = AerSimulator()
# --------------------------
# Simulating using estimator
#---------------------------
from qiskit_aer.primitives import EstimatorV2

psi1 = transpile(RealAmplitudes(num_qubits=2, reps=2), sim, optimization_level=0)
psi2 = transpile(RealAmplitudes(num_qubits=2, reps=3), sim, optimization_level=0)

H1 = SparsePauliOp.from_list([("II", 1), ("IZ", 2), ("XI", 3)])
H2 = SparsePauliOp.from_list([("IZ", 1)])
H3 = SparsePauliOp.from_list([("ZI", 1), ("ZZ", 1)])

theta1 = [0, 1, 1, 2, 3, 5]
theta2 = [0, 1, 1, 2, 3, 5, 8, 13]
theta3 = [1, 2, 3, 4, 5, 6]

estimator = EstimatorV2()

# calculate [ [<psi1(theta1)|H1|psi1(theta1)>,
#              <psi1(theta3)|H3|psi1(theta3)>],
#             [<psi2(theta2)|H2|psi2(theta2)>] ]
job = estimator.run(
    [
        (psi1, [H1, H3], [theta1, theta3]),
        (psi2, H2, theta2)
    ],
    precision=0.01
)
result = job.result()
print(f"expectation values : psi1 = {result[0].data.evs}, psi2 = {result[1].data.evs}")

# --------------------------
# Simulating using sampler
# --------------------------
from qiskit_aer.primitives import SamplerV2
from qiskit import QuantumCircuit

# create a Bell circuit
bell = QuantumCircuit(2)
bell.h(0)
bell.cx(0, 1)
bell.measure_all()

# create two parameterized circuits
pqc = RealAmplitudes(num_qubits=2, reps=2)
pqc.measure_all()
pqc = transpile(pqc, sim, optimization_level=0)
pqc2 = RealAmplitudes(num_qubits=2, reps=3)
pqc2.measure_all()
pqc2 = transpile(pqc2, sim, optimization_level=0)

theta1 = [0, 1, 1, 2, 3, 5]
theta2 = [0, 1, 2, 3, 4, 5, 6, 7]

# initialization of the sampler
sampler = SamplerV2()

# collect 128 shots from the Bell circuit
job = sampler.run([bell], shots=128)
job_result = job.result()
print(f"counts for Bell circuit : {job_result[0].data.meas.get_counts()}")
 
# run a sampler job on the parameterized circuits
job2 = sampler.run([(pqc, theta1), (pqc2, theta2)])
job_result = job2.result()
print(f"counts for parameterized circuit : {job_result[0].data.meas.get_counts()}")

# --------------------------------------------------
# Simulating with noise model from actual hardware
# --------------------------------------------------
from qiskit_ibm_runtime import QiskitRuntimeService
provider = QiskitRuntimeService(channel='ibm_quantum', token="set your own token here")
backend = provider.get_backend("ibm_kyoto")

# create sampler from the actual backend
sampler.from_backend(backend)

# run a sampler job on the parameterized circuits with noise model of the actual hardware
job3 = sampler.run([(pqc, theta1), (pqc2, theta2)])
job_result = job3.result()
print(f"Parameterized for Bell circuit w/noise: {job_result[0].data.meas.get_counts()}")

```

## Contribution Guidelines

If you'd like to contribute to Aer, please take a look at our
[contribution guidelines](CONTRIBUTING.md). This project adheres to Qiskit's [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.

We use [GitHub issues](https://github.com/Qiskit/qiskit-aer/issues) for tracking requests and bugs. Please use our [slack](https://qiskit.slack.com) for discussion and simple questions. To join our Slack community use the [link](https://qiskit.slack.com/join/shared_invite/zt-fybmq791-hYRopcSH6YetxycNPXgv~A#/). For questions that are more suited for a forum, we use the Qiskit tag in the [Stack Exchange](https://quantumcomputing.stackexchange.com/questions/tagged/qiskit).

## Next Steps

Now you're set up and ready to check out some of the other examples from the [Aer documentation](https://qiskit.github.io/qiskit-aer/).

## Authors and Citation

Aer is the work of [many people](https://github.com/Qiskit/qiskit-aer/graphs/contributors) who contribute to the project at different levels.
If you use Qiskit, please cite as per the included [BibTeX file](https://github.com/Qiskit/qiskit/blob/main/CITATION.bib).

## License

[Apache License 2.0](LICENSE.txt)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Qiskit/qiskit-aer",
    "name": "qiskit-aer-gpu",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "qiskit, simulator, quantum computing, backend",
    "author": "AER Development Team",
    "author_email": "qiskit@us.ibm.com",
    "download_url": null,
    "platform": null,
    "description": "# Aer - high performance quantum circuit simulation for Qiskit\n\n[![License](https://img.shields.io/github/license/Qiskit/qiskit-aer.svg?style=popout-square)](https://opensource.org/licenses/Apache-2.0)\n[![Build](https://github.com/Qiskit/qiskit-aer/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/Qiskit/qiskit-aer/actions/workflows/build.yml)\n[![Tests](https://github.com/Qiskit/qiskit-aer/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/Qiskit/qiskit-aer/actions/workflows/tests.yml)\n[![](https://img.shields.io/github/release/Qiskit/qiskit-aer.svg?style=popout-square)](https://github.com/Qiskit/qiskit-aer/releases)\n[![](https://img.shields.io/pypi/dm/qiskit-aer.svg?style=popout-square)](https://pypi.org/project/qiskit-aer/)\n\n**Aer** is a high performance simulator for quantum circuits written in Qiskit, that includes realistic noise models.\n\n## Installation\n\nWe encourage installing Aer via the pip tool (a python package manager):\n\n```bash\npip install qiskit-aer\n```\n\nPip will handle all dependencies automatically for us, and you will always install the latest (and well-tested) version.\n\nTo install from source, follow the instructions in the [contribution guidelines](CONTRIBUTING.md).\n\n## Installing GPU support\n\nIn order to install and run the GPU supported simulators on Linux, you need CUDA&reg; 11.2 or newer previously installed.\nCUDA&reg; itself would require a set of specific GPU drivers. Please follow CUDA&reg; installation procedure in the NVIDIA&reg; [web](https://www.nvidia.com/drivers).\n\nIf you want to install our GPU supported simulators, you have to install this other package:\n\n```bash\npip install qiskit-aer-gpu\n```\n\nThe package above is for CUDA&reg 12, so if your system has CUDA&reg; 11 installed, install separate package:\n```bash\npip install qiskit-aer-gpu-cu11\n```\n\nThis will overwrite your current `qiskit-aer` package installation giving you\nthe same functionality found in the canonical `qiskit-aer` package, plus the\nability to run the GPU supported simulators: statevector, density matrix, and unitary.\n\n**Note**: This package is only available on x86_64 Linux. For other platforms\nthat have CUDA support, you will have to build from source. You can refer to\nthe [contributing guide](CONTRIBUTING.md#building-with-gpu-support)\nfor instructions on doing this.\n\n## Simulating your first Qiskit circuit with Aer\nNow that you have Aer installed, you can start simulating quantum circuits using primitives and noise models. Here is a basic example:\n\n```\n$ python\n```\n\n```python\nfrom qiskit import transpile\nfrom qiskit.circuit.library import RealAmplitudes\nfrom qiskit.quantum_info import SparsePauliOp\nfrom qiskit_aer import AerSimulator\n\nsim = AerSimulator()\n# --------------------------\n# Simulating using estimator\n#---------------------------\nfrom qiskit_aer.primitives import EstimatorV2\n\npsi1 = transpile(RealAmplitudes(num_qubits=2, reps=2), sim, optimization_level=0)\npsi2 = transpile(RealAmplitudes(num_qubits=2, reps=3), sim, optimization_level=0)\n\nH1 = SparsePauliOp.from_list([(\"II\", 1), (\"IZ\", 2), (\"XI\", 3)])\nH2 = SparsePauliOp.from_list([(\"IZ\", 1)])\nH3 = SparsePauliOp.from_list([(\"ZI\", 1), (\"ZZ\", 1)])\n\ntheta1 = [0, 1, 1, 2, 3, 5]\ntheta2 = [0, 1, 1, 2, 3, 5, 8, 13]\ntheta3 = [1, 2, 3, 4, 5, 6]\n\nestimator = EstimatorV2()\n\n# calculate [ [<psi1(theta1)|H1|psi1(theta1)>,\n#              <psi1(theta3)|H3|psi1(theta3)>],\n#             [<psi2(theta2)|H2|psi2(theta2)>] ]\njob = estimator.run(\n    [\n        (psi1, [H1, H3], [theta1, theta3]),\n        (psi2, H2, theta2)\n    ],\n    precision=0.01\n)\nresult = job.result()\nprint(f\"expectation values : psi1 = {result[0].data.evs}, psi2 = {result[1].data.evs}\")\n\n# --------------------------\n# Simulating using sampler\n# --------------------------\nfrom qiskit_aer.primitives import SamplerV2\nfrom qiskit import QuantumCircuit\n\n# create a Bell circuit\nbell = QuantumCircuit(2)\nbell.h(0)\nbell.cx(0, 1)\nbell.measure_all()\n\n# create two parameterized circuits\npqc = RealAmplitudes(num_qubits=2, reps=2)\npqc.measure_all()\npqc = transpile(pqc, sim, optimization_level=0)\npqc2 = RealAmplitudes(num_qubits=2, reps=3)\npqc2.measure_all()\npqc2 = transpile(pqc2, sim, optimization_level=0)\n\ntheta1 = [0, 1, 1, 2, 3, 5]\ntheta2 = [0, 1, 2, 3, 4, 5, 6, 7]\n\n# initialization of the sampler\nsampler = SamplerV2()\n\n# collect 128 shots from the Bell circuit\njob = sampler.run([bell], shots=128)\njob_result = job.result()\nprint(f\"counts for Bell circuit : {job_result[0].data.meas.get_counts()}\")\n \n# run a sampler job on the parameterized circuits\njob2 = sampler.run([(pqc, theta1), (pqc2, theta2)])\njob_result = job2.result()\nprint(f\"counts for parameterized circuit : {job_result[0].data.meas.get_counts()}\")\n\n# --------------------------------------------------\n# Simulating with noise model from actual hardware\n# --------------------------------------------------\nfrom qiskit_ibm_runtime import QiskitRuntimeService\nprovider = QiskitRuntimeService(channel='ibm_quantum', token=\"set your own token here\")\nbackend = provider.get_backend(\"ibm_kyoto\")\n\n# create sampler from the actual backend\nsampler.from_backend(backend)\n\n# run a sampler job on the parameterized circuits with noise model of the actual hardware\njob3 = sampler.run([(pqc, theta1), (pqc2, theta2)])\njob_result = job3.result()\nprint(f\"Parameterized for Bell circuit w/noise: {job_result[0].data.meas.get_counts()}\")\n\n```\n\n## Contribution Guidelines\n\nIf you'd like to contribute to Aer, please take a look at our\n[contribution guidelines](CONTRIBUTING.md). This project adheres to Qiskit's [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.\n\nWe use [GitHub issues](https://github.com/Qiskit/qiskit-aer/issues) for tracking requests and bugs. Please use our [slack](https://qiskit.slack.com) for discussion and simple questions. To join our Slack community use the [link](https://qiskit.slack.com/join/shared_invite/zt-fybmq791-hYRopcSH6YetxycNPXgv~A#/). For questions that are more suited for a forum, we use the Qiskit tag in the [Stack Exchange](https://quantumcomputing.stackexchange.com/questions/tagged/qiskit).\n\n## Next Steps\n\nNow you're set up and ready to check out some of the other examples from the [Aer documentation](https://qiskit.github.io/qiskit-aer/).\n\n## Authors and Citation\n\nAer is the work of [many people](https://github.com/Qiskit/qiskit-aer/graphs/contributors) who contribute to the project at different levels.\nIf you use Qiskit, please cite as per the included [BibTeX file](https://github.com/Qiskit/qiskit/blob/main/CITATION.bib).\n\n## License\n\n[Apache License 2.0](LICENSE.txt)\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Aer - High performance simulators for Qiskit",
    "version": "0.14.1",
    "project_urls": {
        "Homepage": "https://github.com/Qiskit/qiskit-aer"
    },
    "split_keywords": [
        "qiskit",
        " simulator",
        " quantum computing",
        " backend"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8fc3a3145aec735bf78542e9af9522c75762188ab7e22b4d6deed1ace30a59fe",
                "md5": "eece273b72842c3cb20da1939e57ea95",
                "sha256": "68d345b60ce7829ac55f0f84ffff9dd6d0722cee12bcf6f1375d9d45b8aa67e6"
            },
            "downloads": -1,
            "filename": "qiskit_aer_gpu-0.14.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "eece273b72842c3cb20da1939e57ea95",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 18816883,
            "upload_time": "2024-04-30T05:23:24",
            "upload_time_iso_8601": "2024-04-30T05:23:24.231920Z",
            "url": "https://files.pythonhosted.org/packages/8f/c3/a3145aec735bf78542e9af9522c75762188ab7e22b4d6deed1ace30a59fe/qiskit_aer_gpu-0.14.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5981cbc11629356a2f3fd441051562080b0c7e097ce270fa0df90268dc505f7c",
                "md5": "4e54c3b3f5f8a7a221578f19fac32574",
                "sha256": "0c28f99936bca96f58d31a2fc2e618bb97c41738cfea8ebbbbd3705ade1070ef"
            },
            "downloads": -1,
            "filename": "qiskit_aer_gpu-0.14.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "4e54c3b3f5f8a7a221578f19fac32574",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.7",
            "size": 18811672,
            "upload_time": "2024-04-30T05:23:27",
            "upload_time_iso_8601": "2024-04-30T05:23:27.151460Z",
            "url": "https://files.pythonhosted.org/packages/59/81/cbc11629356a2f3fd441051562080b0c7e097ce270fa0df90268dc505f7c/qiskit_aer_gpu-0.14.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a077b44d05dec0ab381e5aba371785cb20535886048d28cc4ba2dd10782ab3cd",
                "md5": "a22c340935da1462b6c9cdf6718d857c",
                "sha256": "6c42acf653144bd6b020a131b3a86f53abf27c5de49336d47250281fa205521c"
            },
            "downloads": -1,
            "filename": "qiskit_aer_gpu-0.14.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "a22c340935da1462b6c9cdf6718d857c",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 18811199,
            "upload_time": "2024-04-30T05:23:30",
            "upload_time_iso_8601": "2024-04-30T05:23:30.329153Z",
            "url": "https://files.pythonhosted.org/packages/a0/77/b44d05dec0ab381e5aba371785cb20535886048d28cc4ba2dd10782ab3cd/qiskit_aer_gpu-0.14.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e3cabe8a320a8e06eadcfd04cb0b93b54563b47d8f0b0bb3d03b3a060a9857e2",
                "md5": "3735e7129a0463d7fffc77a92c2b3789",
                "sha256": "d60f873a58f6089971d06a1a1b0cfb606e664caaf03efe30fa6bb164f216487a"
            },
            "downloads": -1,
            "filename": "qiskit_aer_gpu-0.14.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "3735e7129a0463d7fffc77a92c2b3789",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.7",
            "size": 18816264,
            "upload_time": "2024-04-30T05:23:33",
            "upload_time_iso_8601": "2024-04-30T05:23:33.300090Z",
            "url": "https://files.pythonhosted.org/packages/e3/ca/be8a320a8e06eadcfd04cb0b93b54563b47d8f0b0bb3d03b3a060a9857e2/qiskit_aer_gpu-0.14.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1312d26fce513c16ab16cfee5f87792e50d54ad1f399bcf2a0a41eca541a7cde",
                "md5": "7388c3c8ac22408418a122811f022719",
                "sha256": "4842712292cb75df15770c750da7d8e37ea290746a74ceb50e1537ad0a1ee264"
            },
            "downloads": -1,
            "filename": "qiskit_aer_gpu-0.14.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "7388c3c8ac22408418a122811f022719",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.7",
            "size": 18815943,
            "upload_time": "2024-04-30T05:23:35",
            "upload_time_iso_8601": "2024-04-30T05:23:35.825052Z",
            "url": "https://files.pythonhosted.org/packages/13/12/d26fce513c16ab16cfee5f87792e50d54ad1f399bcf2a0a41eca541a7cde/qiskit_aer_gpu-0.14.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-30 05:23:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Qiskit",
    "github_project": "qiskit-aer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "qiskit-aer-gpu"
}
        
Elapsed time: 0.27416s