Results 1 to 6 of 6

Thread: Header files for Kernels

  1. #1
    Senior Member
    Join Date
    Oct 2012
    Posts
    166

    Header files for Kernels

    Hi again,

    I'm still sitting on my abstraction layer and got the next problem with the kernelsources. My problem:
    Code :
    #include "inc.h"
     
    __kernel foo(int arg)
    {
      bar(arg); //contained in inc.h
    }
    I nearly found a solution for all the sourcecodes (hiding them in a Database, containing binaries in the future maybe) but this will not help in case of kernel files with includes.

    Does anyone know a way how to solve the inclusion problem when you don't want to have a file on your disk?
    I haven't seen a method like "clAddIncludeFromSource()". So the only way is to forbid includes with all of their problem (code dublication, etc) or scan for includes in the source an manually add all of the included source into the file. But in that solution, you would have all methods from a header in your kernel, not only the ones you are using.

    Thanks in advance,
    clint3112

  2. #2

    Re: Header files for Kernels

    Probably the best solution would be to run the pre-processor cpp (assuming you are running some UNIXy OS) yourself somewhere in your build process. This will include the definitions and get rid of the include statement.

  3. #3
    Senior Member
    Join Date
    Oct 2012
    Posts
    166

    Re: Header files for Kernels

    First problem, its on windows.
    But is there an openCL preprocessor available?

  4. #4

    Re: Header files for Kernels

    Quote Originally Posted by clint3112
    First problem, its on windows.
    But is there an openCL preprocessor available?
    A pre-processor is nothing magical but just replacing text strings by other text strings that you #defined before doing any actual compilation. Moreover, OpenCL C is an extended version of C99, therefore you could easily re-use any C pre-processor.

  5. #5
    Senior Member
    Join Date
    Oct 2012
    Posts
    166

    Re: Header files for Kernels

    so, the compiler will delete the unused functions from the header files? then, a simple copy would be enough.

  6. #6
    Senior Member
    Join Date
    Oct 2012
    Posts
    166

    Re: Header files for Kernels

    An what you advice would be a prebuild step. My code is in a db that is queried at runtime. So calling an external program wouldnt be the best idea i think

Similar Threads

  1. libOpenCL.so and header files
    By sean.settle in forum Interoperability issues
    Replies: 1
    Last Post: 08-23-2012, 02:38 PM
  2. Discrepancy in specification and header files.
    By manojtharwani in forum OpenMAX IL
    Replies: 0
    Last Post: 06-25-2007, 10:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •