Pasqal Cloud QRMI - Examples in C#


Prerequisites#

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

<backend_name>_QRMI_PASQAL_CLOUD_PROJECT_ID

Pasqal Cloud Project ID to access the QPU

<backend_name>_QRMI_PASQAL_CLOUD_AUTH_TOKEN

Pasqal Cloud Auth Token (optional when username/password are configured)

<backend_name>_QRMI_PASQAL_CLOUD_AUTH_ENDPOINT

(Optional) Auth endpoint URL/path for token retrieval. Default: authenticate.pasqal.cloud/oauth/token

PASQAL_USERNAME

Pasqal Cloud username (optional, user-provided)

PASQAL_PASSWORD

Pasqal Cloud password (optional, user-provided)

~/.pasqal/config (optional)#

Create ~/.pasqal/config:

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#

mkdir build
cd build
cmake ..
make

How to run this example#

./build/pasqal-cloud
pasqal-cloud <backend_name> <input file>

For example,

./build/pasqal-cloud FRESNEL input.json