Pasqal Cloud QRMI - Examples in Rust#
Prerequisites#
Python 3.11 or 3.12
Build the QRMI Rust library
Set environment variables#
QRMI supports Pasqal Cloud configuration via environment variables. For
Pasqal Cloud auth, QRMI also supports reading ~/.pasqal/config
(token or username/password). PASQAL_CONFIG_ROOT may point elsewhere
and takes priority over <backend_name>_PASQAL_CONFIG_ROOT; QRMI
expands ~, $VAR, and ${VAR} before appending
.pasqal/config. # pragma: allowlist secret
The required environment variables are listed below. This example
assumes that a .env file is available under the current directory.
Environment variables |
Descriptions |
|---|---|
|
Pasqal Cloud Project ID to access the QPU |
|
Pasqal Cloud Auth Token (optional when username/password are configured) |
|
(Optional) Auth endpoint URL/path
for token retrieval. Default:
|
|
Pasqal Cloud username (optional, user-provided) |
|
Pasqal Cloud password (optional, user-provided) |
~/.pasqal/config (optional)#
Create ~/.pasqal/config:
username=<your username>
password=<your password>
# or:
# token=<your token>
# or:
# client_id=<your client id>
# client_secret=<your client secret> # pragma: allowlist secret
# optional override:
# project_id=<your project id>
# auth_endpoint=<auth endpoint URL/path>
Create Pulser Sequence file as input#
Given a Pulser sequence sequence, we can convert it to a JSON string
and write it to a file like this:
1serialized_sequence = sequence.to_abstract_repr()
2
3with open("pulser_seq.json", "w") as f:
4 f.write(serialized_sequence)
How to build this example#
cargo clean
cargo build --release
How to run this example#
../target/release/qrmi-example-pasqal-cloud --help
QRMI for Pasqal Cloud - Example
Usage: qrmi-example-pasqal-cloud --backend <BACKEND> --input <INPUT>
Options:
-b, --backend <BACKEND> backend name
-i, --input <INPUT> sequence input file
-h, --help Print help
-V, --version Print version
For example:
../target/release/qrmi-example-pasqal-cloud -b FRESNEL -i input.json