/** * Default constructor. Automatically selects the context. */ public CLImageArithmetic() { CLProgram program = null; try { this.context = JavaCL.createBestContext(DeviceFeature.GPU); try { program = context.createProgram(IOUtils.toString(CLImageArithmetic.class.getResource("ImageArithmetic.cl"))); } catch (IOException e) { e.printStackTrace(); } loadKernels(program); } catch (CLBuildException e) { //fallback to OpenCL on the CPU this.context = JavaCL.createBestContext(DeviceFeature.CPU); try { program = context.createProgram(IOUtils.toString(CLImageArithmetic.class.getResource("ImageArithmetic.cl"))); } catch (IOException e1) { e.printStackTrace(); } loadKernels(program); } }
deleteTempFiles = copyIncludesToTemporaryDirectory(); } catch (IOException ex) { throw new CLBuildException(this, ex.toString(), Collections.EMPTY_LIST); throw new CLBuildException(this, "Compilation failure : " + errorString(err) + " (devices: " + Arrays.asList(getDevices()) + ")", errors); } else { if (!errors.isEmpty())
CLProgram createProgram() { CLProgram pg = createContext().createProgram("__kernel void f(__global int* a) {}"); try { pg.build(); } catch (CLBuildException ex) { assertFalse(ex.toString(), true); } return pg; }
deleteTempFiles = copyIncludesToTemporaryDirectory(); } catch (IOException ex) { throw new CLBuildException(this, ex.toString(), Collections.EMPTY_LIST); throw new CLBuildException(this, "Compilation failure : " + errorString(err) + " (devices: " + Arrays.asList(getDevices()) + ")", errors); } else { if (!errors.isEmpty())