Old topic renewd: Is there a way to use CDT for CUDA? Trying to figure out if there's a nice way

Hi,

At home I use Eclipse with CDT. I generally prefer letting CDT manage the makefiles, and was wondering if there’s a way of allowing it to do so, while still having CUDA code in my project.
In MSVS I have a ‘rules’ file which adds the ability to control parameters to ‘nvcc’, and automatically tells the environment to use ‘nvcc’ for ‘.cu’ files.

If CDT is still not an option, is there another environment which will enable me such a feature?

Thanks for your time,

Liad Weinberger.

I think this link will help you for the moment:
http://lifeofaprogrammergeek.blogspot.com/…evelopment.html

At the moment I’m downloading the latest CDT source from the repository to unwrite the code for *.cu-files, if it works i will post back.

And if you find some better way, I will be glad to hear from you.

Lucas


Now playing: Disco Ensemble - Videotapes (RADIO ELECTRACKS .:best tunes only:. Punk Hardcore Alternative Metal NEW SERVER HTTP://85.31.186.249)
via FoxyTunes
Lucas

Hi Lucas, and thank you for your reply.

I’ve actually been to that URL and managed to follow what it said, but as I said in my post, what I’m looking for is actually letting CDT manage the makefiles, much like what happens in MS’s Visual Studio, with the supplied ‘.rules’ file. Basically what it does is, it adds custom build rules for ‘.cu’ files, which tells the builder to use ‘nvcc’ with the specified parameters (all settable via the normal VS configuration GUI). You can set the params per .cu file, or for the entire project. This is the same kind of behavior I’m looking for.

Seemingly, in CDT this is a bit more complex to achieve than in MSVS. From what I’ve gathered so far, an Eclipse CDT extension plug-in needs to be written, which adds support for the ‘nvcc’ “toolkit”. This way, ‘.cu’ files in the project could be handled by ‘nvcc’, while ‘.c’ or ‘.cpp’ files in the same project could still be handled by say the GNU Toolkit. Unfortunately, either I misunderstood something, or no one other than me really have such an issue, and thus no such effort has yet been made.

– Liad Weinberger.

Hi Liad,

I think I’ve got the point now :turned: My english is not the best…

I fought the last four hours to go through the CDT source and I’m now at the point to extend it for CUDA (or better, I try it…).
My prior goal is to import the syntax for CUDA to CDT, but I will look after this for the ‘make’ stuff if it is not to complex for me.

Lucas

Hi Lucas,

Let me know if you find anything interesting, I might join your effort.

Liad.

Hi Liad,

I stopped trying to unwritte the CDT code, after some hours without a feeling of success… :wacko:

But I’ve started to take a look at NetBeans and I must admit that it works very nice for me.

I’m still using the Makefile from the template source, so I can’t tell that it works, but in the post here Patrick describes how to configurate NetBeans to handle with it.

I hope it will help you.

Lucas

Lucas, you, and others may be very happy to learn that there is now a toolchain plugin for Eclipse 3.5 which supports CUDA’s nvcc compiler.
You can find it here.

It works perfectly for me.

– Liad W.

Lucas, you, and others may be very happy to learn that there is now a toolchain plugin for Eclipse 3.5 which supports CUDA’s nvcc compiler.
You can find it here.

It works perfectly for me.

– Liad W.

hey,

i also got this toolchain, but when trying to compile the simple template example from the sdk i get the following error message:

../template_kernel.cu(48): error: identifier "cutilBankChecker" is undefined

1 error detected in the compilation of "/tmp/tmpxft_00005220_00000000-4_template_kernel.cpp1.ii".

make: *** [cu_template_kernel.o] Error 2

does anybody know where i am making a mistake?

thanks,

adel

hey,

i also got this toolchain, but when trying to compile the simple template example from the sdk i get the following error message:

../template_kernel.cu(48): error: identifier "cutilBankChecker" is undefined

1 error detected in the compilation of "/tmp/tmpxft_00005220_00000000-4_template_kernel.cpp1.ii".

make: *** [cu_template_kernel.o] Error 2

does anybody know where i am making a mistake?

thanks,

adel

found the mistake, had to exclude the header .cu from build, but now i get new errors when it links:

./cu_template.o: In function `runTest(int, char**)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x5a): undefined reference to `cutCheckCmdLineFlag'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x82): undefined reference to `cudaSetDevice'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x95): undefined reference to `cutCreateTimer'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0xb0): undefined reference to `cutStartTimer'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x142): undefined reference to `cudaMalloc'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x16e): undefined reference to `cudaMemcpy'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x191): undefined reference to `cudaMalloc'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x1fc): undefined reference to `cudaConfigureCall'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x259): undefined reference to `cudaMemcpy'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x274): undefined reference to `cutStopTimer'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x28f): undefined reference to `cutGetTimerValue'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x2ae): undefined reference to `cutDeleteTimer'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x2fa): undefined reference to `cutCheckCmdLineFlag'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x31f): undefined reference to `cutWriteFilef'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x348): undefined reference to `cutComparef'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x395): undefined reference to `cudaFree'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x3b2): undefined reference to `cudaFree'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x3c8): undefined reference to `cudaThreadExit'

./cu_template.o: In function `__cudaUnregisterBinaryUtil()':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x3e2): undefined reference to `__cudaUnregisterFatBinary'

