cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

lantonov
Journeyman III

trouble with including files

I am having trouble getting #include to work in a kernel on APP 2.4. From the build output I can see that the kernel is being compiled in a temp foder. I get the same error from the AMD OpenCL compiler for both the GPU (4670 HD) and the CPU. The program builds for an NVIDIA GPU, by simply having the include file next to the .cl kernel file.

I have tried passing the -I dir parameter to clBuildProgram, with both the executable folder and with a very simple path - d:\\. I have also tried including the full path in the #include statement, but it still gives the same error.

I get the same result on two different computers with APP 2.4.

Has anybody a verified method of including files from their kernel files?

BUILD LOG ************************************************ H:\!WITHO~1\Lubo\AppData\Local\Temp\OCL410B.tmp.cl(5): catastrophic error: cannot open source file "saxs_common.cl" #include "saxs_common.cl" ^ 1 catastrophic error detected in the compilation of "H:\!WITHO~1\Lubo\AppData\Local\Temp \OCL410B.tmp.cl". Compilation terminated. VC/INCL ************************************************ ERROR: clBuildProgram(-11)

0 Likes
6 Replies
perhaad
Adept I

I could be wrong but I dont think you can do a #include in kernel files...None of the AMD APP / Nvidia SDK examples seem to do anything like that and the specification doesnt mention #include.

 

0 Likes

No, you definitely can include files; I do it all the time. You use -I/Path/To/Dir with no space. It also works for relative paths too. I'm not really sure why you're having trouble.

0 Likes

yes you can - that's why there is a -I parameter to the compiler in clBuildProgram. you are right that there are no examples of it anywhere though.

0 Likes

try use normal slash / instead of backslash \

0 Likes

nou, already tried that - no dice

Rick, I'll try your suggestion

0 Likes

Well, mystery solved, althrough it is embarrasing.

I was modifing the wrong class. The -I option works, with or without space. In fact "-I ./" works very well 🙂

0 Likes