Hello Guest

OpenCL

  • 69 Replies
  • 64075 Views
*

Offline kappa

  • *****
  • 1313
Re: OpenCL
« Reply #60 on: October 02, 2010, 18:05:56 »
(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.

*

Offline Matzon

  • *****
  • 2242
Re: OpenCL
« Reply #61 on: October 02, 2010, 19:00:28 »
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:

Matzon, 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 :/

Re: OpenCL
« Reply #62 on: October 03, 2010, 04:02:09 »
Does anyone know of some JOCL online applets? It'd be cool to have that kind of in-browser computing power.

Re: OpenCL
« Reply #63 on: May 03, 2014, 14:19:29 »
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
Code: [Select]
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

*

Offline spasi

  • *****
  • 2153
    • WebHotelier
Re: OpenCL
« Reply #64 on: May 03, 2014, 14:27:05 »
Does it work with CL_DEVICE_TYPE_CPU?

Re: OpenCL
« Reply #65 on: May 03, 2014, 15:22:50 »
Yup :)

*

Offline quew8

  • *****
  • 569
  • Because Square Eyes Look More Real
Re: OpenCL
« Reply #66 on: May 03, 2014, 22:28:41 »
Means your graphics card's driver doesn't have support for OpenCL, but your CPU does.

Re: OpenCL
« Reply #67 on: May 03, 2014, 22:40:43 »
Well that can't be right. It's a 6850 from AMD and I've run OpenCL code on it before with aparapi

« Last Edit: May 04, 2014, 14:16:11 by TenHands »

Re: OpenCL
« Reply #68 on: May 04, 2014, 14:40:37 »
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

*

Offline basil

  • **
  • 81
Re: OpenCL
« Reply #69 on: June 30, 2014, 15:28:49 »
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 :

Code: [Select]
..( ugly reflection code )..
... so we can use

Code: [Select]
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 :

Code: [Select]
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 :

Code: [Select]
[...]
      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 ?