./cu_template.o: In function `__device_stub__Z10testKernelPfS_(float*, float*)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x14f3): undefined reference to `cudaSetupArgument'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x1518): undefined reference to `cudaSetupArgument'

./cu_template.o: In function `__sti____cudaRegisterAll_43_tmpxft_00006785_00000000_4_t

emplate_cpp1_ii_bf2a51c6()':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x157a): undefined reference to `__cudaRegisterFatBinary'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x15db): undefined reference to `__cudaRegisterFunction'

./cu_template.o: In function `__cutilExit(int, char**)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z11__cutilExitiPPc[__cutilExit(int, char**)]+0x21): undefined reference to `cutCheckCmdLineFlag'

./cu_template.o: In function `cutGetMaxGflopsDeviceId()':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z23cutGetMaxGflopsDeviceIdv[cutGetMaxGflopsDeviceId()]+0x52): undefined reference to `cudaGetDeviceCount'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z23cutGetMaxGflopsDeviceIdv[cutGetMaxGflopsDeviceId()]+0x68): undefined reference to `cudaGetDeviceProperties'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z23cutGetMaxGflopsDeviceIdv[cutGetMaxGflopsDeviceId()]+0xc9): undefined reference to `cudaGetDeviceProperties'

./cu_template.o: In function `__cudaSafeCallNoSync(cudaError, char const*, int)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z20__cudaSafeCallNoSync9cudaErrorPKci[__cudaSafeCallNoSync(cudaError, char const*, int)]+0x1f): undefined reference to `cudaGetErrorString'

./cu_template.o: In function `__cudaSafeCall(cudaError, char const*, int)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z14__cudaSafeCall9cudaErrorPKci[__cudaSafeCall(cudaError, char const*, int)]+0x1f): undefined reference to `cudaGetErrorString'

./cu_template.o: In function `__cutilCheckMsg(char const*, char const*, int)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15__cutilCheckMsgPKcS0_i[__cutilCheckMsg(char const*, char const*, int)]+0x15): undefined reference to `cudaGetLastError'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15__cutilCheckMsgPKcS0_i[__cutilCheckMsg(char const*, char const*, int)]+0x28): undefined reference to `cudaGetErrorString'

./cu_template.o: In function `cutilDeviceInit(int, char**)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15cutilDeviceInitiPPc[cutilDeviceInit(int, char**)]+0x21): undefined reference to `cudaGetDeviceCount'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15cutilDeviceInitiPPc[cutilDeviceInit(int, char**)]+0x8b): undefined reference to `cutGetCmdLineArgumenti'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15cutilDeviceInitiPPc[cutilDeviceInit(int, char**)]+0xc3): undefined reference to `cudaGetDeviceProperties'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15cutilDeviceInitiPPc[cutilDeviceInit(int, char**)]+0x122): undefined reference to `cutCheckCmdLineFlag'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15cutilDeviceInitiPPc[cutilDeviceInit(int, char**)]+0x158): undefined reference to `cudaSetDevice'

./cu_template.o: In function `cudaError cudaLaunch<char>(char*)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z10cudaLaunchIcE9cudaErrorPT_[cudaError cudaLaunch<char>(char*)]+0x14): undefined reference to `cudaLaunch'

collect2: ld returned 1 exit status

make: *** [foobar] Error 1

ideas?

found the mistake, had to exclude the header .cu from build, but now i get new errors when it links:

