OpenCL changes from 3.0 to 3.1.1

Started by Lobo, November 29, 2016, 16:44:16

Previous topic - Next topic

Lobo

Hey,

I tried to upgrade my system from LWJGL 3.0 to 3.1.1, because I want some missing glfw functions.
Now I get several compiling errors because the OpenCL classes have changed/removed for example these classes are gone:

org.lwjgl.opencl.CLDevice;
org.lwjgl.opencl.CLPlatform;
org.lwjgl.opencl.Info;


I used them to get the Platform and Device names for CL computation, see here:

public static String[] getPlatformNames()
	{
		ArrayList<String> platformNames = new ArrayList<>(0);
		CLPlatform.getPlatforms().forEach(element -> platformNames.add(getPlatformInfo(element, CL10.CL_PLATFORM_VENDOR).trim()));
		return platformNames.toArray(new String[platformNames.size()]);
	}

	public static String[] getDeviceNames(int index)
	{
		ArrayList<String> deviceNames = new ArrayList<>(0);
		CLPlatform.getPlatforms().get(index).getDevices(CL10.CL_DEVICE_TYPE_ALL).forEach(element -> deviceNames.add(getDeviceInfo(element, CL10.CL_DEVICE_NAME).trim()));
		return deviceNames.toArray(new String[deviceNames.size()]);
	}
	
	private static String getPlatformInfo(CLPlatform platform, int param) {
		return Info.clGetPlatformInfoStringUTF8(platform.address(), param);
	}

	private static String getDeviceInfo(CLDevice device, int param) {
		return Info.clGetDeviceInfoStringUTF8(device.address(), param);
	}


Now this seems not to be possible anymore, is there a tutorial or something available how I can change opencl from lwjgl 3.0 to 3.1.1?

Would be great if someone could help.

Thanks a lot.

spasi

These classes were removed before 3.0.0 was released. You were probably using the alpha or beta version.

The (quite limited) functionality offered by those classes can be replicated very easily. See the OpenCL demos and the InfoUtil class for example code.

Lobo

oh ok thanks, yes could be that it was a 3.0 beta.

Perfect this will help me to upgrade it thanks a lot.