cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

moozoo
Adept III

Assistance with problem related to cl_khr_gl_sharing

I am the author of an opencl solar system simulation which I recently open sourced

http://sourceforge.net/projects/openclsolarsyst/

A video of it running on nvidia hardware is here http://www.youtube.com/watch?v=W4QpUU0zz7M

The program is not working with AMD opencl gpu devices.

It does appear to be working with the amd opencl cpu driver and the amd opengl

I only have access to Intel and Nvidia devices as well as the amd opencl cpu driver.

Any suggestions or assistance would be appreciated.

I believe the problem is related to cl_khr_gl_sharing

The opencl kernels appear to be executing but the opengl display is not updating.

The program is developed using Codelite, wxWidgets and mingw with a view to porting to Mac OSX and Linux

There is a discussion of the problem here http://forum.beyond3d.com/showthread.php?p=1735809

These combinations work as far as I know

Nvida GPU opencl + Nvidia opengl

Intel CPU opencl + Nvidia opengl

AMD CPU opencl + Nvidia opengl

Intel CPU opencl + Intel HD3000 opengl

AMD CPU opencl + Intel HD3000 opengl

AMD CPU opencl + AMD opengl

But

AMD GPU opencl + AMD opengl

is not working (the one I want to work the most because of AMD's fp64 performance)

ps when I say AMD CPU opencl I mean AMD's CPU opencl driver not that its running on an AMD cpu

0 Likes
7 Replies
himanshu_gautam
Grandmaster

Hi moozoo,

Will try to run your Solarsystem on a gcn card here

From problems perspective, it can be helpful, if you can try to do more debugging, and come up with some pointers. Probably compare your CL-GL interop with that of APP SDK's Samples. Also you have not run it on devices formally supported by AMD, so maybe you can try that too.

0 Likes

Thanks. That would be great.

From what I am told it will run if you comment out the #pragmas in adams.cl and start it like this

.\OpenCLSolarSystem.exe -amd -cpu -nsmall

i.e. AMD opencl CPU driver with AMD graphics card opengl

The thing that bothers me the most about this is that I do alot of error checking and people are reporting that no error dialog is appearing.

It is as if the copy from the cl buffer containing the positions to the shared GL_VERTEX_ARRAY object is silently failing.

In the worse case an I was somehow failing to make  a GL context properly then clCreateFromGLBuffer should be failing with CL_INVALID_CONTEXT but no error dialog appears.

The cl buffer and the GL_VERTEX_ARRAY are double4 vectors could that be an issue?

i.e.

glBindBuffer(GL_ARRAY_BUFFER, this->vbo[0]);

glVertexPointer(3, GL_DOUBLE, sizeof(cl_double4), 0);

The only error on clBuildProgram

is

Warning: adamsBashforth16 kernel has register spilling. Lower performance is expected.

However that kernel is'nt that important.

I included a  adamsBashforth16 integration because I'm using a 16 element ring history buffer (so that mod 16 = and &0xF) and hence 16 stages is the max. (there is at most 16 elements in the history buffer)

Anyway I am planning to buy a new system umm early next month and that will include and AMD graphics card.

0 Likes

I have looked at the APP SDK's Samples SimpleGL.

With AMD opencl am I required to call clGetGLContextInfoKHR in order to enable cl_khr_gl_sharing?

Anyway I have added alot of debugging code and clGetGLContextInfoKHR is giving expected output for intel opencl and amd opencl (I have access to cpu only).

i..e. CL_DEVICES_FOR_GL_CONTEXT_KHR is returning a array of devices and my selected device is on the list.

For nvidia its returning 0 as the parameter size for CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR and CL_DEVICES_FOR_GL_CONTEXT_KHR.

I have uploaded OpenCL Solar System Debug1.01b.zip that has the clGetGLContextInfoKHR debug messages.

0 Likes

Uploaded OpenCLSolarSystem1.02.zip and OpenCL Solar System Debug1.02.zip

I found a discussion that said that the vbo's must be created after the cl context

So I have copied the sample ordering for the Gl context, CL context and interopt objects.

It didn't help.

1) Create and Initialize OpenGL

2) Create CL context and Command Queue

3) Create VBO's

4) Create CL interop to the vbo's and other cl buffers.

Note I;m still setting up my GL_PROJECTION and GL_MODELVIEW in 1

Is there some document specifying the order. Other than your simplegl sample I have not see other programs doing this.

for example

http://code.google.com/p/opencl-book-samples/source/browse/trunk/src/Chapter_10/GLinterop/GLinterop....

creates the vbo before creating the cl context

Next thing I will try is changing the GL_DOUBLE vertex array to GL_FLOAT and change my copy kernel to down cast double4 -> float4

Although... I think that all graphics cards that support cl_khr_fp64 should support GL_DOUBLE vertex arrays...

0 Likes

Refer to Appendix G in AMD OpenCL Programming Guide

0 Likes

I have gotten it running with help from people on the Beyond3d forum http://forum.beyond3d.com/showthread.php?p=1746278

>Refer to Appendix G in AMD OpenCL Programming Guide

Which fails to mention Section 5.3 Interoperability of the AMD APP Developer Release Notes (v2.8)

Could this information be included in Appendix G, thanks

0 Likes

Thanks mozoo for the beyond3d link. Also I had already raised a request to add the Known Issue (in release notes) to Appendix G as well. It should happen soon.

0 Likes