View Full Version : offline compilation ?
07-09-2009, 01:23 AM
I am currently working on a program using OpenCL (I have previously worked a bit with CUDA), and in all examples included in Nvidia SDK, all kernels are compiled online (during execution).
With CUDA, I work with nvcc and Makefiles for compiling kernels, and I want to know if there is a way to do the same with OpenCL ? Is there already an OpenCL compiler ? How can I compile them offline ?
Thanks in adavance for your replies.
07-10-2009, 07:45 AM
you can compile offline by calling the builtin compiler and store the binaries.
(compilation makes it necessary to specify the graphic card for which you want to create the binaries).
afaik the spec doesnt give any details about an executable of the compiler without using the opencl implementation.
07-10-2009, 07:48 AM
Thanks for your reply :-)
But i didn't undestand what you call "builtin compiler", do you mean clBuildProgram function ?
I haven't see any binary usable for doing that in SDK...
07-10-2009, 07:56 AM
please have a look at the function clGetProgramInfo with the parameter CL_PROGRAM_BINARIES.
just use your program as usual, read out the kernel binaries after compilation (clBuildProgram) using the above function and store it to a file.
next time you start your program you dont have to compile the kernel again. instead you can use the compiled kernel which you previously stored to the file.
this is what i meant with the builtin compiler cz. the binaries can just be generated with detailed information about your graphic card.
07-10-2009, 08:01 AM
Perfect ! Thanks for your reply, it's exactly what I want :-)
11-18-2011, 02:08 AM
but if I want to invoke directly the OpenCL compiler to compile a kernel code, under CUDA toolkit for example, how can I do?
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.