Saturday, November 24, 2018

c++ - Visual studio 2010, project linking with cuda files

I hope I have a simple problem, but I could not solve it during this day, so I ask for your help.




So, I`m building CUDA project in Visual studio 2010, using CUDA toolkit.



My project contains several files, and the three most important are:



//tvector_traits_kernel.cu

//contains two fuctions, the first is cuda kernel, and the second is it`s wrapper, to call it in .cpp files

template < typename _T >

__ global __ void DaxpyKernel(lint64 _m, lint64 _na, lint64 _nb, _T *_amatr, _T *_bmatr, _T *_cmatr)
{
...
}

template < typename _T >
void DaxpyKernelWrapper(lint64 _m, lint64 _na, lint64 _nb, _T *_amatr, _T *_bmatr, _T *_cmat)
{
...
}


//tvector_traits_kernel.h

//contains wrapper fuction`s prototipe

template < typename _T >
void DaxpyKernelWrapper(lint64 _m, lint64 _na, lint64 _nb, _T *_amatr, _T *_bmatr, _T *_cmat);

//main.cpp


//it just calls DaxpyKernelWrapper fuction and includes tvector_traits_kernel.h

but while linking I have an error:
Error 3 error LNK2019: external symbol unresolved "void __cdecl DaxpyKernelWrapper(__int64,__int64,__int64,float *,float *,float *)" (??$DaxpyKernelWrapper@M@@YAX_J00PAM11@Z) in functions "public: static void __cdecl CTVect_traits::CudaBlockDaxpy(__int64,__int64,__int64,float *,float *,float *)" (?CudaBlockDaxpy@?$CTVect_traits@M@@SAX_J00PAM11@Z) C:\Users\ckhgjh\Documents\GPU\Tesis\Test\test.obj Test


I wonder why, becouse "tvector_traits_kernel.cu" is in projects source files, its objective file was sucsessfully created.



I`m new in Visual studio, previously I used gcc, so I managed linking process myself.
So my question may be very stupid :(




Thank you for your attention!

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...