In CUDA4.x I used to call
cudaError_t cudaFuncGetAttributes ( struct cudaFuncAttributes * attr, T * entry )
with the actual name of the kernel function:
std::size_t get_kernel_workitems ( std::string const& kernel_name )
{
//…
cudaFuncAttributes kernel_attribs;
cudaError_t err = cudaFuncGetAttributes ( &kernel_attribs, kernel_name.c_str() );
//…
}
This worked well until CUDA5. Now the cudaFuncGetAttributes return cudaInvalidDeviceFunction. Although nothing changed from the implementation that worked with CUDA4. So I changed my implementation so that I directly use the function pointer instead of the kernel name and it works again:
template
inline std::size_t get_kernel_workitems ( function_type kernel )
{
//…
cudaFuncAttributes kernel_attribs;
cudaError_t err = cudaFuncGetAttributes ( &kernel_attribs, kernel );
//…
}
Has anyone had the same problem? This maybe a bug in CUDA5…