What is wrong witht he file cutil.h - it is called by cutil_inline.h. I am using the cuda_instrument parser on it and it is gagging on the line where
bool verbose = false);
It calls it a syntax error; in my case it is at line 124.
I believe that cutil.h is an NDIVA file. My version came out of the NVIDA SDK version 2.1. The lines where ( bool verbose = false); are many and the cuda-instrument (actually a parser) gags on the first. I do not believe that it continues after that first gag. It stops.
I am using Ubuntu 8.04. I do not know if a later version of cutil.h (SDK version 2.2? maybe) will take care of this problem.
There is no error in any version of cutil.h I have access to - 2.0, 2.1, 2.2, 2.3.
The fact that an unsupported, third party tool like cuda_instrument can’t parse it correctly is no indication of whether the file is syntactically correct C or not.
Okay. I just asked a co-worker and he said the problem is that you cannot initialize variables in c/cpp header files (it was also verified on another forum). This is exactly what cutil.h is trying to do, as shown below
bool verbose = false);
This is in the cutil.h file right now. It starts on line 124. There are many variable initializations after that; but I think that the progam crashes on the first one and never gets to the rest.
If cutil.h is correct how does it get to do this when it is expressly forbidden in c/cpp?
The cuda_instrument was right to flag it. So if the cuda_instrument flags it shouldn’t cuda compiler flag it. The cuda compiler is also a c compiler. I have not used the cuda compiler yet since my cuda equipment purchase is tangled up in government red tape. I do emulate.
I googled cutil.h and it seems that NVIDA is constantly changing this file. SDK 2.1 reflects the latest change. I do not know what went before it. I just have cutil.h SDK ver. 2.1.
Your “co-worker” is wrong. It is perfectly valid to initialize “trailing” values in C++ function prototypes. Doing so makes the arguments optional and gives them a default values when the argument is not explicitly provided during a call. The cutil library is actually C++ and uses templating extensively, exploiting the fact that nvcc uses the g++ to compile host code and pre-process for the Open64 compiler that generates GPU code.
Having finally gotten around to building cuda_instrument, I am not surprised it can’t parse cutil.h - it is intended for parsing device C code, not host C++ code…