I wrote a kernel that takes a vector<int> type as an argument,
but when I run it the compiler seems not to recognize this type,
vector<int> is defined in “c:\Program Files\Microsoft Visual Studio 9.0\VC\include\vector”
my Kernel is defined in a .cl file.
How can I include header files to a .cl file to allow kernels to take structures defined in those files as arguments?
is there a type that I can replace vector with, and that is opencl compliant ?
I also have another question:
does structures must be defined in .cl file before using it in kernels,
when I use structures defined in .h I got errors, when I copy them to .cl file it works.
OpenCL just provides buffers. You can put whatever you’d like in them. So if you want a long list of ints just make it the right size and copy them in. You can then access it as an array. You won’t have any of the nice OO features of STL, though.
OpenCL will compile your .h files if you include them either from the compile command or with a #include in your kernel and they are in the right location. Otherwise it will not include anything other than the actual string you use to create a program.
Seem like it couldn’t handle spaces in the include path.
Better use / (windows this is valid too, could help when develop multiplatform).
So you need an include path without any spaces in the name.
Try directly copy-and-pasting your header into the cl code you’re passing to clCreateProgram and see if that works. If it does, then it sounds like a driver bug accessing the header file. If not, then there’s a problem with your header file.