!7 // OpenCL Java binding by Marco Hutter of jocl.org // patched by Stefan to allow dynamic library loading lib 1006673 import org.jocl.*; import static org.jocl.CL.*; /** * A small JOCL sample. */ /** * The source code of the OpenCL program to execute */ static S programSource = "__kernel void "+ "sampleKernel(__global const float *a,"+ " __global const float *b,"+ " __global float *c)"+ "{"+ " int gid = get_global_id(0);"+ " c[gid] = a[gid] * b[gid];"+ "}"; // MAIN PROGRAM p { // Linux // loadNative(1006670); // JOCL Native Parts File libFile = prepareProgramFile("opencl.so"); copyFile(loadLibrary(#1006670), libFile); System.load(libFile.getPath()); call(CL.class, "initNativeLibrary", libFile.getName()); // Create input- and output data int n = 10; float srcArrayA[] = new float[n]; float srcArrayB[] = new float[n]; float dstArray[] = new float[n]; for (int i=0; i