Topic
  • 3 replies
  • Latest Post - ‏2011-03-29T08:55:14Z by SystemAdmin
SebastienDevaux
SebastienDevaux
2 Posts

Pinned topic std::out_of_range in clGetDeviceIDs on PS3

‏2010-05-19T17:29:44Z |
Hi,

Build of OpenCL samples is successful, but all failed at runtime, as my own code on the same error :

sdevaux@nemes:/usr/share/doc/OpenCL-0.1-ibm/samples/perlin_noise/ppc$ ./perlin terminate called after throwing an instance of 
'std::out_of_range' what():  basic_string::substr Abandon


gdb gives some details, the error occurs in clDeviceIDs host API call :

(gdb) bt #0  0x0fb659fc in raise () from /lib/libc.so.6 #1  0x0fb6b084 in abort () from /lib/libc.so.6 #2  0x0fdaf060 in __gnu_cxx::__verbose_terminate_handler () at ../../../../src/libstdc++-v3/libsupc++/vterminate.cc:93 #3  0x0fdac4e8 in __cxxabiv1::__terminate (handler=<value optimized out>) at ../../../../src/libstdc++-v3/libsupc++/eh_terminate.cc:38 #4  0x0fdac52c in std::terminate () at ../../../../src/libstdc++-v3/libsupc++/eh_terminate.cc:48 #5  0x0fdac558 in __cxxabiv1::__unexpected (handler=<value optimized out>) at ../../../../src/libstdc++-v3/libsupc++/eh_terminate.cc:54 #6  0x0fdab68c in __cxa_call_unexpected (exc_obj_in=<value optimized out>) at ../../../../src/libstdc++-v3/libsupc++/eh_personality.cc:753 #7  0x0ff42aa4 in ibm::openclHost::Platform::copyDeviceIDs(unsigned 

long long, std::vector<ibm::openclDevice::DeviceID*, std::allocator<ibm::openclDevice::DeviceID*> >&) () from /opt/OpenCL/lib/CL/debug/libCL.so.0 #8  0x0ff229cc in clGetDeviceIDs () from /opt/OpenCL/lib/CL/debug/libCL.so.0 #9  0x100017b4 in main (argc=<value optimized out>, argv=<value optimized out>) at ../src/perlin.c:366


I didn't expect success at first attempt since I manually installed rpms on my Ubuntu 10.04 PS3 and I know the package is tested only with Fedora. But install seems OK : ldd reports finding all dependencies.
It's probably distibution related but this kind of error may reveal a real bug, isn't it ?
Did anyone experienced the same and found a workaround ?

Sebastien.
Updated on 2011-03-29T08:55:14Z at 2011-03-29T08:55:14Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    131 Posts

    Re: std::out_of_range in clGetDeviceIDs on PS3

    ‏2010-05-20T13:04:09Z  
    try to isolate whether it's the cpu or the spu device that it's having a problem with:

    ./perlin --accel

    ./perlin --cpu

    also, we dlopen several other libraries; might want to ldd them to make sure the pre-req's are there:

    ldd /usr/lib/CL/device/libCL*so

    lastly, what does /proc/cpuinfo show?

    .bri.
  • SebastienDevaux
    SebastienDevaux
    2 Posts

    Re: std::out_of_range in clGetDeviceIDs on PS3

    ‏2010-05-21T15:05:46Z  
    Using --accel or --cpu produce same result : same error.
    I also tried as root, no changes.
    I did checked dependencies from /usr/lib/CL/device/*.so after my install. I just re-checket it and all is fine : all libs are found.

    Here is my cpu/info :
    
    processor : 0 cpu            : Cell Broadband Engine, altivec supported clock                : 3192.000000MHz revision       : 16.0 (pvr 0070 1000)   processor : 1 cpu         : Cell Broadband Engine, altivec supported clock                : 3192.000000MHz revision       : 16.0 (pvr 0070 1000)   timebase  : 79800000 platform     : PS3 model             : SonyPS3
    


    Just for information, the following code produce same error. It can retrieve some plateforme information (I can see first printf output) but fail on first clGetDeviceIDs. This function works fine on Ubuntu PCs (test OK with CUDA V3 and ATI Stream V2.1)
    
    
    /** * print to stdout, platform and device list. * @return CL_* error code, CL_SUCCESS when no error. */ cl_int oclu_listDevices() 
    { cl_int oclErr; cl_platform_id oclPFs[OCLU_MAXDEVICE]; 
    
    int count; oclErr=clGetPlatformIDs(OCLU_MAXDEVICE,oclPFs,&count); 
    
    char infostr[1024]; 
    
    int infoint; 
    
    int infointtab[1024]; 
    
    if (oclErr==CL_SUCCESS) 
    { 
    // explore platform list 
    
    int i; 
    
    for (i=0;i<count;i++) 
    { 
    // display platform info. clGetPlatformInfo(oclPFs[i],CL_PLATFORM_NAME,sizeof(infostr),&infostr,NULL); printf (
    "%d: %s \n",i,infostr); 
    // get all platform's devices  
    
    int devCount; cl_device_id oclDevs[OCLU_MAXDEVICE]; oclErr=clGetDeviceIDs(oclPFs[i],CL_DEVICE_TYPE_ALL,OCLU_MAXDEVICE,oclDevs,&devCount); 
    
    if (oclErr==CL_SUCCESS) 
    { 
    // explore device list 
    
    int j; 
    
    for (j=0;j<devCount;j++) 
    { clGetDeviceInfo(oclDevs[j],CL_DEVICE_NAME,sizeof(infostr),&infostr,NULL); printf(
    "  %d/%d: %s \n",i,j,infostr); clGetDeviceInfo(oclDevs[j],CL_DEVICE_MAX_WORK_GROUP_SIZE,sizeof(infoint),&infoint,NULL); printf(
    "     MAX_WORK_GROUP_SIZE:     %d\n",infoint); clGetDeviceInfo(oclDevs[j],CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS,sizeof(infoint),&infoint,NULL); printf(
    "     MAX_WORK_ITEM_DIMENSIONS: %d\n",infoint); 
    
    int k; printf(
    "     MAX_WORK_ITEM_SIZES:      [ "); clGetDeviceInfo(oclDevs[j],CL_DEVICE_MAX_WORK_ITEM_SIZES,sizeof(infointtab),infointtab,NULL); 
    
    for (k=0;k<infoint;k++) 
    { printf(
    "%d ",infointtab[k]); 
    } printf(
    "]\n"); 
    } 
    } 
    } 
    } 
    
    return oclErr; 
    }
    
  • SystemAdmin
    SystemAdmin
    131 Posts

    Re: std::out_of_range in clGetDeviceIDs on PS3

    ‏2011-03-29T08:55:14Z  
    {quote:title=SebastienDevaux wrote:}{quote}
    > Build of OpenCL samples is successful, but all failed at runtime, as my own code on the same error :
    >
    
    sdevaux@nemes:/usr/share/doc/OpenCL-0.1-ibm/samples/perlin_noise/ppc$ ./perlin > terminate called after throwing an instance of 
    'std::out_of_range' >   what():  basic_string::substr > Abandon
    


    I've had a similar error using a patched 0.2 on PPC970MPs ...

    {quote:title=bri wrote:}{quote}
    > also, we dlopen several other libraries; might want to ldd them to make sure the pre-req's are there:

    ... and that was a hint: my code was picking up a copy of the libIBMOpenCL.so at runtime instead of the one in /usr/lib. Removing the spurious copy solved the problem for me. Maybe the library was using the wrong path to dlopen() extra libraries?