Number of COMPUTE UNITS

Hi,

How can ask a device to have the number of compute units ?

Best regards

Hello

int computeUnits[] = new int[1];
clGetDeviceInfo(device, CL_DEVICE_MAX_COMPUTE_UNITS, Sizeof.cl_uint, Pointer.to(computeUnits), null);
System.out.println("computeUnits: "+computeUnits[0]);

bye

thanks a lot

Hi,

I am sorry for to have a new question but i am a newbie with JNI :

How can i have the CL_DEVICE_NAME.

thanks for your help.

Hello

I have uploaded a “JOCLDeviceQuery” sample on http://jocl.org/samples/samples.html which queries all these device properties.

For Strings like the CL_DEVICE_NAME, it basically calls a function like this:

/**
 * Returns the value of the device info parameter with the given name
 *  
 * @param device The device
 * @param paramName The parameter name
 * @return The value
 */
private static String getString(cl_device_id device, int paramName)
{
    // Obtain the length of the string that will be queried
    long size[] = new long[1];
    clGetDeviceInfo(device, paramName, 0, null, size);

    // Create a buffer of the appropriate size and fill it with the info
    byte buffer[] = new byte[(int)size[0]];
    clGetDeviceInfo(device, paramName, buffer.length, Pointer.to(buffer), null);

    // Create a string from the buffer (excluding the trailing \0 byte)
    return new String(buffer, 0, buffer.length-1);
}

It may be called by passing in the device and the desired parameter name:
String deviceName = getString(device, CL_DEVICE_NAME);

bye

thanks a lot Marco.

Your help is great !!

kim