Repository navigation
Open
Labels
Description
Required prerequisites
- Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.
Describe the feature
Implement cudaq::run API
template<typename T, typename … ARGS>
std::vector<T> cudaq::run(
size_t shots,
std::function<T(ARGS…)>&& kernel, ARGS…); Examples (c++)
__qpu__ bool kernel(int n) {
cudaq::qvector q(n);
x(q[0]);
return mz(q[0]);
}
int main() {
auto results = cudaq::run<bool>(/*shots=*/1000, kernel, 2);
std::cout << results << std::endl;
}Output:
[1,1, ... 1] // 1000 results
Currently we would like to support returning the following types:
bool
int
float
double
std::vector<bool> // For measurements of qvectors (const size after opts)
structs of elements above (next version)Examples (python)
@cudaq.kernel()
def kernel(n: int): bool
q = cudaq.qvector(n)
x(q[0])
return mz(q[0])
results = cudaq.run(shots=1000, kernel, 2)
print(results)Output:
[1,1, ... 1] // 1000 results
Currently we would like to support returning the following types:
bool
int
np.float32
np.float64
list[bool] // For measurements of qvectors (const size after opts)
structs of elements above (next version)Tasks
- Define log parsing API in c++ (no templates)
Idea:
struct OutputRecord {
void* ptr;
std::size_t byteSize;
};
class OutputParser {
virtual std::vector<OutputRecord> parse(std::istream& s);
};- Implement log parsing API for backends that will use logs for output (quantum devices and remote simulator)
- Implement log parsing API for backends that use memory for output (local simulators)
- will need runtime QIR functions implementation
- make sure we handle multiple and single shot scenarios
- Implement
cudaq::runAPI in c++ - Implement
cudaq.runAPI in Python - Implement retrieving logs from quantum backends (start with quantinuum)
- Implement creating and retrieving logs from remote simulator server
- Make sure quantum emulation works with new output log functionality
- run LLVM generated from QIR on the simulator (needs runtime functions implementations)
- Convert returns to log function calls in QIR
Activity
Enable `run` API (#2927)
Enable `run` API (NVIDIA#2927)