vendredi 1 juillet 2016

include headers to OpenCL .cl file

I've written an OpenCL kernel in a .cl file. It attempts to #include several headers.

Its compilation fails, since the included header files are "not found". I am aware that clBuildProgram can take the -I dir option, which adds the directory dir to the list of directories to be searched for the header files.

In the khronus site forum this post http://www.khronos.org/message_boards/viewtopic.php?f=37&t=2535 talks about the issue.

They propose to use clCreateProgramWithSource which specifies all sources (including .h files).

I have a questions regarding this issue:

  1. Which option is better? (clBuildProgram vs. clCreateProgramWithSource, as described above)
  2. If I use clCreateProgramWithSource how does the compiler know what to include? I mean, which source stands for which included file name?
  3. If I use clBuildProgram and there are several directories with include files, how do I specify them?

Aucun commentaire:

Enregistrer un commentaire