Skip to content

Instantly share code, notes, and snippets.

@gidili
Created June 28, 2012 12:35
Show Gist options
  • Save gidili/3011101 to your computer and use it in GitHub Desktop.
Save gidili/3011101 to your computer and use it in GitHub Desktop.
JavaCL with byte ordering
CLContext context = JavaCL.createBestContext(DeviceFeature.GPU);
CLQueue queue = context.createDefaultQueue();
ByteOrder byteOrder = context.getByteOrder();
// Read the program sources and compile them :
String src = IOUtils.readText(SampleSolverService.class.getResource(KERNEL_PATH));
CLProgram program = context.createProgram(src);
// I/O BUFFERS DECLARATION
Pointer<Float> I_in_Ptr = allocateFloats(ELEM_COUNT).order(byteOrder);
Pointer<Float> V_in_Ptr = allocateFloats(ELEM_COUNT).order(byteOrder);
Pointer<Float> x_n_in_Ptr = allocateFloats(ELEM_COUNT).order(byteOrder);
Pointer<Float> x_m_in_Ptr = allocateFloats(ELEM_COUNT).order(byteOrder);
Pointer<Float> x_h_in_Ptr = allocateFloats(ELEM_COUNT).order(byteOrder);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment