i newbie in opencl stuffs.
whats best way compiler opencl project ?
using supported compiler (
gcc
orclang
):when use compiler
gcc
orclang
, how control these options? have set inside source code, or, likewise normal compilation flow can pass them on command line. looking @ khornos-manual-1.2, there fewoptions
providedcl_int clbuildprogram
optimizations. :gcc|clang -o3 -i<includes> opencl_app.c -framework opencl option -lm
actually, tried , received error :
gcc: error: unrecognized command line option '<option>'
alternatively, using
openclc
:i have seen people using
openclc
compiler using makefile.
i know best way (if there 2 separate ways), , how control usage of different compile time options.
you might aware important reiterate. opencl standard contains 2 things:
- opencl c language , programming model (i think recent standard include c++)
- opencl host library manage device
gcc
, clang
compilers host side of opencl project. there no way provide compiler options opencl device code compilations using host compiler since not aware of opencl. except clang
there flag accept opencl device code, .cl file contains kernels. way can use clang
, provide flags , options if remember correctly, have either llvm ir or spir
output not device executable object. can load spir
object device using device's run-time environment(opencl drivers). can checkout these links:
other alternative use tools provided target platform. each vendor claims support opencl, should have run-time environment. usually, have separate cli tools compile opencl device code. in case(i guess) have drivers apple, therefore have openclc
.
now main question (best way compile opencl). depends want do. didn't specify kind of requirements have had speculate.
if want have off-line compilation without host program, considerations above you. otherwise, have use opencl library , have on-line compilation kernels, preferred products needs portability. since if compile kernels @ start of program, directly use provided environment , don't need provide libraries each target platform.
therefore, if have opencl project, have decide how compile. if want use generic flags , not rely on third party tools. suggest have class builds kernels , provides flags want.
Comments
Post a Comment