I want to do the following:
#include <thrust/tuple.h>
#include <tuple>
template<typename... Args>
void someFunction(void (*fp)(Args...), thrust::tuple<Args...> params) {
}
void otherFunction(int n) {
}
int main(int argc, char **argv) {
//// template argument deduction/substitution failed ////
someFunction<int>(&otherFunction, thrust::make_tuple(1));
return 0;
}
What I have tried:
- Removing one of the two parameter leads to a working solution of course.
- It works when I make
someFunction
a static function in astruct
with template parameter. But in the original codesomeFunction
is a CUDA kernel, so I can't do that. Any further ideas? - It works when I change thrust::tuple to std::tuple. Is there a way to construct a thrust::tuple out of a std::tuple?
EDIT:
To make it clearer: someFunction
and otherFunction
are __global__
!
#include <thrust/tuple.h>
#include <tuple>
template<typename... Args>
__global__ void someFunction(void (*fp)(Args...), thrust::tuple<Args...> params) {
}
__global__ void otherFunction(int n) {
}
__constant__ void (*kfp)(int) = &otherFunction;
int testPassMain(int argc, char **argv) {
void (*h_kfp)(int);
cudaMemcpyFromSymbol(&h_kfp, kfp, sizeof(void *), 0, cudaMemcpyDeviceToHost);
someFunction<int><<<1,1>>>(h_kfp, thrust::make_tuple(1));
return 0;
}
I get a compiler error: template argument deduction/substitution failed
in both examples.
Aucun commentaire:
Enregistrer un commentaire