-
Notifications
You must be signed in to change notification settings - Fork 349
Add Pasqal target #2632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add Pasqal target #2632
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
8d323f2
initial work
awennersteen d95b08e
Merge pull request #1 from awennersteen/aw/initial-work
awennersteen f35782c
Orginazing Pasqal files (#3)
kaosmicadei fb77b36
Fix constant values
kaosmicadei 451c414
Helper methods implementation (#4)
kaosmicadei cb78788
fix field name on payload
kaosmicadei 734dad9
fix `createJob` path
kaosmicadei f88d67f
Merge branch 'main' into km/sync
kaosmicadei f23e891
Merge pull request #5 from awennersteen/km/sync
awennersteen 9665a97
begin docs
awennersteen 43049b1
Merge remote-tracking branch 'refs/remotes/origin/main'
awennersteen 1189b09
Merge pull request #7 from awennersteen/aw/sync-upstreams
awennersteen 48eb189
Add PasqalTester
kaosmicadei e320af0
[hotfix] Pasqal `constructGetJobPath`
kaosmicadei 0e36977
Review on Pasqal files (#10)
kaosmicadei 0b7051a
Merge pull request #6 from awennersteen/aw/docs
awennersteen 08ff585
Merge branch 'NVIDIA:main' into main
awennersteen 1b6df18
DCO Remediation Commit for Aleksander Wennersteen <aleksander.wenners…
awennersteen 2c1e2b5
DCO Remediation Commit for Kaonan Micadei <k.micadei@gmail.com>
kaosmicadei 25e1f35
DCO Remediation Commit for Kaonan Micadei <k.micadei@gmail.com>
kaosmicadei 04efb12
DCO Remediation Commit for Kaonan Micadei <kaosmicadei@users.noreply.…
kaosmicadei 2db5014
DCO Remediation Commit for Kaonan Micadei <k.micadei@gmail.com>
kaosmicadei 37b0c76
Update PasqalServerHelper.cpp
kaosmicadei 9a1f0d8
Minor edits on docs
awennersteen 4d110be
Merge remote-tracking branch 'refs/remotes/origin/main'
awennersteen 12c2851
[fix] Pasqal payload format
kaosmicadei 03c9558
Fix issues preventing correct execution and update example
awennersteen 6bb84fd
Apply basic CR
awennersteen 6faceb9
target opt-out
kaosmicadei 2d237d1
* Test behavior from C++ frontend when using `pasqal` target
khalatepradnya c915625
Fix code to use new results json structure
awennersteen 02f8a93
Merge pull request #12 from khalatepradnya/c++_test_pasqal
awennersteen 15a0d8b
Apply yapf formatting to Python
awennersteen 3b0fc0c
Fix docs rendering
awennersteen fdcfab5
Integration test
awennersteen 3a3dcd3
Fix integration test - missing dependency
awennersteen 8596a75
Fix behaviour when job fails; fix constant in doc example
kaosmicadei c72f044
fix spell check
awennersteen 7065bd3
* Update example to show how to target QPU
khalatepradnya 5a06910
Merge pull request #14 from khalatepradnya/pasqal-updates
awennersteen 0ef2db6
Update docs and remove todo
awennersteen a3a9b15
results now in big-endian
kaosmicadei 84db999
Merge branch 'main' into main
khalatepradnya 491c1bb
* Updated logo
khalatepradnya d4ec9f5
Merge pull request #15 from khalatepradnya/new-logo
awennersteen 6ff4bfa
Merge branch 'main' into main
khalatepradnya 882d7a5
Merge branch 'main' into main
khalatepradnya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,7 @@ OpenSUSE | |
| Ou | ||
| POSIX | ||
| PSIRT | ||
| Pasqal | ||
| Pauli | ||
| Paulis | ||
| Photonic | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import cudaq | ||
| from cudaq.operator import * | ||
|
|
||
| # This example illustrates how to use Pasqal's EMU_MPS emulator over Pasqal's cloud via CUDA-Q. | ||
|
|
||
| # To obtain the authentication token we recommend logging in | ||
| # by using Pasqal's Python SDK. | ||
| # Fill in the username and password via the environment variables. | ||
| # The password can be left empty in an interactive session to be | ||
| # prompted to enter the it securely via the command line interface. | ||
| # | ||
| # Contact Pasqal at help@pasqal.com or through https://community.pasqal.com for assistance. | ||
| # | ||
| # See our general docs https://docs.pasqal.com/cloud/set-up/ | ||
| # to see how to get this setup, or the CUDA-Q documentation at | ||
| # https://nvidia.github.io/cuda-quantum/latest/using/backends/hardware/neutralatom.html#pasqal | ||
| from pasqal_cloud import SDK | ||
| import os | ||
|
|
||
| sdk = SDK( | ||
| username=os.environ.get("PASQAL_USERNAME"), | ||
| password=os.environ.get("PASQAL_PASSWORD", None), | ||
khalatepradnya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ) | ||
| token = sdk._client.authenticator.token_provider.get_token() | ||
|
|
||
| os.environ["PASQAL_AUTH_TOKEN"] = str(token) | ||
|
|
||
| cudaq.set_target("pasqal", | ||
| machine=os.environ.get("PASQAL_MACHINE_TARGET", "EMU_MPS")) | ||
khalatepradnya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # ``` | ||
| # cudaq.set_target("pasqal", machine="FRESNEL") ## To target QPU | ||
khalatepradnya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # ``` | ||
|
|
||
| # Define the 2-dimensional atom arrangement | ||
| a = 5e-6 | ||
| register = [(a, 0), (2 * a, 0), (3 * a, 0)] | ||
| time_ramp = 0.000001 | ||
| time_max = 0.000003 | ||
| # Times for the piece-wise linear waveforms | ||
| steps = [0.0, time_ramp, time_max - time_ramp, time_max] | ||
| schedule = Schedule(steps, ["t"]) | ||
| # Rabi frequencies at each step | ||
| omega_max = 1000000 | ||
| delta_end = 1000000 | ||
| delta_start = 0.0 | ||
| omega = ScalarOperator(lambda t: omega_max if time_ramp < t < time_max else 0.0) | ||
| # Global phase at each step | ||
| phi = ScalarOperator.const(0.0) | ||
| # Global detuning at each step | ||
| delta = ScalarOperator(lambda t: delta_end | ||
| if time_ramp < t < time_max else delta_start) | ||
|
|
||
| async_result = evolve_async(RydbergHamiltonian(atom_sites=register, | ||
| amplitude=omega, | ||
| phase=phi, | ||
| delta_global=delta), | ||
| schedule=schedule, | ||
| shots_count=100).get() | ||
| async_result.dump() | ||
|
|
||
| ## Sample result | ||
| # ``` | ||
| # {'001': 16, '010': 23, '100': 19, '000': 42} | ||
| # ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # ============================================================================ # | ||
| # Copyright (c) 2022 - 2025 NVIDIA Corporation & Affiliates. # | ||
| # All rights reserved. # | ||
| # # | ||
| # This source code and the accompanying materials are made available under # | ||
| # the terms of the Apache License 2.0 which accompanies this distribution. # | ||
| # ============================================================================ # | ||
|
|
||
| import cudaq | ||
| from cudaq.operator import * | ||
| import json | ||
| import os | ||
| import pytest | ||
|
|
||
| skipIfPasqalNotInstalled = pytest.mark.skipif( | ||
| not (cudaq.has_target("pasqal")), | ||
| reason='Could not find `pasqal` in installation') | ||
|
|
||
|
|
||
| @pytest.fixture(scope="session", autouse=True) | ||
| def do_something(): | ||
| # NOTE: Credentials can be set with environment variables | ||
| cudaq.set_target("pasqal") | ||
| yield "Running the tests." | ||
| cudaq.reset_target() | ||
|
|
||
|
|
||
| @skipIfPasqalNotInstalled | ||
| def test_JSON_payload(): | ||
awennersteen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| input = { | ||
| "setup": { | ||
| "ahs_register": { | ||
| "sites": [[0, 0], [0, 0.000004], [0.000004, 0]], | ||
| "filling": [1, 1, 1] | ||
| } | ||
| }, | ||
| "hamiltonian": { | ||
| "drivingFields": [{ | ||
| "amplitude": { | ||
| "time_series": { | ||
| "values": [0, 15700000, 15700000, 0], | ||
| "times": [0, 0.000001, 0.000002, 0.000003] | ||
| }, | ||
| "pattern": "uniform" | ||
| }, | ||
| "phase": { | ||
| "time_series": { | ||
| "values": [0, 0], | ||
| "times": [0, 0.000003] | ||
| }, | ||
| "pattern": "uniform" | ||
| }, | ||
| "detuning": { | ||
| "time_series": { | ||
| "values": [-54000000, 54000000], | ||
| "times": [0, 0.000003] | ||
| }, | ||
| "pattern": "uniform" | ||
| } | ||
| }], | ||
| "localDetuning": [] | ||
| } | ||
| } | ||
| # NOTE: For internal testing only, not user-level API; this does not return results | ||
| cudaq.cudaq_runtime.pyAltLaunchAnalogKernel("__analog_hamiltonian_kernel__", | ||
| json.dumps(input)) | ||
|
|
||
|
|
||
| # leave for gdb debugging | ||
| if __name__ == "__main__": | ||
| loc = os.path.abspath(__file__) | ||
| pytest.main([loc, "-rP"]) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.