On Tue, Mar 22, 2016 at 6:12 AM, Christopher Sean Morrison <brl...@mac.com>
wrote:

>
> > Right. But I think it's also necessary to change the CMakefiles in order
> to install the .cl files somewhere. I'm unsure where to place them.
>
> Probably best will be to just put them in some subdir of our data dir for
> now.  We’ll probably eventually want to set things up in the
> offline-compilation manner where binary kernels are loaded like regular
> libs,


Offline-compilation in OpenCL 1.2 and 2.0 is kind of problematic. IIRC SPIR
is an OpenCL extension (i.e. may or may not be provided by an
implementation). If you don't have SPIR then the binary compiled output is
some architecture dependent file which may not work on your compute device.
OpenCL 2.1 is supposed to come with mandatory SPIR-V support, i.e. a kind
of bytecode, in the core spec but there aren't many implementations of the
spec right now. In fact I don't know of any vendor implementation of the
2.1 spec right now.


> but JIT compiles with sources in the install tree will work fine too.
>

Yes. I think this is the most viable option right now. Until SPIR-V support
is widespread.


> A line like this in the CMakeFiles.txt should do the trick:
>
> set(CL_FILES
>   file1.cl
>   file2.cl
> )
> BRLCAD_ADDDATA(CL_FILES OpenCL)
>
> This should install the files into DATA_DIR/OpenCL, which on a default
> install will be something like /usr/brlcad/dev-7.25.0/share/OpenCL/.
>
> In the C loading code, you can get the path to the file like this:
>
> const char *clfile1 = bu_brlcad_data(“OpenCL/file1.cl”, 0);
>
> You can also just look up the OpenCL dir and manually append / search for
> files, e.g., with bu_file_exists().
>

Thanks! I'll look at this when I get some time available to work on it.

-- 
Vasco Alexandre da Silva Costa
PhD in Computer Engineering (Computer Graphics)
Instituto Superior Técnico/University of Lisbon, Portugal
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to