Returning vectors from cudaq.run does not work on remote simulator
Open
Nobody has claimed this yet.
stale-notified
- Dominant language
- C++
- Stars
- 1.1k
- Forks
- 456
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 165
Description
Required prerequisites
- Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
- If possible, make a PR with a failing test to give us a starting point to work on!
Describe the bug
The following code fails to run on remote simulator (see example in https://github.com/NVIDIA/cuda-quantum/issues/2964 for similar python code that fails on remote sim as well)
Steps to reproduce the bug
#include <cudaq.h>
struct K9 {
std::vector<bool> operator()() __qpu__ {
cudaq::qvector q(5);
x(q);
return mz(q);
}
};
int main() {
auto syndromes = cudaq::run(10, K9{});
for (auto &s : syndromes) {
for (auto ss : s)
printf("%d ", (int)ss);
printf("\n");
}
}
Command:
nvq++ -fenable-cudaq-run --target quantinuum --emulate file.cpp
Result:
loses the malloc function declaration in the remote rest JIT pipeline
loc(callsite("-":4:10 at "run.cpp":7:5)): error: 'func.call' op 'malloc' does not reference a valid function
terminate called after throwing an instance of 'std::runtime_error'
what(): Could not successfully apply quake-synth.
Aborted (core dumped)
### Expected behavior
Runs successfully
### Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
### Environment
- **CUDA-Q version**:
- **Python version**:
- **C++ compiler**:
- **Operating system**:
### Suggestions
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing file.cpp with nvq++ -fenable-cudaq-run --target quantinuum --emulate file.cpp, focusing on cudaq::run and the remote JIT pipeline. Trace the reported malloc failure through quake-synth; done means the vector-returning example runs successfully on the remote simulator and prints the returned syndromes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100