InstructionsToRunOpenCLinMATLAB

Running OpenCL code in MATLAB

There are two source code files for each function's OpenCL implementation. One file with .cl contains OpenCL kernel code and another with .cpp contains the main runtime code.

To compile the ATI OpenCL MEX code for execution in MATLAB (ATI Stream SDK 2.0), take intlut as an example (intlut.cl and intlut_ATI.cpp)

1) in the MATLAB command line, type:

"mex -setup" to setup compiler enviroment. This only has to be done once.

"mex -g intlut_ATI.cpp -I"$(ATIStreamROOT)\include" -L"$(ATIStreamROOT)\lib\x86" -lOpenCL" to create an executable file named intlut_ATI.mexw32 in current directory.

"output_gpu = intlut_ATI(input, lut);" will invoke the execution.