Use CUDA with IT++ CUDA, IT++

IT++ is a numerical computation library who provides functions useful to me. I tried to put some IT++ functions in serial part of CUDA program. However, lots of errors show in compiling as shown below. Can someone here provide clues of how to solve the problem?

1>d:\cuda\include\math_functions.h(3516) : error C2668: ‘round’ : ambiguous call to overloaded function
1> d:\cuda\include\math_functions.h(237): could be ‘double round(double)’
1> D:\itpp\itpp-4.0.5\itpp/base/converters.h(332): or ‘double itpp::round(double)’
1> while trying to match the argument list ‘(double)’
1>d:\cuda\include\math_functions.h(3521) : error C2668: ‘round’ : ambiguous call to overloaded function
1> d:\cuda\include\math_functions.h(237): could be ‘double round(double)’
1> D:\itpp\itpp-4.0.5\itpp/base/converters.h(332): or ‘double itpp::round(double)’
1> while trying to match the argument list ‘(double)’
1>d:\cuda\include\math_functions.h(3584) : error C2375: ‘log2’ : redefinition; different linkage
1> d:\cuda\include\math_functions.h(147) : see declaration of ‘log2’
1>d:\cuda\include\math_functions.h(3599) : error C2375: ‘log1p’ : redefinition; different linkage
1> d:\cuda\include\math_functions.h(162) : see declaration of ‘log1p’
1>d:\cuda\include\math_functions.h(3648) : error C2264: ‘log2’ : error in function definition or declaration; function not called
1>d:\cuda\include\math_functions.h(3655) : error C2375: ‘acosh’ : redefinition; different linkage
1> d:\cuda\include\math_functions.h(192) : see declaration of ‘acosh’

This is a namespace problem. You could solve it on the IT++ side of the code by explicitly calling itpp::function whenever you want to call something from the IT++ library (or using the ‘using namespace itpp’ directive on those files). I don’t think there’s any namespace for cuda functions, so if you are having problems on the parallel side of the code just make sure the files where the cuda functions are being called cannot see the it++ headers.

Hi jjtapiav,

Thank you for the help! By separating all IT++ functions to a file and use itpp namespace, my codes can compile. But linking still has problem as shown below. I googled and found that "The problem is that the linker tries to combine different, incompatible versions of the Visual C++ runtime library into a single binary. " Not sure how to solve it. Have you successfully use IT++ in CUDA before?

[i]1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: “public: class std::basic_ostream<char,struct std::char_traits > & __thiscall std::basic_ostream<char,struct std::char_traits >::operator<<(double)” (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@N@Z) already defined in vitItpp.obj

1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: “public: class std::basic_ostream<char,struct std::char_traits > & __thiscall std::basic_ostream<char,struct std::char_traits >::operator<<(int)” (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z) already defined in vitItpp.obj

1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: “public: class std::basic_ostream<char,struct std::char_traits > & __thiscall std::basic_ostream<char,struct std::char_traits >::operator<<(class std::basic_ostream<char,struct std::char_traits > & (__cdecl*)(class std::basic_ostream<char,struct std::char_traits > &))” (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z) already defined in vitItpp.obj

1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: “class std::basic_ostream<char,struct std::char_traits > & __cdecl std::endl(class std::basic_ostream<char,struct std::char_traits > &)” (?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z) already defined in vitItpp.obj[/i]