Skip to content

Commit

Permalink
Sketch the implementation of runTheKernel.
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
  • Loading branch information
schweitzpgi committed Jan 31, 2025
1 parent d53ced2 commit 833c3cf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions runtime/cudaq/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ add_library(${LIBRARY_NAME}
SHARED cudaq.cpp
target_control.cpp
algorithms/draw.cpp
algorithms/run.cpp
platform/quantum_platform.cpp
qis/execution_manager_c_api.cpp
qis/execution_manager.cpp
Expand Down
28 changes: 28 additions & 0 deletions runtime/cudaq/algorithms/run.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*******************************************************************************
* 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. *
******************************************************************************/

#include "cudaq/algorithms/run.h"
#include "common/ExecutionContext.h"
#include "cudaq/simulators.h"
#include "nvqir/CircuitSimulator.h"

cudaq::details::RunResultSpan cudaq::details::runTheKernel(
std::function<void()> &&kernel, quantum_platform &platform,
const std::string &kernel_name, std::size_t shots) {
// 1. Clear the outputLog.
auto *circuitSimulator = nvqir::getCircuitSimulatorInternal();
auto *currentContext = circuitSimulator->getExecutionContext();
currentContext->outputLog.clear();

// 2. Launch the kernel on the QPU.
// 3. Pass the outputLog to the decoder (target-specific?)
// 4. Get the buffer and length of buffer (in bytes) from the decoder.
// 5. Clear the outputLog (?)
// 6. Pass the span back as a RunResultSpan.
return {nullptr, 0};
}

0 comments on commit 833c3cf

Please sign in to comment.