OpenCL-OpenGL interoperability problems on AMD GPUs and Linux

SimpleGLAfter experimenting with the OpenCL-OpenGL interoperability on AMD GPUs on Ubuntu Linux I got some cryptic error messages from X (see below). This happens both for the AMD APP samples like SimpleGL and my own OpenCL implementation of Marching Cubes.

Erorr message:

XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
      after 28 requests (28 known processed) with 0 events remaining.

Or this message:

X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  160 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  28
  Current serial number in output stream:  28

Or something like this:

libGL error: dlopen /usr/lib/fglrx/dri/swrast_dri.so failed (/usr/lib/fglrx/dri/swrast_dri.so
libGL error: unable to load driver: swrast_dri.so
libGL error: unable to load driver: swrast

The problem seems to be that the dynamic linker links to the wrong OpenGL libraries. When using OpenCL-OpenGL interoperability we want to use AMDs OpenGL implementation and not mesa. To fix this set the following environment variable before running your code:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/fglrx

You can add this to you .bashrc file if you want it to be permanent.

You may also like...

1 Response

Leave a Reply

Your email address will not be published.