Using CUDA timing functions in .C files?

Hello all,

I’m a relative newbie at GPGPU program, and have managed to compile the simple examples.

I want to use the cutil.h functions to time the performance difference between a regular C function and the CUDA version I’ve developed, using the cuda timer functions (cutStartTimer, cutResetTimer etc).

However, simply including the cutil.h header file in a .C file produces many errors when I want to compile, such as,

C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\inc\cutil.h(122) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\inc\cutil.h(124) : error C2146: syntax error : missing ‘)’ before identifier ‘verbose’
C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\inc\cutil.h(124) : error C2081: ‘bool’ : name in formal parameter list illegal
C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\inc\cutil.h(124) : error C2061: syntax error : identifier ‘verbose’

Other files such as cuda.h and cuda_runtime.h produce similar syntax errors.

What am I missing, in my project file/environment? I’ve tried switching compilers between Compile as C Code, Compile As C++ and using the CUDA tool and that doesn’t work.

I’m using Visual Studio Express 2005 and can compile (and run in EMU mode) the SDK examples without a problem.

Sorry if it’s a bit vague. Thank you.

I have done this the same with what you did .But failed.And then i use it in .cu file without launch anything about cuda but something about timer.

I also had this problem once. A long time ago. this looks like your paths are not pointing to the right directories.

Or you’re not including the right things.

I’ve gotten around it by putting all the CUDA timing code in a .cu file, which calls both the C version and the CUDA version.

Clunky, but it works…

Oh well. I will try to experiment with the include orders when I get free time (or see if I get the same errors using gcc instead of VS).