Invoking OpenCl-compiler from command line, Platform : Windows 7 64 bit

I am trying to compile Open CL programs on windows on command line. I went through the documentation and figured out ways of compling the code with MSVC and linking up with OpenCL libraries. I couldn’t figure out any documentation with respect to directly invoking the Open CL compiler on device code and then linking together the code produced by the MSVC compiler and OpenCL compiler.


That’s not the way OpenCL currently works. Despite CUDA, in general you don’t compile OpenCL code to some object file format that you could link with a host executable. Think of it more like coding OpenGL shaders in GLSL: The compiler is only available as part of the driver API, and you pass the source code to the API. However, you can pre-compile OpenCL kernels to some (pseudo-)binary format. On NVIDIA, this “binary” actually is PTX assembler source code. On ATI/AMD, I believe it is some ELF object file, so you might in fact be able to link that. However, that would be a completely non-portable (in terms of cross-vendor) solution.