Templated member functions with nvcc calls fails at compile time
I want to convert a serial C++ code to a thrust powered version. Currently
the code is structured with policy classes that implements different
operations like memory allocation and reductions etc. We want to create a
new policy class that calls thrust functions like transform and reduce.
As it is currently structured, the client class inherits the policy
classes and call their methods, some of which are templated.
I believe I have written code that should compile for the thrust enabled
policy class. But I get the "type name is not defined" error on all lines
that I called the templated member function.
I am compiling with nvcc using the -x cu flag because the classes are
inherited. Does nvcc not support templated member functions? What would be
a workaround for this problem?
Here is a line where it gives such error:
Classes=this->template malloc<Int,Int_1d>(Num_Positions);
malloc is defined this way:
template <typename S, typename S_1d>
S_1d malloc (const size_t sz)
{
return S_1d(sz);
};
where S_1d is just thrust::device_vector<int>
Obviously the code would compile and run fine with our old policy classes
and g++/clang++.
Thank you very much.
No comments:
Post a Comment