Error while launching JOCL

Hello everyone,

Firstly, I’m french, so excuse me for my english.

I’m trying to test JOCL, but I have a problem.

My processor is Intel, so i’ve installed the drivers (drivers), and also I have a NVidia 240M, so I think that openCL is supported since drivers v.280, and I have the drivers v.285.

But when I want to launch a simple code, I have an error. I’m using Ateji PX for GPU, does anyone know it ?

If somebody knows, here is my code :


import java.util.List;

import apx.opencl.IOpenCLDevice;
import apx.opencl.OpenCLDriver;

/*
 * This class retrieves the list of available OpenCL devices and outputs some 
 * information about these devices.
 */

public class Devices {

	public static void main(String[] args) {
		// build list of available OpenCL devices
		List<IOpenCLDevice> devices = OpenCLDriver.getDevices();

		System.out.println(devices.size() + " OpenCL platform(s) detected.");

		for (IOpenCLDevice device : devices) {
			System.out
					.println("----------------------------------------------------------------");
			System.out.println("      Platform = " + device.getPlatformName());
			System.out.println("        Vendor = " + device.getVendor());
			System.out.println("          Name = " + device.getName());
			System.out.println("          Type = "
					+ device.getType().toString());
			System.out.println(" Compute Units = "
					+ device.getNbComputeUnits());
			System.out.println(" Global Memory = "
					+ device.getGlobalMemorySize());
			System.out.println("  Local Memory = "
					+ device.getLocalMemorySize());
			System.out.println("Double support = " + device.hasFP64Support());
		}
	}
}```
Pretty simple...

And the error : 

Exception in thread „main“ org.jocl.CLException: CL_INVALID_VALUE
at org.jocl.CL.checkResult(CL.java:503)
at org.jocl.CL.clGetDeviceIDs(CL.java:552)
at apx.opencl.OpenCLDriver.getDevices(OpenCLDriver.java:25)
at com.ateji.px.gpu.platform.Devices.main(Devices.java:17)



So the error is in the .getDevices().

Anyone have a solution ?

Hello

I knew the Ateji site, but admittedly, did not know that it was using JOCL in the background. I probably should have had a closer look at this earlier :frowning: Unfortunately, the site is shut down now, and I can’t find any documentation for it, or any (working) downloads (The download pacge just leads to a site stating that „Ateji is closed“…)

I can only guess what is wrong there. Is there a version of the ‚getDevices‘ method that accepts arguments for the device type? If implemented properly, this should not be necessary, but maybe you can somehow specify that you are only interested in CPU devices, with something like
OpenCLDriver.getDevices(SomeClass.SOME_CONSTANT_FOR_CPU_DEVICES)
Sorry, I can not be more specific at the moment. I’ll try to download Ateji PX later, maybe it is just temporarily unavailable…

bye
Marco

Hello,

Ateji is closed, but you can install their librairies easily in eclipse 3.6 by mailing them.

This method do not need any arguments, its role is to return all devices found. This code works on another computer.

So my problem is, I think, that Java does not find my devices, because my processor and my graphics card should be detected. On the web, I found that the error “CL_INVALID_VALUE” means that I have 0 OpenCL compatible device.
I don’t understand, yet Direct Compute Benchmark detects it without problem…

Do you mean the same code (i.e. also using Ateji PX and JOCL)? What is the difference between the computer where it works and your computer? Different Operating System or Drivers?

It’s indeed strange that the Screenshot shows available OpenCL devices, but they are obviously not found from Ateji/JOCL…

You may want to try the „JOCLDeviceQuery.java“ from jocl.org - Samples and see whether this works - this may at least give a hint about where to look for the error…

bye
Marco

It works with this sample… I don’t understand…

Number of platforms: 3
Number of devices in platform NVIDIA CUDA: 1
Number of devices in platform Intel(R) OpenCL: 1
Number of devices in platform AMD Accelerated Parallel Processing: 1

On the other computer, I’m on Ubuntu 11, 32bits. It’s a Dell, so it doesn’t have a GPU, that’s why I want to work on this computer.

Here I am on Windows 7, 64bits.

That’s strange - again, I’m not familiar with the Ateji library, but since it works with plain JOCL and shows the error with Ateji, the error might be caused by the Ateji library. Is the source code of this library also available? If so, could you post the code of “OpenCLDriver.getDevices()”? First I wondered what ‘OpenCLDriver.getDevices()’ actually does, because there seems to be no way to specify the platform from which the devices should be obtained. But regardless of whether it should return only the devices of the first platform or of all platforms, there is no obvious reason for the CL_INVALID_VALUE message…

I’ll try to get access to Ateji PX and investigate this further. I can not say exactly when I’ll have the time for that, but maybe a quick look at the source code (IF it is available) will already show what is the reason for this error.

bye
Marco

Hello

I have installed Ateji PX (which is still available as an update for Eclipse 3.6 on the update site http://www.ateji.com/px/eclipse-jgpu) and tried the ‘Devices’ example, and for me it worked.

BTW: The screenshot reports ‘OpenCL 1.0’ - I think that most implementations should support 1.1, but I’m not entirely sure (especially for the Intel implementation - I could not yet test this myself).

What still confuses me is that clGetDeviceIDs should only return CL_INVALID_VALUE when the parameters are plainly wrong, and from looking at the source code, I can say that this is definitely not the case - especially since there is at least 1 device reported for each platform. Although chances are small, maybe some debug output will help - could you please try to run this program

package com.ateji.px.gpu.platform;

import java.util.List;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.jocl.CL;
import org.jocl.CL.LogLevel;

import apx.opencl.IOpenCLDevice;
import apx.opencl.OpenCLDriver;

public class DevicesTest {

	public static void main(String[] args) {

        CL.setLogLevel(LogLevel.LOG_TRACE);
        ConsoleHandler handler = new ConsoleHandler();
        handler.setLevel(Level.FINEST);
        Logger.getLogger(OpenCLDriver.class.getName()).addHandler(handler);
        Logger.getLogger(OpenCLDriver.class.getName()).setLevel(Level.FINEST);

		List<IOpenCLDevice> devices = OpenCLDriver.getDevices();

        CL.setLogLevel(LogLevel.LOG_WARNING);

        System.out.println(devices.size() + " OpenCL platform(s) detected.");

		for (IOpenCLDevice device : devices) {
			System.out
					.println("----------------------------------------------------------------");
			System.out.println("      Platform = " + device.getPlatformName());
			System.out.println("        Vendor = " + device.getVendor());
			System.out.println("          Name = " + device.getName());
			System.out.println("          Type = "
					+ device.getType().toString());
			System.out.println(" Compute Units = "
					+ device.getNbComputeUnits());
			System.out.println(" Global Memory = "
					+ device.getGlobalMemorySize());
			System.out.println("  Local Memory = "
					+ device.getLocalMemorySize());
			System.out.println("Double support = " + device.hasFP64Support());
		}
	}
}

and post the output here?

Done.

24 nov. 2011 09:25:24 apx.opencl.OpenCLDriver getDevices
FIN: 3 platform(s) detected
24 nov. 2011 09:25:25 apx.opencl.OpenCLDriver getDevices
FIN: 
	UID:				0
	CL_DEVICE_NAME:				GeForce GT 240M
	CL_DEVICE_VENDOR:			NVIDIA Corporation
	CL_PLATFORM_NAME:			NVIDIA CUDA
	CL_DEVICE_TYPE:				GPU
	CL_DRIVER_VERSION:			1.0
	CL_DEVICE_COMPILER_AVAILABLE:		true
	CL_DEVICE_ERROR_CORRECTION_SUPPORT:	false
	CL_QUEUE_PROFILING_ENABLE:		false
	CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE:	false
	CL_DEVICE_GLOBAL_MEM_SIZE:		1024Mb
	CL_DEVICE_LOCAL_MEM_SIZE:		16Kb
	CL_DEVICE_MAX_MEM_ALLOC_SIZE:		256Mb
	CL_DEVICE_MAX_COMPUTE_UNITS:		6
	CL_DEVICE_EXTENSIONS:			

Exception in thread "main" org.jocl.CLException: CL_INVALID_VALUE
	at org.jocl.CL.checkResult(CL.java:503)
	at org.jocl.CL.clGetDeviceIDs(CL.java:552)
	at apx.opencl.OpenCLDriver.getDevices(OpenCLDriver.java:25)
	at platform.DevicesTest.main(DevicesTest.java:24)
Executing clGetPlatformIDs
Executing clGetPlatformIDs
Executing clGetDeviceIDs
Executing clGetDeviceIDs
Executing clGetPlatformInfo
Executing clGetPlatformInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clCreateContext
Executing clCreateCommandQueue
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceInfo
Executing clGetDeviceIDs
Executing clGetDeviceIDs

I’ve tested on Linux exactly the same code (Devices.java) and on the same computer, it works. I’ve not installed OpenCl for Intel because i’ve not found the drivers for linux 32 bit, so it just finds my GPU and AMD APP.

EDIT : I’ve uninstalled OpenCL SDK drivers for Intel. JOCLDeviceQUery still detects 3 platforms, and i still have the same error.

OK, according to the output, it manages to find the device of the first platform (NVIDIA) and obtain the device information. But for the second platform (Intel) it fails. Until now, the symptoms seem to indicate that there is something wrong with the Intel drivers, but this is NOT proven and may just be a side-effect of other parts of the system.

As a first test, I would have suggested to uninstall the Intel OpenCL and see whether it works then, but when you already tried this, I’m not sure what could be done next. Maybe the usual, helpless procedure: Installing the Intel OpenCL again, and trying to remove it once more… ? Are there any directories left from the Intel installation? (BTW: I still wonder why it reports OpenCL 1.0, since the Intel SDK should also support 1.1)

One last idea: There is one “main” OpenCL.DLL somewhere in the windows/system directory. As far as I know, this is the entry point for all OpenCL installations. It might be the case that this DLL has been overwritten by an inappropriate version, but this is just a guess. Did you install the Intel SDK driver after the NVIDIA and AMD drivers?

Sorry that I can not give any more specific hints, I also have to guess to some extent what might be wrong there…

bye
Marco

NVidia drivers have always been installed, because it’s the usual graphics card drivers.

I’ve installed AMD after the Intel drivers, and I’ve tried to install and uninstall it a few times.

So, I will work on Linux. That’s not really a problem, but i would rather know where is the problem…

Thank you very much for your help anyway.

Maybe there is a chance for finding out the ICD DLLs from Intel (those that are “used by” the main OpenCL DLL) and remove them, but of course, this may be a hassle and have undesirable side-effects if something goes wrong.

Do you have the chance to run test programs from the Intel SDK? Maybe they also have a “device query” example…? (Just to see if they have a working version, and whether there are differences to the other device query examples…)