Running JOCL through Matlab

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Running JOCL through Matlab

Eric Barnhill
I have integrated JOCL into my medical imaging library -- works really great. The library is designed to be called from Matlab, and I get OpenCL errors when I call it from Matlab -- "can not enumerate platforms" which I gather means OpenCL is not found at all. All needed .jars are in the Matlab classpath. I realise Matlab doesn't support OpenCL but I was surprised that this would interfere with Java. Do you have any idea why the Matlab environment would disrupt calling JOCL and any suggestions for fixing it?
Reply | Threaded
Open this post in threaded view
|

Re: Running JOCL through Matlab

gouessej
Administrator
Hi

Which JARs do you use? Do you reproduce this bug with the fat JAR?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Running JOCL through Matlab

Wade Walker
Administrator
In reply to this post by Eric Barnhill
Hi Eric,

The error comes when JOCL calls clGetPlatformIDs(), and when I google failures in that function, I get results like http://stackoverflow.com/questions/20335579/error-clgetplatformids-1001-when-running-opencl-code-linux, which seems to say that this means perhaps your OpenCL ICD is not installed correctly on your machine. Have you tested OpenCL itself outside of Matlab, by running our TestJoclVersion unit test perhaps, or some native binary that uses OpenCL?

Also, could you copy and paste the stack trace and error code here (from the code it looks like they should be present)? That may have some more information.
Reply | Threaded
Open this post in threaded view
|

Re: Running JOCL through Matlab

Eric Barnhill
Thanks to you both. As you suggested I exported the library as a fat jar, and also had to include all the glue libraries in the Matlab static class path. I'm delighted to say it's running in Matlab R2015a now.
Reply | Threaded
Open this post in threaded view
|

Re: Running JOCL through Matlab

gouessej
Administrator
It's a good piece of news. Please can you indicate how to modify the Matlab static class path just in case someone else has a similar trouble?
Julien Gouesse | Personal blog | Website