CUDA C++ でテンプレート カーネルを協調カーネルとして起動しようとして失敗しました。何が間違っていますか?
エラー
Error cannot determine which instance of function template "boolPrepareKernel" is intended
以下のようにカーネルを呼び出そうとします
ForBoolKernelArgs<int> fbArgs = ...;
int device = 0;
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, device);
cudaLaunchCooperativeKernel((void*)boolPrepareKernel, deviceProp.multiProcessorCount, fFArgs.threads, fbArgs) ;
カーネルは次のように定義されます
template <typename TYO>
__global__ void boolPrepareKernel(ForBoolKernelArgs<TYO> fbArgs) {
...
}
次のように(この例ではintを使用して)起動をパラメータ化しようとしました
cudaLaunchCooperativeKernel((void*)(<int>boolPrepareKernel), deviceProp.multiProcessorCount, fFArgs.threads, fbArgs) ;
しかし、私はエラーが発生します
no instance of overloaded function matches the argument list argument types are: (<error-type>, int, dim3, ForBoolKernelArgs<int>)
推奨ケースについて
cudaLaunchCooperativeKernel((void*)(boolPrepareKernel<int>), deviceProp.multiProcessorCount, fFArgs.threads, fbArgs)
私のエラーは
no instance of overloaded function matches the argument list argument types are: (void *, int, dim3, ForBoolKernelArgs<int>)
これはおそらく簡単ですが、行き詰まっています-助けてくれてありがとう!!
参照用のカーネルの起動
boolPrepareKernel << <fFArgs.blocks, fFArgs.threads >> > (fbArgs);
動作しますが、もちろんグリッド同期は利用できません。