-
Notifications
You must be signed in to change notification settings - Fork 294
Adding photonics execution manager #515
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
Conversation
|
CLA Assistant Lite bot All Contributors have signed the CLA. |
|
I have read the Contributor License Agreement and I hereby accept the Terms. |
|
recheck |
runtime/cudaq/qis/managers/photonics/PhotonicsExecutionManager.cpp
Outdated
Show resolved
Hide resolved
|
Hey Omar, would the following work for you to hook into the diff --git a/runtime/cudaq/qis/managers/photonics/PhotonicsExecutionManager.cpp b/runtime/cudaq/qis/managers/photonics/PhotonicsExecutionManager.cpp
index 41eb14e..3400c46 100644
--- a/runtime/cudaq/qis/managers/photonics/PhotonicsExecutionManager.cpp
+++ b/runtime/cudaq/qis/managers/photonics/PhotonicsExecutionManager.cpp
@@ -63,9 +63,22 @@ protected:
auto sampleResult =
qpp::sample(1000000, state, ids, sampleQudits.begin()->levels);
+ cudaq::ExecutionResult counts;
for (auto [result, count] : sampleResult) {
std::cout << fmt::format("Sample {} : {}", result, count) << "\n";
+ std::stringstream bitstring;
+ for (const auto &quditRes : result) {
+ bitstring << quditRes;
+ }
+
+ // Add to the sample result
+ // in mid-circ sampling mode this will append 1 bitstring
+ counts.appendResult(bitstring.str(), count);
+ // Reset the state.
+ bitstring.str("");
+ bitstring.clear();
}
+ executionContext->result.append(counts);
}
}
diff --git a/unittests/photonics/PhotonicsTester.cpp b/unittests/photonics/PhotonicsTester.cpp
index cb4dae0..5dde414 100644
--- a/unittests/photonics/PhotonicsTester.cpp
+++ b/unittests/photonics/PhotonicsTester.cpp
@@ -37,5 +37,9 @@ TEST(PhotonicsTester, checkSimple) {
EXPECT_EQ(res[0], 1);
EXPECT_EQ(res[1], 2);
- cudaq::sample(test2{});
+ auto counts = cudaq::sample(test2{});
+
+ for (auto&[k,v]: counts) {
+ printf("Result / Count = %s : %lu\n", k.c_str(), v);
+ }
} |
runtime/cudaq/qis/managers/photonics/PhotonicsExecutionManager.cpp
Outdated
Show resolved
Hide resolved
That worked 👍 |
Solved sampling qudits
Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
Command Bot: Processing... |
Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
Command Bot: Processing... |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
Command Bot: Processing... |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
Command Bot: Processing... |
Command Bot: Processing... |
Command Bot: Processing... |
Checklist:
Description
The photonics execution manager uses qudits to model linear optical, quantum photonic circuits.
Several gates are implemented that can be used to simulate programmable time-bin interferometers.