Can global function be member of a class?
The CUDA programming guide only says (section D.2.5.2) that global functions cannot be static members. However, when I try non-static global function, I get “illegal combination of memory qualifiers” error (CUDA 4.0 RC2).
class A
{
public:
__global__ void ker(int n, float* a, float* b);
};
__global__
void A::ker(int n, float* a, float* b)
{
int t = blockIdx.x * blockDim.x + threadIdx.x;
if ( t < n ) a[t] += b[t];
}