Subject: Re: [boost] [compute] kernels as strings impairs readability and maintainability
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2014-12-25 05:58:15
2014-12-24 23:15 GMT+04:00 Pavan Yalamanchili <pavan_at_[hidden]>:
> I am a bit late to the party, but we faced the same problem with our
> library, ArrayFire.
> The solution we came up with is the following.
> - The kernels are written as .cl files and are part of the repository.
> - During the build process, the kernels in .cl files are converted to
> strings in *new* .hpp files.
> - The auto-generated kernel headers are the files that are included when
> trying to compile the said kernel.
There is a possible hack for that case! You'll need two helper header files
`import.pp` and `end_import.pp`. Something like the following could work
#define TO_STRING(...) \
Now you'll need to write kernels like this:
char IMPORT_AS = TO_STRING(
// Code goes here
); // not sure that this will work
That's it. Now if you need that kernel as a string, you just write the
#define IMPORT_AS variable_name
-- Best regards, Antony Polukhin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk