2 Replies Latest reply on Aug 24, 2012 2:58 PM by gagcl

    And again CL-GL Interop fails with CL_INVALID_GL_OBJECT

    gagcl

      I'm using Debian Testing with the latest fglrx-driver&opencl (http://packages.debian.org/experimental/fglrx-driver) and XServer 1.12.3.

       

      I've tried 3 examples for CL-GL interop:

      - SimpleGL from AMD APP SDK 2.7

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

      - https://github.com/enjalot/adventures_in_opencl/tree/master/part2

      All of them fail with CL_INVALID_GL_OBJECT.

       

      I've reinstalled (with purge) the fglrx but it didn't help. Then I've checked my setup:

      2.7/samples/opencl/cl/app/SimpleGL$ ldd build/debug/x86_64/SimpleGL

      ...

          libglut.so.3 => /usr/lib/x86_64-linux-gnu/libglut.so.3 (0x00007fe27ed34000)

          libGLEW.so.1.7 => /usr/lib/x86_64-linux-gnu/libGLEW.so.1.7 (0x00007fe27eac2000)

          libGL.so.1 => /usr/lib/x86_64-linux-gnu/libGL.so.1 (0x00007fe27e8be000)

          libGLU.so.1 => /usr/lib/x86_64-linux-gnu/libGLU.so.1 (0x00007fe27e650000)

          libOpenCL.so.1 => /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 (0x00007fe27e44a000)

      ...

          libatiuki.so.1 => /usr/lib/x86_64-linux-gnu/libatiuki.so.1 (0x00007fe27cea0000)

      ...

       

      $ ls -l /usr/lib/x86_64-linux-gnu/libglut.so.3

      lrwxrwxrwx 1 root root 16 Jul 14 00:28 /usr/lib/x86_64-linux-gnu/libglut.so.3 -> libglut.so.3.9.0

      $ ls -l /usr/lib/x86_64-linux-gnu/libglut.so.3.9.0

      -rw-r--r-- 1 root root 294784 Jul 14 00:28 /usr/lib/x86_64-linux-gnu/libglut.so.3.9.0

      $ dpkg -S /usr/lib/x86_64-linux-gnu/libglut.so.3.9.0

      freeglut3:amd64: /usr/lib/x86_64-linux-gnu/libglut.so.3.9.0

       

      $ ls -l /usr/lib/x86_64-linux-gnu/libGLEW.so.1.7

      lrwxrwxrwx 1 root root 16 Feb 13  2012 /usr/lib/x86_64-linux-gnu/libGLEW.so.1.7 -> libGLEW.so.1.7.0

      $ ls -l /usr/lib/x86_64-linux-gnu/libGLEW.so.1.7.0

      -rw-r--r-- 1 root root 449480 Feb 13  2012 /usr/lib/x86_64-linux-gnu/libGLEW.so.1.7.0

      $ dpkg -S /usr/lib/x86_64-linux-gnu/libGLEW.so.1.7.0

      libglew1.7:amd64: /usr/lib/x86_64-linux-gnu/libGLEW.so.1.7.0

       

      $ ls -l /usr/lib/x86_64-linux-gnu/libGL.so.1

      lrwxrwxrwx 1 root root 50 Aug 23 16:57 /usr/lib/x86_64-linux-gnu/libGL.so.1 -> /etc/alternatives/glx--libGL.so.1-x86_64-linux-gnu

      $ ls -l /etc/alternatives/glx--libGL.so.1-x86_64-linux-gnu

      lrwxrwxrwx 1 root root 42 Aug 24 16:37 /etc/alternatives/glx--libGL.so.1-x86_64-linux-gnu -> /usr/lib/x86_64-linux-gnu/fglrx/libGL.so.1

      $ ls -l /usr/lib/x86_64-linux-gnu/fglrx/libGL.so.1

      lrwxrwxrwx 1 root root 18 Aug  7 12:55 /usr/lib/x86_64-linux-gnu/fglrx/libGL.so.1 -> fglrx-libGL.so.1.2

      $ ls -l /usr/lib/x86_64-linux-gnu/fglrx/fglrx-libGL.so.1.2

      -rw-r--r-- 1 root root 936984 Aug  7 12:55 /usr/lib/x86_64-linux-gnu/fglrx/fglrx-libGL.so.1.2

      $ dpkg -S /usr/lib/x86_64-linux-gnu/fglrx/fglrx-libGL.so.1.2

      libgl1-fglrx-glx:amd64: /usr/lib/x86_64-linux-gnu/fglrx/fglrx-libGL.so.1.2

       

      $ ls -l /usr/lib/x86_64-linux-gnu/libGLU.so.1

      lrwxrwxrwx 1 root root 19 Jul 29 15:02 /usr/lib/x86_64-linux-gnu/libGLU.so.1 -> libGLU.so.1.3.08004

      $ ls -l /usr/lib/x86_64-linux-gnu/libGLU.so.1.3.08004

      -rw-r--r-- 1 root root 447632 Jul 29 15:02 /usr/lib/x86_64-linux-gnu/libGLU.so.1.3.08004

      $ dpkg -S /usr/lib/x86_64-linux-gnu/libGLU.so.1.3.08004

      libglu1-mesa:amd64: /usr/lib/x86_64-linux-gnu/libGLU.so.1.3.08004

       

      $ ls -l /usr/lib/x86_64-linux-gnu/libOpenCL.so.1

      -rw-r--r-- 1 root root 23120 Aug  7 12:55 /usr/lib/x86_64-linux-gnu/libOpenCL.so.1

      $ dpkg -S /usr/lib/x86_64-linux-gnu/libOpenCL.so.1

      amd-libopencl1:amd64: /usr/lib/x86_64-linux-gnu/libOpenCL.so.1

       

      $ ls -l /usr/lib/x86_64-linux-gnu/libatiuki.so.1

      lrwxrwxrwx 1 root root 16 Aug  7 12:55 /usr/lib/x86_64-linux-gnu/libatiuki.so.1 -> libatiuki.so.1.0

      $ ls -l /usr/lib/x86_64-linux-gnu/libatiuki.so.1.0

      -rw-r--r-- 1 root root 34352 Aug  7 12:55 /usr/lib/x86_64-linux-gnu/libatiuki.so.1.0

      $ dpkg -S /usr/lib/x86_64-linux-gnu/libatiuki.so.1.0

      libfglrx:amd64: /usr/lib/x86_64-linux-gnu/libatiuki.so.1.0

       

      It seems all libraries are properly.

       

      $ clinfo

      Number of platforms:                 1

        Platform Profile:                 FULL_PROFILE

        Platform Version:                 OpenCL 1.2 AMD-APP (938.2)

        Platform Name:                 AMD Accelerated Parallel Processing

        Platform Vendor:                 Advanced Micro Devices, Inc.

        Platform Extensions:                 cl_khr_icd cl_amd_event_callback cl_amd_offline_devices

      ...

        Vendor:                                 Advanced Micro Devices, Inc.

        Device OpenCL C version:             OpenCL C 1.2

        Driver version:                 CAL 1.4.1741

        Profile:                     FULL_PROFILE

        Version:                     OpenCL 1.2 AMD-APP (938.2)

      ...

       

      Is there any way to find out the details, what property of the OpenGL object is not valid?

       

      Thanks.

        • Re: And again CL-GL Interop fails with CL_INVALID_GL_OBJECT
          nou

          i got this error because even at first it load libGL.so from fglrx driver later it for some reason load up libGL.so from mesa. in other words ldd return /usr/lib/fglrx/libGL.so but strace show that it open up /usr/lib/libGL.so which is from mesa. so run this.

           

          export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/fglrx/

            • Re: And again CL-GL Interop fails with CL_INVALID_GL_OBJECT
              gagcl

              Oh, yeah:

              $ ls -l /usr/lib/x86_64-linux-gnu/libGL.so

              lrwxrwxrwx 1 root root 48 Aug 23 16:57 /usr/lib/x86_64-linux-gnu/libGL.so -> /etc/alternatives/glx--libGL.so-x86_64-linux-gnu

              $ ls -l /etc/alternatives/glx--libGL.so-x86_64-linux-gnu

              lrwxrwxrwx 1 root root 48 Aug 23 16:57 /etc/alternatives/glx--libGL.so-x86_64-linux-gnu -> /usr/lib/mesa-diverted/x86_64-linux-gnu/libGL.so

               

              nou, thanks a lot! I've spent already many hours figuring out the reason, but that somebody would open libGL.so without .1!

               

              ftruncate(17, 0)                    = 0
              lseek(17, 0, SEEK_SET)              = 0

              write(17, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\2\0\362\3\1\0\0\0\0\0\0\0\0\0\0\0"..., 171516) = 171516

              lseek(17, 0, SEEK_END)              = 171516
              lseek(17, 0, SEEK_SET)              = 0

              read(17, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\2\0\362\3\1\0\0\0\0\0\0\0\0\0\0\0"..., 171516) = 171516

              close(17)                           = 0
              unlink("/tmp/OCLqq0I50")            = 0
              munmap(0x7f6e1aae9000, 528384)      = 0

              sysinfo({uptime=16657, loads=[49792, 58816, 100896] totalram=4088778752, freeram=205926400, sharedram=0, bufferram=67231744} totalswap=1096806400, freeswap=1096708096, procs=318}) = 0

              clock_getres(CLOCK_MONOTONIC, {0, 1})   = 0

              open("/proc/cpuinfo", O_RDONLY)     = 17

              read(17, "processor\t: 0\nvendor_id\t: Authen"..., 8191) = 3601

              close(17)                           = 0
              open("/proc/self/maps", O_RDONLY)   = 17

              getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0

              fstat(17, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0

              mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6e1ab69000

              read(17, "00400000-00405000 r-xp 00000000 "..., 1024) = 1024

              read(17, "rw-p 00000000 00:00 0 \n7f6e1bf6a"..., 1024) = 1024

              read(17, "ib/x86_64-linux-gnu/libXinerama."..., 1024) = 1024

              read(17, "000 08:05 921323            "..., 1024) = 1024

              read(17, "ibICE.so.6.3.0\n7f6e20dac000-7f6e"..., 1024) = 1024

              read(17, "00 08:05 919749             "..., 1024) = 1024

              read(17, "nu/libxcb.so.1.1.0\n7f6e21846000-"..., 1024) = 1024

              read(17, "-linux-gnu/libX11.so.6.3.0\n7f6e2"..., 1024) = 1024

              read(17, "/libGLU.so.1.3.08004\n7f6e2242f00"..., 1024) = 1024

              read(17, "5 1306948                /li"..., 1024) = 1024
              read(17, "5 917880                 /us"..., 1024) = 1024

              read(17, "000 ---p 000be000 08:05 967121  "..., 1024) = 1024

              read(17, "            /usr/lib/x86_64-"..., 1024) = 1024

              read(17, "f6e23e53000 rw-s 00002000 00:05 "..., 1024) = 629

              close(17)                           = 0
              munmap(0x7f6e1ab69000, 4096)        = 0

              sched_getaffinity(22211, 32, {f, 0, 0, 0}) = 32

              close(13)                           = 0
              munmap(0x7f6e1d6f6000, 4096)        = 0
              getdents(12, /* 0 entries */, 32768)= 0
              close(12)                           = 0
              open("/etc/ld.so.cache", O_RDONLY)  = 12

              fstat(12, {st_mode=S_IFREG|0644, st_size=122514, ...}) = 0

              mmap(NULL, 122514, PROT_READ, MAP_PRIVATE, 12, 0) = 0x7f6e1ab4c000

              close(12)                           = 0
              access("/etc/ld.so.nohwcap", F_OK)  = -1 ENOENT (No such file or directory)

              open("/usr/lib/x86_64-linux-gnu/libGL.so", O_RDONLY) = 12 <------------------------------------------------------------------<

              read(12, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\322\1\0\0\0\0\0"..., 832) = 832

              lseek(12, 378924, SEEK_SET)         = 378924

              read(12, "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\4\0\0\0\24\0\0\0", 32) = 32

              fstat(12, {st_mode=S_IFREG|0644, st_size=391896, ...}) = 0

              mmap(NULL, 2489544, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 12, 0) = 0x7f6e1a8ec000

              mprotect(0x7f6e1a949000, 2093056, PROT_NONE) = 0

              mmap(0x7f6e1ab48000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 12, 0x5c000) = 0x7f6e1ab48000

              close(12)                           = 0
              access("/etc/ld.so.nohwcap", F_OK)  = -1 ENOENT (No such file or directory)

              open("/usr/lib/x86_64-linux-gnu/libglapi.so.0", O_RDONLY) = 12

              read(12, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\210\0\0\0\0\0\0"..., 832) = 832

              lseek(12, 131812, SEEK_SET)         = 131812

              read(12, "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\4\0\0\0\24\0\0\0", 32) = 32

              fstat(12, {st_mode=S_IFREG|0644, st_size=145264, ...}) = 0

              mmap(NULL, 2246504, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 12, 0) = 0x7f6e1a6c7000

              mprotect(0x7f6e1a6e8000, 2093056, PROT_NONE) = 0

              mmap(0x7f6e1a8e7000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 12, 0x20000) = 0x7f6e1a8e7000

              mmap(0x7f6e1a8ea000, 5992, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f6e1a8ea000

              close(12)

               

              And it is not clear, where in clCreateContext it occurs:

              $ grep libGL.so /proc/27926/maps

              7ffff778b000-7ffff7849000 r-xp 00000000 08:05 967121                     /usr/lib/x86_64-linux-gnu/fglrx/fglrx-libGL.so.1.2

              7ffff7849000-7ffff7949000 ---p 000be000 08:05 967121                     /usr/lib/x86_64-linux-gnu/fglrx/fglrx-libGL.so.1.2

              7ffff7949000-7ffff7970000 rwxp 000be000 08:05 967121                     /usr/lib/x86_64-linux-gnu/fglrx/fglrx-libGL.so.1.2

               

              Breakpoint 1, CreateContext () at GLinterop.cpp:391

              391        context = clCreateContext(contextProperties, 1, &cdDevices[0], NULL, NULL, &errNum);

              (gdb) s

              warning: Temporarily disabling breakpoints for unloaded shared library "/usr/lib/x86_64-linux-gnu/dri/swrast_dri.so"

              395        if (errNum != CL_SUCCESS)

              (gdb)

               

              $ grep libGL.so /proc/27926/maps

              7fffeea93000-7fffeeaf0000 r-xp 00000000 08:05 1052026                    /usr/lib/mesa-diverted/x86_64-linux-gnu/libGL.so.1.2

              7fffeeaf0000-7fffeecef000 ---p 0005d000 08:05 1052026                    /usr/lib/mesa-diverted/x86_64-linux-gnu/libGL.so.1.2

              7fffeecef000-7fffeecf3000 rw-p 0005c000 08:05 1052026                    /usr/lib/mesa-diverted/x86_64-linux-gnu/libGL.so.1.2

              7ffff778b000-7ffff7849000 r-xp 00000000 08:05 967121                     /usr/lib/x86_64-linux-gnu/fglrx/fglrx-libGL.so.1.2

              7ffff7849000-7ffff7949000 ---p 000be000 08:05 967121                     /usr/lib/x86_64-linux-gnu/fglrx/fglrx-libGL.so.1.2

              7ffff7949000-7ffff7970000 rwxp 000be000 08:05 967121                     /usr/lib/x86_64-linux-gnu/fglrx/fglrx-libGL.so.1.2

               

              And here they are.

               

              Just to export /usr/lib/x86_64-linux-gnu/fglrx/ wouldn't work, because there is no libGL.so. Temporary solution would be in the project dir:

              ln -s /usr/lib/x86_64-linux-gnu/fglrx/fglrx-libGL.so.1.2 libGL.so

              LD_LIBRARY_PATH=. ./my_prog