How to compile under ubuntu?

I’ve downloaded the opencl sample programs and have successfully compiled and ran them, but I’m a bit confused when dissecting the makefiles on how to manually compile an opencl program. I know with cuda you just use nvcc, but are there special arguments u need to use for opencl with gcc/g++? If someone can provide me with a simple hello world program with compilation instructions it’d be much appreciated.

Thanks

You don’t need any special arguments with gcc/g++ (besides linking against OpenCL). That’s IMHO one of the major advantages of OpenCL over CUDA: You don’t any special tool chain and pre-build steps. With OpenCL, it’s just like with OpenGL and GLSL shaders: The compiler is part of the driver / API. Just load the source code via a library call at run time of your application and you’re set. There’s not need to call nvcc or anything similar.