I started investigating a few java wrappers (there's only a handful around) and ended up playing with jogamp.jocl.
This is just a snippet showing how to retrieve a list of OpenCL enabled devices on your machine:
// create context for all devices detected using default platform
CLContext context = CLContext.create();
// an array with available devices
CLDevice[] devices = context.getDevices();
for(int i=0; i < devices.length; i++)
{
out.println("device-" + i + ": " + devices[i]);
}
Just to give you a sneak-peek at what comes after, once you've had a look at the output then you can go ahead and select a device to create the queue(s) you'll use for sending data up to the devices:
// have a look at the output and select a device
CLDevice device = devices[0];
// create command queue on selected device.
CLCommandQueue queue = device.createCommandQueue();
No comments:
Post a Comment