./cu_template.o: In function `runTest(int, char**)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x5a): undefined reference to `cutCheckCmdLineFlag'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x82): undefined reference to `cudaSetDevice'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x95): undefined reference to `cutCreateTimer'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0xb0): undefined reference to `cutStartTimer'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x142): undefined reference to `cudaMalloc'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x16e): undefined reference to `cudaMemcpy'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x191): undefined reference to `cudaMalloc'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x1fc): undefined reference to `cudaConfigureCall'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x259): undefined reference to `cudaMemcpy'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x274): undefined reference to `cutStopTimer'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x28f): undefined reference to `cutGetTimerValue'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x2ae): undefined reference to `cutDeleteTimer'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x2fa): undefined reference to `cutCheckCmdLineFlag'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x31f): undefined reference to `cutWriteFilef'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x348): undefined reference to `cutComparef'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x395): undefined reference to `cudaFree'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x3b2): undefined reference to `cudaFree'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x3c8): undefined reference to `cudaThreadExit'

./cu_template.o: In function `__cudaUnregisterBinaryUtil()':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x3e2): undefined reference to `__cudaUnregisterFatBinary'

./cu_template.o: In function `__device_stub__Z10testKernelPfS_(float*, float*)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x14f3): undefined reference to `cudaSetupArgument'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x1518): undefined reference to `cudaSetupArgument'

./cu_template.o: In function `__sti____cudaRegisterAll_43_tmpxft_00006785_00000000_4_t

emplate_cpp1_ii_bf2a51c6()':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x157a): undefined reference to `__cudaRegisterFatBinary'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text+0x15db): undefined reference to `__cudaRegisterFunction'

./cu_template.o: In function `__cutilExit(int, char**)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z11__cutilExitiPPc[__cutilExit(int, char**)]+0x21): undefined reference to `cutCheckCmdLineFlag'

./cu_template.o: In function `cutGetMaxGflopsDeviceId()':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z23cutGetMaxGflopsDeviceIdv[cutGetMaxGflopsDeviceId()]+0x52): undefined reference to `cudaGetDeviceCount'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z23cutGetMaxGflopsDeviceIdv[cutGetMaxGflopsDeviceId()]+0x68): undefined reference to `cudaGetDeviceProperties'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z23cutGetMaxGflopsDeviceIdv[cutGetMaxGflopsDeviceId()]+0xc9): undefined reference to `cudaGetDeviceProperties'

./cu_template.o: In function `__cudaSafeCallNoSync(cudaError, char const*, int)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z20__cudaSafeCallNoSync9cudaErrorPKci[__cudaSafeCallNoSync(cudaError, char const*, int)]+0x1f): undefined reference to `cudaGetErrorString'

./cu_template.o: In function `__cudaSafeCall(cudaError, char const*, int)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z14__cudaSafeCall9cudaErrorPKci[__cudaSafeCall(cudaError, char const*, int)]+0x1f): undefined reference to `cudaGetErrorString'

./cu_template.o: In function `__cutilCheckMsg(char const*, char const*, int)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15__cutilCheckMsgPKcS0_i[__cutilCheckMsg(char const*, char const*, int)]+0x15): undefined reference to `cudaGetLastError'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15__cutilCheckMsgPKcS0_i[__cutilCheckMsg(char const*, char const*, int)]+0x28): undefined reference to `cudaGetErrorString'

./cu_template.o: In function `cutilDeviceInit(int, char**)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15cutilDeviceInitiPPc[cutilDeviceInit(int, char**)]+0x21): undefined reference to `cudaGetDeviceCount'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15cutilDeviceInitiPPc[cutilDeviceInit(int, char**)]+0x8b): undefined reference to `cutGetCmdLineArgumenti'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15cutilDeviceInitiPPc[cutilDeviceInit(int, char**)]+0xc3): undefined reference to `cudaGetDeviceProperties'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15cutilDeviceInitiPPc[cutilDeviceInit(int, char**)]+0x122): undefined reference to `cutCheckCmdLineFlag'

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z15cutilDeviceInitiPPc[cutilDeviceInit(int, char**)]+0x158): undefined reference to `cudaSetDevice'

./cu_template.o: In function `cudaError cudaLaunch<char>(char*)':

tmpxft_00006785_00000000-1_template.cudafe1.cpp:(.text._Z10cudaLaunchIcE9cudaErrorPT_[cudaError cudaLaunch<char>(char*)]+0x14): undefined reference to `cudaLaunch'

collect2: ld returned 1 exit status

make: *** [foobar] Error 1

ideas?

Hi, i have this problem too.

Can you solve this problem??

an idea?

thanks

regards