Sample with function pointer as input
Open
@schweitzpgi is already working on this.
Since Jul 5, 2023.
language
stale-notified
- Dominant language
- C++
- Stars
- 1.1k
- Forks
- 456
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 165
Description
__qpu__ void bar(cudaq::qubit& q) {
x(q);
}
struct baz {
__qpu__ void operator()(cudaq::qubit& q) {
x(q);
}
};
struct foo {
template <typename CallableKernel>
__qpu__ void operator()(CallableKernel &&func, int size) {
cudaq::qreg q(size);
func(q[0]);
mz(q[0]);
}
};
int main() {
// Not supported, fails
auto result = cudaq::sample(1000, foo{}, bar, 1);
}
This can be fixed with an update the sample.h to remove the extra std::forward at line 209.
But this leads to another bug with the argument being valid input to a cuda quantum kernel (error: kernel argument type not supported). The argument type is !cc.ptr<!cc.ptr<(!quake.ref) -> ()>>.
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.
Assessment
This issue has not been assessed yet.