Skip to content

Commit

Permalink
Renaming the photonic simulator target to orca-photonics (#2327)
Browse files Browse the repository at this point in the history
* * Renaming the photonic simulator target to `orca-photonics`

Signed-off-by: Pradnya Khalate <[email protected]>

* * Fix the regression test for photonics simulator target.

Signed-off-by: Pradnya Khalate <[email protected]>

---------

Signed-off-by: Pradnya Khalate <[email protected]>
  • Loading branch information
khalatepradnya authored Oct 30, 2024
1 parent 05b4410 commit 827dd32
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ if (CUSTATEVEC_ROOT AND CUDA_FOUND)
endif()
endif()

add_nvqpp_test(photonics_sim targets/cpp/photonics.cpp TARGET photonics)
add_nvqpp_test(photonics_sim targets/cpp/photonics.cpp TARGET orca-photonics)
add_nvqpp_test(SampleAsyncRemote using/cudaq/platform/sample_async_remote.cpp TARGET remote-mqpu SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/sphinx/snippets/cpp)
set_tests_properties(
nvqpp_SampleAsyncRemote
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/api/default_ops.rst
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ operations, each operating on 2 qubits.
Photonic Operations on Qudits
=============================

These operations are valid only on the `photonics` target which does not support the quantum operations above.
These operations are valid only on the `orca-photonics` target which does not support the quantum operations above.

:code:`plus`
---------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/targets/cpp/photonics.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Compile and run with:
// ```
// nvq++ --target photonics photonics.cpp
// nvq++ --target orca-photonics photonics.cpp
// ./a.out
// ```

Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/targets/cpp/photonics_tbi.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Compile and run with:
// ```
// nvq++ --target photonics photonics_tbi.cpp -o tbi.x
// nvq++ --target orca-photonics photonics_tbi.cpp -o tbi.x
// ./tbi.x
// ```

Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/targets/python/photonics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cudaq

cudaq.set_target("photonics")
cudaq.set_target("orca-photonics")


@cudaq.kernel
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/targets/python/photonics_tbi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import cudaq
import numpy as np

cudaq.set_target("photonics")
cudaq.set_target("orca-photonics")


@cudaq.kernel
Expand Down
8 changes: 4 additions & 4 deletions python/cudaq/handlers/photonics_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ def mz(qudits: PyQudit | List[PyQudit], register_name=''):
class PhotonicsHandler(object):
"""
The `PhotonicsHandler` class serves as to process CUDA-Q kernels for the
`photonics` target.
The target must be set to `photonics` prior to invoking a `PhotonicsHandler`.
`orca-photonics` target.
The target must be set to `orca-photonics` prior to invoking a `PhotonicsHandler`.
The quantum operations in this kernel apply to qudits defined by
`qudit(level=N)` or a list of qudits. The qudits within a kernel must be of
Expand All @@ -214,9 +214,9 @@ class PhotonicsHandler(object):

def __init__(self, function):

if 'photonics' != cudaq_runtime.get_target().name:
if 'orca-photonics' != cudaq_runtime.get_target().name:
raise RuntimeError(
"A photonics kernel can only be used with 'photonics' target.")
"This kernel can only be used with 'orca-photonics' target.")

QuditManager.reset()
self.kernelFunction = function
Expand Down
4 changes: 2 additions & 2 deletions python/cudaq/kernel/kernel_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,10 @@ def __call__(self, *args):
except RuntimeError:
target_name = None

if 'photonics' == target_name:
if 'orca-photonics' == target_name:
if self.kernelFunction is None:
raise RuntimeError(
"The 'photonics' target must be used with a valid function."
"The 'orca-photonics' target must be used with a valid function."
)
# NOTE: Since this handler does not support MLIR mode (yet), just
# invoke the kernel. If calling from a bound function, need to
Expand Down
2 changes: 1 addition & 1 deletion python/runtime/cudaq/algorithms/py_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ index pair.
if (holder.getTarget().name == "remote-mqpu" ||
holder.getTarget().name == "nvqc")
return pyGetStateRemote(kernel, args);
if (holder.getTarget().name == "photonics")
if (holder.getTarget().name == "orca-photonics")
return pyGetStateLibraryMode(kernel, args);
return pyGetState(kernel, args);
},
Expand Down
4 changes: 2 additions & 2 deletions python/tests/handlers/test_photonics_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@pytest.fixture(autouse=True)
def do_something():
cudaq.set_target("photonics")
cudaq.set_target("orca-photonics")
yield
cudaq.reset_target()
cudaq.__clearKernelRegistries()
Expand Down Expand Up @@ -153,7 +153,7 @@ def bell_pair():
res = cudaq.sample(bell_pair)
assert len(res) == 2 and '00' in res and '11' in res

cudaq.set_target("photonics")
cudaq.set_target("orca-photonics")
res = cudaq.sample(kernel)
assert len(res) == 1 and '1' in res

Expand Down
2 changes: 1 addition & 1 deletion python/utils/LinkedLibraryHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ void LinkedLibraryHolder::setTarget(
setQuantumPlatformInternal(platform);
currentTarget = targetName;

if ("photonics" == targetName) {
if ("orca-photonics" == targetName) {
std::filesystem::path libPath =
cudaqLibPath / fmt::format("libcudaq-em-photonics.{}", libSuffix);
auto *em = getUniquePluginInstance<ExecutionManager>(
Expand Down
2 changes: 1 addition & 1 deletion runtime/cudaq/qis/managers/photonics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ install(EXPORT cudaq-em-photonics-targets
NAMESPACE cudaq::
DESTINATION lib/cmake/cudaq)

add_target_config(photonics)
add_target_config(orca-photonics)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# the terms of the Apache License 2.0 which accompanies this distribution. #
# ============================================================================ #

name: photonics
description: "Photonics"
name: orca-photonics
description: "Photonics simulator"
config:
library-mode-execution-manager: photonics
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
# the terms of the Apache License 2.0 which accompanies this distribution. #
# ============================================================================ #

# RUN: cudaq-target-conf -o %t %cudaq_target_dir/photonics.yml && cat %t | FileCheck %s
# RUN: cudaq-target-conf -o %t %cudaq_target_dir/orca-photonics.yml && cat %t | FileCheck %s

# CHECK-DAG: LIBRARY_MODE_EXECUTION_MANAGER=photonics

0 comments on commit 827dd32

Please sign in to comment.