OpenCL

Started by dronus, February 10, 2010, 14:46:50

Previous topic - Next topic

kappa

Quote from: spasi on October 02, 2010, 16:18:33
(we need to re-implement our Mac context implementation?).

Yup, infact we should reimplement the whole mac windowing system to use Cocoa directly instead of through AWT.

Matzon

Quote from: spasi on October 02, 2010, 16:18:33
Cool, I was also able to test on a macbook last night, it works there too except native kernels (probably useless in Java) and GL sharing (we need to re-implement our Mac context implementation?).

So, famous last words I know, but:

Quote from: spasi on September 30, 2010, 19:14:22Matzon, I think I'm done now, feel free to release 2.6 whenever you can.

ok, I will look into it at the beginning of the comming week. bit busy this weekend :/

NeuroFuzzy

Does anyone know of some JOCL online applets? It'd be cool to have that kind of in-browser computing power.

TenHands

Hi guys,

I realise this topic is old, but seemed the best place to put my question :)
I tried the sum example but seems that
platform.getDevices(CL10.CL_DEVICE_TYPE_GPU);


returns null. I tried Aparapi not long ago so I have the OpenCL SDK from AMD already installed.

Any help would be appreciated

Thanks

spasi

Does it work with CL_DEVICE_TYPE_CPU?

TenHands


quew8

Means your graphics card's driver doesn't have support for OpenCL, but your CPU does.

TenHands

Well that can't be right. It's a 6850 from AMD and I've run OpenCL code on it before with aparapi


TenHands

Ok, found the problem. I was trying to get GPU type devices from platform 0 which doesn't have any:) What I needed to do is get the devices from platform 1. Realised this after running HelloOpenCl :)

Thanks

basil

Quote from: basil on September 09, 2010, 22:08:56
just to keep it complete .. with lwjgl v.2.5 we need to do something like that. notice how the way to access the context class changed :

..( ugly reflection code )..


... so we can use

Drawable d          = org.lwjgl.opengl.Display.getDrawable ();
Method   getcontext = d.getClass ().getSuperclass ().getDeclaredMethod ( "getContext" );

...

just to keep it complete again .. with lwjgl 2.9.1 and it's very nice openCL integration it's now very easy to use LWJGL with JOCL. it's too clear to be missed but it may be still useful to somebody.

with this little helper method you can get all values required for a gl-shared opencl context :

public static long[] getOpenCLSharingProps()
{
  try
  {
    PointerBuffer propsBuffer = new PointerBuffer(4);

    Display.getDrawable().setCLSharingProperties(propsBuffer);
    propsBuffer.rewind();

    long[] sharingProps = new long[propsBuffer.limit()];

    while(propsBuffer.hasRemaining()) sharingProps[propsBuffer.position()] = propsBuffer.get();
    return sharingProps;
  }
  catch(LWJGLException e)
  {
    Logger.log.error(e);
  }

  return null;
}


now, when you create the jocl context properties :

[...]
      cl_context_properties contextProperties = new cl_context_properties();
      contextProperties.addProperty(CL_CONTEXT_PLATFORM,platforms[platform]); // defined somewhere else

      if(shareProps != null) // shareProps is that long[] array
      {
        for(int i = 0; i < shareProps.length; ) 
        {
          long prop  = shareProps[i++];
          long value = shareProps[i++];

          // that verify is not really required :
          if(                                //
              prop != CL_GL_CONTEXT_KHR &&   //
              prop != CL_WGL_HDC_KHR &&      //
              prop != CL_GLX_DISPLAY_KHR &&  //
              prop != CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE) throw new UnsupportedOperationException("prop : " + prop + " value : " + value + " is not supported.");

          contextProperties.addProperty(prop,value);
        }
      }
[...]


works with windows and linux but i cannot confirm apple. actually i cannot find any CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE constant in jocl, what am i missing ? some extension .. or is lwjgl's cl-binding just more advanced ?

proton2

Does anyone know how to debug OpenCL scripts under LWJGL in java?

What are the ways?

I know only one decision, but it only for linux
http://suhorukov.blogspot.com/2011/12/opencl-kernel-debugging-for-java-host.html
it does'not work under windows.

Does anybody know windows solution?

proton2

My project https://github.com/proton2/java-leven
For example working with OpenCL in LWJGL.


Voxels - Dual Contouring Chunking LODs with seams
Nick Gildea Dual Contouring https://github.com/nickgildea/leven implementation in Java LWJGL
CPU and OpenCL GPU implementations.