JoeTaicoon
JoeTaicoon

Reputation: 1567

C++ class with private global kernel methods

In relation to another problem I was experiencing with linking and multiple defined functions, I wanted to simply wrap my cuda code in a singleton class.

Something along

class Singleton{
public:
  __host__ void doSomething();
private:
  __global__ void someKernel();
};

That apparently only device methods may be used and the above gives "invalid combination of memory qualifiers". I would like to wrap my code in a class to get more structured code, but if I need to place every kernel externally, it makes little sense.

The same question has been posed previously on nvidias site, but without an answer http://forums.nvidia.com/index.php?showtopic=176623

I too understand the problem with the this pointer, but even a static method cannot be global.

Upvotes: 3

Views: 1974

Answers (1)

Vlad
Vlad

Reputation: 18633

If you want calling code to look more organized, you could probably call your kernel from a method, if it helps.

Upvotes: 1

Related Questions