Skip to content

Commit

Permalink
[fix] [quera] Follow-up to PR#2528 which unintentionally broke the Py…
Browse files Browse the repository at this point in the history
…thon support (#2555)

* Restore the server helper library target.
* Also, remove the redundant code for mock qpu which was not being used.

Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
  • Loading branch information
khalatepradnya authored Jan 29, 2025
1 parent 4711146 commit c890e46
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 175 deletions.
30 changes: 5 additions & 25 deletions python/tests/backends/test_QuEra.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,17 @@
from cudaq.operator import *
import json
import numpy as np
import os
import pytest
from multiprocessing import Process
from network_utils import check_server_connection

try:
from utils.mock_qpu.quera import startServer
except:
print("Mock qpu not available, skipping QuEra tests.")
pytest.skip("Mock qpu not available.", allow_module_level=True)

# Define the port for the mock server
port = 62444


@pytest.fixture(scope="session", autouse=True)
def startUpMockServer():
# NOTE: Credentials can be set with AWS CLI
cudaq.set_target('quera')
# Launch the Mock Server
p = Process(target=startServer, args=(port,))
p.start()
if not check_server_connection(port):
p.terminate()
pytest.exit("Mock server did not start in time, skipping tests.",
returncode=1)
def do_something():
cudaq.set_target("quera")
yield "Running the tests."
p.terminate()
cudaq.reset_target()


@pytest.mark.skip(reason="Amazon Braket credentials required")
@pytest.mark.skip(reason="Amazon Braket must be installed")
def test_JSON_payload():
'''
Test based on https://docs.aws.amazon.com/braket/latest/developerguide/braket-quera-submitting-analog-program-aquila.html
Expand Down Expand Up @@ -88,7 +68,7 @@ def test_JSON_payload():
json.dumps(input))


@pytest.mark.skip(reason="Braket credentials required")
@pytest.mark.skip(reason="Amazon Braket credentials required")
def test_ahs_hello():
'''
Test based on
Expand Down
9 changes: 9 additions & 0 deletions runtime/cudaq/platform/quera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ target_link_libraries(${LIBRARY_NAME}
install(TARGETS ${LIBRARY_NAME} DESTINATION lib)

add_target_config(quera)

add_library(cudaq-serverhelper-quera SHARED QuEraExecutor.cpp QuEraServerHelper.cpp)
target_link_libraries(cudaq-serverhelper-quera
PUBLIC
cudaq-serverhelper-braket
cudaq-common
fmt::fmt-header-only
)
install(TARGETS cudaq-serverhelper-quera DESTINATION lib)
1 change: 0 additions & 1 deletion utils/mock_qpu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@
from .ionq import *
from .iqm import *
from .quantinuum import *
from .quera import *
149 changes: 0 additions & 149 deletions utils/mock_qpu/quera/__init__.py

This file was deleted.

0 comments on commit c890e46

Please sign in to comment.