Hello Guest

OpenCL

  • 71 Replies
  • 103095 Views
*

Offline kappa

  • *****
  • 1319
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

  • *****
  • 2261
    • 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 ?

Re: OpenCL
« Reply #70 on: October 27, 2020, 18:34:23 »
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?
« Last Edit: October 28, 2020, 05:54:55 by proton2 »

Re: OpenCL
« Reply #71 on: November 04, 2020, 10:43:10 »
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.
« Last Edit: November 04, 2020, 10:44:47 by proton2 »