cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

rollyng
Journeyman III

Multi GPU gdb segmentation fault

Multi GPU compile+run SDK examples fine but debug causes segment fault

Hi all,

I am using ubuntu 10.10 with Eclipse 3.5 + CDT 6.0 as IDE. I have installed 11.3 driver and SDK 2.4 and have HD6990. It compiled and ran SDK examples without problem and I can see the console output which is fine.

However, once I set a break point in the .cpp file and run debug with standard gdb, it results in segment fault and fails to complete execution? It said " Stopped due to shared library event "

Has anyone tried such IDE config and help to solve the problem?

Thanks!

Here are the outputs from the debug console:

Reading symbols from /home/rolly/workspace/myCLinfo/Debug/myCLinfo...done.

Stopped due to shared library event
[Thread debugging using libthread_db enabled]
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event

I believe it may due to that gdb fails to find the shared lib?

So I did the following:

rolly@rolly-X8DTG-QF:~/workspace/myCLinfo/Debug$ ldd myCLinfo
    linux-vdso.so.1 =>  (0x00007fffab98e000)
    libOpenCL.so.1 => /usr/lib/libOpenCL.so.1 (0x00007f4047507000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f4047201000)
    libm.so.6 => /lib/libm.so.6 (0x00007f4046f7d000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f4046d67000)
    libc.so.6 => /lib/libc.so.6 (0x00007f40469e4000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f40467c6000)
    libdl.so.2 => /lib/libdl.so.2 (0x00007f40465c2000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f404772b000)

How can I add these to gdb in Eclipse? Thanks!

OK, let me go back to gdb in command prompt:

rolly@rolly-X8DTG-QF:~$ cd /home/rolly/workspace/myCLinfo/Debug
rolly@rolly-X8DTG-QF:~/workspace/myCLinfo/Debug$ gdb ./myCLinfo
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/rolly/workspace/myCLinfo/Debug/myCLinfo...done.
(gdb) r --debug
Starting program: /home/rolly/workspace/myCLinfo/Debug/myCLinfo --debug
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff41d5d60 in ?? () from /usr/lib/fglrx/libaticaldd.so
(gdb) c
Continuing.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.

Any hint?

0 Likes
21 Replies
himanshu_gautam
Grandmaster

Howto debug with Eclipse+CDT+gdb

Have you tried to find the place where seg fault occurs using GDB.

Also what do you get when you are using CPU instead of GPU first.

0 Likes
rollyng
Journeyman III

Howto debug with Eclipse+CDT+gdb

If I just run the binary:

rolly@rolly-X8DTG-QF:~/workspace/myCLinfo/Debug$ ./myCLinfo
Device Type:                     CL_DEVICE_TYPE_GPU
  Device ID:                     4098
  Max compute units:                 24
  Max work items dimensions:             3
    Max work items[0]:                 256
    Max work items[1]:                 256
    Max work items[2]:                 256
  Max work group size:                 256
  Preferred vector width char:             16
  Preferred vector width short:             8
  Preferred vector width int:             4
  Preferred vector width long:             2
  Preferred vector width float:             4
  Preferred vector width double:         0
  Native vector width char:             16
  Native vector width short:             8
  Native vector width int:             4
  Native vector width long:             2
  Native vector width float:             4
  Native vector width double:             0
  Max clock frequency:                 830Mhz
  Address bits:                     32
  Max memory allocation:             2147483648
  Image support:                 Yes
  Max number of images read arguments:         128
  Max number of images write arguments:         8
  Max image 2D width:                 8192
  Max image 2D height:                 8192
  Max image 3D width:                 2048
  Max image 3D height:                 2048
  Max image 3D depth:                 2048
  Max samplers within kernel:             16
  Max size of kernel argument:             1024
  Alignment (bits) of base address:         32768
  Minimum alignment (bytes) for any datatype:     128
  Single precision floating point capability
    Denorms:                     No
    Quiet NaNs:                     Yes
    Round to nearest even:             Yes
    Round to zero:                 Yes
    Round to +ve and infinity:             Yes
    IEEE754-2008 fused multiply-add:         Yes
  Cache type:                     None
  Cache line size:                 0
  Cache size:                     0
  Global memory size:                 2147483648
  Constant buffer size:                 65536
  Max number of constant args:             8
  Local memory type:                 Scratchpad
  Local memory size:                 32768
  Kernel Preferred work group size multiple:     64
  Error correction support:             0
  Unified memory for Host and Device:         0
  Profiling timer resolution:             1
  Device endianess:                 Little
  Available:                     Yes
  Compiler available:                 Yes
  Execution capabilities:                 
    Execute OpenCL kernels:             Yes
    Execute native function:             No
  Queue properties:                 
    Out-of-Order:                 No
    Profiling :                     Yes
  Platform ID:                     0x7f8c54cb4800
  Name:                         Cayman
  Vendor:                     Advanced Micro Devices, Inc.
  Driver version:                 CAL 1.4.1332
  Profile:                     FULL_PROFILE
  Version:                     OpenCL 1.1 AMD-APP-SDK-v2.4 (595.10)
  Extensions:                     cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_printf cl_amd_media_ops cl_amd_popcnt


  Device Type:                     CL_DEVICE_TYPE_CPU
  Device ID:                     4098
  Max compute units:                 16
  Max work items dimensions:             3
    Max work items[0]:                 1024
    Max work items[1]:                 1024
    Max work items[2]:                 1024
  Max work group size:                 1024
  Preferred vector width char:             16
  Preferred vector width short:             8
  Preferred vector width int:             4
  Preferred vector width long:             2
  Preferred vector width float:             4
  Preferred vector width double:         0
  Native vector width char:             16
  Native vector width short:             8
  Native vector width int:             4
  Native vector width long:             2
  Native vector width float:             4
  Native vector width double:             0
  Max clock frequency:                 1600Mhz
  Address bits:                     64
  Max memory allocation:             8449739776
  Image support:                 Yes
  Max number of images read arguments:         128
  Max number of images write arguments:         8
  Max image 2D width:                 8192
  Max image 2D height:                 8192
  Max image 3D width:                 2048
  Max image 3D height:                 2048
  Max image 3D depth:                 2048
  Max samplers within kernel:             16
  Max size of kernel argument:             4096
  Alignment (bits) of base address:         1024
  Minimum alignment (bytes) for any datatype:     128
  Single precision floating point capability
    Denorms:                     Yes
    Quiet NaNs:                     Yes
    Round to nearest even:             Yes
    Round to zero:                 Yes
    Round to +ve and infinity:             Yes
    IEEE754-2008 fused multiply-add:         No
  Cache type:                     Read/Write
  Cache line size:                 0
  Cache size:                     0
  Global memory size:                 33798959104
  Constant buffer size:                 65536
  Max number of constant args:             8
  Local memory type:                 Global
  Local memory size:                 32768
  Kernel Preferred work group size multiple:     1
  Error correction support:             0
  Unified memory for Host and Device:         1
  Profiling timer resolution:             1
  Device endianess:                 Little
  Available:                     Yes
  Compiler available:                 Yes
  Execution capabilities:                 
    Execute OpenCL kernels:             Yes
    Execute native function:             Yes
  Queue properties:                 
    Out-of-Order:                 No
    Profiling :                     Yes
  Platform ID:                     0x7f8c54cb4800
  Name:                         Intel(R) Xeon(R) CPU           E5620  @ 2.40GHz
  Vendor:                     GenuineIntel
  Driver version:                 2.0
  Profile:                     FULL_PROFILE
  Version:                     OpenCL 1.1 AMD-APP-SDK-v2.4 (595.10)
  Extensions:                     cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_byte_addressable_store cl_khr_gl_sharing cl_ext_device_fission cl_amd_device_attribute_query cl_amd_vec3 cl_amd_media_ops cl_amd_popcnt cl_amd_printf

It appears fine.

But if I do,

rolly@rolly-X8DTG-QF:~/workspace/myCLinfo/Debug$ gdb ./myCLinfo
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/rolly/workspace/myCLinfo/Debug/myCLinfo...done.
(gdb) r --debug
Starting program: /home/rolly/workspace/myCLinfo/Debug/myCLinfo --debug
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff41d5d60 in ?? () from /usr/lib/fglrx/libaticaldd.so
(gdb)

What have I done wrong with gdb? Thanks very much!

0 Likes
nou
Exemplar

Howto debug with Eclipse+CDT+gdb

write backtrace in gdb when it crash and you should get where it crash.

0 Likes
rollyng
Journeyman III

Howto debug with Eclipse+CDT+gdb

Thank you nou, here it is!

I can confirm that with NV hardware and NV SDK, gdb works fine with similar oclDeviceQuery example. Have I missed anything in my software configuration?

Thank you once more!

 

rolly@rolly-X8DTG-QF:~/workspace/myCLinfo/Debug$ gdb GNU gdb (GDB) 7.2-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. (gdb) file myCLinfo Reading symbols from /home/rolly/workspace/myCLinfo/Debug/myCLinfo...done. (gdb) break main Breakpoint 1 at 0x401aa8: file ../CLinfo.cpp, line 121. (gdb) run Starting program: /home/rolly/workspace/myCLinfo/Debug/myCLinfo [Thread debugging using libthread_db enabled] Breakpoint 1, main (argc=1, argv=0x7fffffffe298) at ../CLinfo.cpp:121 121 cl_int status = 0; (gdb) step 124 bool isGpu = true; (gdb) step 125 bool isVistaOrWin7 = false; (gdb) step 146 for(int i = 1; i < argc; i++) (gdb) step 155 std::vector<cl::Platform> platforms; (gdb) step std::vector<cl::Platform, std::allocator<cl::Platform> >::vector ( this=0x7fffffffdfa0) at /usr/include/c++/4.4/bits/stl_vector.h:208 208 : _Base() { } (gdb) step std::_Vector_base<cl::Platform, std::allocator<cl::Platform> >::_Vector_base ( this=0x7fffffffdfa0) at /usr/include/c++/4.4/bits/stl_vector.h:105 105 : _M_impl() { } (gdb) step std::_Vector_base<cl::Platform, std::allocator<cl::Platform> >::_Vector_impl::_Vector_impl (this=0x7fffffffdfa0) at /usr/include/c++/4.4/bits/stl_vector.h:81 81 : _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0) (gdb) step std::allocator<cl::Platform>::allocator (this=0x7fffffffdfa0) at /usr/include/c++/4.4/bits/allocator.h:101 101 allocator() throw() { } (gdb) step __gnu_cxx::new_allocator<cl::Platform>::new_allocator (this=0x7fffffffdfa0) at /usr/include/c++/4.4/ext/new_allocator.h:66 66 new_allocator() throw() { } (gdb) step std::_Vector_base<cl::Platform, std::allocator<cl::Platform> >::_Vector_impl::_Vector_impl (this=0x7fffffffdfa0) at /usr/include/c++/4.4/bits/stl_vector.h:82 82 { } (gdb) step main (argc=1, argv=0x7fffffffe298) at ../CLinfo.cpp:156 156 err = cl::Platform::get(&platforms); (gdb) step cl::Platform::get (platforms=0x7fffffffdfa0) at /home/rolly/AMD-APP-SDK-v2.4-lnx64/include/CL/cl.hpp:1469 1469 static cl_int get( (gdb) step 1472 cl_uint n = 0; (gdb) step 1473 cl_int err = ::clGetPlatformIDs(0, NULL, &n); (gdb) step Program received signal SIGSEGV, Segmentation fault. 0x00007ffff41d5d60 in ?? () from /usr/lib/fglrx/libaticaldd.so (gdb) backtrace #0 0x00007ffff41d5d60 in ?? () from /usr/lib/fglrx/libaticaldd.so #1 0x00007ffff41ca55d in ?? () from /usr/lib/fglrx/libaticaldd.so #2 0x00007ffff41ca61d in ?? () from /usr/lib/fglrx/libaticaldd.so #3 0x00007ffff4049933 in ?? () from /usr/lib/fglrx/libaticaldd.so #4 0x00007ffff421a973 in ?? () from /usr/lib/fglrx/libaticaldd.so #5 0x00007ffff421557d in ?? () from /usr/lib/fglrx/libaticaldd.so #6 0x00007ffff42155ec in ?? () from /usr/lib/fglrx/libaticaldd.so #7 0x00007ffff422b43f in ?? () from /usr/lib/fglrx/libaticaldd.so #8 0x00007ffff422b1bd in ?? () from /usr/lib/fglrx/libaticaldd.so #9 0x00007ffff4227129 in ?? () from /usr/lib/fglrx/libaticaldd.so #10 0x00007ffff592ac8c in ?? () from /usr/lib/libamdocl64.so #11 0x00007ffff592b240 in ?? () from /usr/lib/libamdocl64.so #12 0x00007ffff59098d3 in ?? () from /usr/lib/libamdocl64.so #13 0x00007ffff595d94a in ?? () from /usr/lib/libamdocl64.so #14 0x00007ffff58ea3f9 in clGetPlatformInfo () from /usr/lib/libamdocl64.so #15 0x00007ffff7bd8e7d in ?? () from /usr/lib/libOpenCL.so.1 #16 0x00007ffff7bda763 in ?? () from /usr/lib/libOpenCL.so.1 #17 0x00007ffff7bda0a0 in clGetPlatformIDs () from /usr/lib/libOpenCL.so.1 #18 0x00000000004046a3 in cl::Platform::get (platforms=0x7fffffffdfa0) at /home/rolly/AMD-APP-SDK-v2.4-lnx64/include/CL/cl.hpp:1473 #19 0x0000000000401b1a in main (argc=1, argv=0x7fffffffe298) at ../CLinfo.cpp:156

0 Likes
himanshu_gautam
Grandmaster

Howto debug with Eclipse+CDT+gdb

Okay. HAve you done any changes to the clInfo Code. By the I don't think we are shipping the code of clInfo Now.

Please Post the code if you have done some changes to it. I will try it on my system.

0 Likes
rollyng
Journeyman III

Howto debug with Eclipse+CDT+gdb

Thanks himanshu,

I just simply copy the clinfo example from Windows SDK and paste it into Eclipse

Am I wrong of not removing the WIN32 syntax?

Thanks very much!

#include <iostream> #include <string> #include <cstdlib> #include <cstdio> #if !defined(_WIN32) #include <errno.h> #endif #define __CL_ENABLE_EXCEPTIONS #define __NO_STD_STRING #define __MAX_DEFAULT_VECTOR_SIZE 5000 #pragma warning(disable: 4290) #include <CL/cl.hpp> inline void checkErr(cl_int err, const char * name) { if (err != CL_SUCCESS) { std::cerr << "ERROR: " << name << " (" << err << ")" << std::endl; exit(1); } } int main(int argc, char** argv) { /* Error flag */ cl_int status = 0; /* Extensions verification flags */ bool isGpu = true; bool isVistaOrWin7 = false; //#ifdef _WIN32 // // Find the version of Windows // OSVERSIONINFO vInfo; // memset(&vInfo, 0, sizeof(vInfo)); // vInfo.dwOSVersionInfoSize = sizeof(vInfo); // if(!GetVersionEx(&vInfo)) // { // DWORD dwErr = GetLastError(); // std::cout << "\nERROR : Unable to get Windows version information.\n" << std::endl; // return 1; // } // // if(vInfo.dwMajorVersion >= 6) // { // isVistaOrWin7 = true; // } //#endif /* Check if sample is run for cpu */ for(int i = 1; i < argc; i++) { if(!strcmp("cpu", argv)) isGpu = false; } cl_int err; // Platform info std::vector<cl::Platform> platforms; err = cl::Platform::get(&platforms); checkErr( err && (platforms.size() == 0 ? -1 : CL_SUCCESS), "cl::Platform::get()"); try { // Iteratate over platforms std::cout << "Number of platforms:\t\t\t\t " << platforms.size() << std::endl; for (std::vector<cl::Platform>::iterator i = platforms.begin(); i != platforms.end(); ++i) { std::cout << " Platform Profile:\t\t\t\t " << (*i).getInfo<CL_PLATFORM_PROFILE>().c_str() << std::endl; std::cout << " Platform Version:\t\t\t\t " << (*i).getInfo<CL_PLATFORM_VERSION>().c_str() << std::endl; std::cout << " Platform Name:\t\t\t\t " << (*i).getInfo<CL_PLATFORM_NAME>().c_str() << std::endl; std::cout << " Platform Vendor:\t\t\t\t " << (*i).getInfo<CL_PLATFORM_VENDOR>().c_str() << std::endl; if ((*i).getInfo<CL_PLATFORM_EXTENSIONS>().size() > 0) { std::cout << " Platform Extensions:\t\t\t\t " << (*i).getInfo<CL_PLATFORM_EXTENSIONS>().c_str() << std::endl; } } std::cout << std::endl << std:: endl; // Now Iteratate over each platform and its devices for (std::vector<cl::Platform>::iterator p = platforms.begin(); p != platforms.end(); ++p) { std::cout << " Platform Name:\t\t\t\t " << (*p).getInfo<CL_PLATFORM_NAME>().c_str() << std::endl; std::vector<cl::Device> devices; (*p).getDevices(CL_DEVICE_TYPE_ALL, &devices); std::cout << "Number of devices:\t\t\t\t " << devices.size() << std::endl; for (std::vector<cl::Device>::iterator i = devices.begin(); i != devices.end(); ++i) { /* Get device name */ cl::string deviceName = (*i).getInfo<CL_DEVICE_NAME>(); cl_device_type dtype = (*i).getInfo<CL_DEVICE_TYPE>(); /* Get CAL driver version in int */ cl::string driverVersion = (*i).getInfo<CL_DRIVER_VERSION>(); std::string calVersion(driverVersion.c_str()); calVersion = calVersion.substr(calVersion.find_last_of(".") + 1); int version = atoi(calVersion.c_str()); std::cout << " Device Type:\t\t\t\t\t " ; switch (dtype) { case CL_DEVICE_TYPE_ACCELERATOR: std::cout << "CL_DEVICE_TYPE_ACCRLERATOR" << std::endl; break; case CL_DEVICE_TYPE_CPU: std::cout << "CL_DEVICE_TYPE_CPU" << std::endl; break; case CL_DEVICE_TYPE_DEFAULT: std::cout << "CL_DEVICE_TYPE_DEFAULT" << std::endl; break; case CL_DEVICE_TYPE_GPU: std::cout << "CL_DEVICE_TYPE_GPU" << std::endl; break; } std::cout << " Device ID:\t\t\t\t\t " << (*i).getInfo<CL_DEVICE_VENDOR_ID>() << std::endl; std::cout << " Max compute units:\t\t\t\t " << (*i).getInfo<CL_DEVICE_MAX_COMPUTE_UNITS>() << std::endl; std::cout << " Max work items dimensions:\t\t\t " << (*i).getInfo<CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS>() << std::endl; std::vector< ::size_t> witems = (*i).getInfo<CL_DEVICE_MAX_WORK_ITEM_SIZES>(); for (unsigned int x = 0; x < (*i).getInfo<CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS>(); x++) { std::cout << " Max work items[" << x << "]:\t\t\t\t " << witems << std::endl; } std::cout << " Max work group size:\t\t\t\t " << (*i).getInfo<CL_DEVICE_MAX_WORK_GROUP_SIZE>() << std::endl; std::cout << " Preferred vector width char:\t\t\t " << (*i).getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR>() << std::endl; std::cout << " Preferred vector width short:\t\t\t " << (*i).getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT>() << std::endl; std::cout << " Preferred vector width int:\t\t\t " << (*i).getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT>() << std::endl; std::cout << " Preferred vector width long:\t\t\t " << (*i).getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG>() << std::endl; std::cout << " Preferred vector width float:\t\t\t " << (*i).getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT>() << std::endl; std::cout << " Preferred vector width double:\t\t " << (*i).getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE>() << std::endl; #ifdef CL_VERSION_1_1 std::cout << " Native vector width char:\t\t\t " << (*i).getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR>() << std::endl; std::cout << " Native vector width short:\t\t\t " << (*i).getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT>() << std::endl; std::cout << " Native vector width int:\t\t\t " << (*i).getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_INT>() << std::endl; std::cout << " Native vector width long:\t\t\t " << (*i).getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG>() << std::endl; std::cout << " Native vector width float:\t\t\t " << (*i).getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT>() << std::endl; std::cout << " Native vector width double:\t\t\t " << (*i).getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE>() << std::endl; #endif // CL_VERSION_1_1 std::cout << " Max clock frequency:\t\t\t\t " << (*i).getInfo<CL_DEVICE_MAX_CLOCK_FREQUENCY>() << "Mhz" << std::endl; std::cout << " Address bits:\t\t\t\t\t " << (*i).getInfo<CL_DEVICE_ADDRESS_BITS>() << std::endl; std::cout << " Max memory allocation:\t\t\t " << (*i).getInfo<CL_DEVICE_MAX_MEM_ALLOC_SIZE>() << std::endl; std::cout << " Image support:\t\t\t\t " << ((*i).getInfo<CL_DEVICE_IMAGE_SUPPORT>() ? "Yes" : "No") << std::endl; if ((*i).getInfo<CL_DEVICE_IMAGE_SUPPORT>()) { std::cout << " Max number of images read arguments:\t\t " << (*i).getInfo<CL_DEVICE_MAX_READ_IMAGE_ARGS>() << std::endl; std::cout << " Max number of images write arguments:\t\t " << (*i).getInfo<CL_DEVICE_MAX_WRITE_IMAGE_ARGS>() << std::endl; std::cout << " Max image 2D width:\t\t\t\t " << (*i).getInfo<CL_DEVICE_IMAGE2D_MAX_WIDTH>() << std::endl; std::cout << " Max image 2D height:\t\t\t\t " << (*i).getInfo<CL_DEVICE_IMAGE2D_MAX_HEIGHT>() << std::endl; std::cout << " Max image 3D width:\t\t\t\t " << (*i).getInfo<CL_DEVICE_IMAGE3D_MAX_WIDTH>() << std::endl; std::cout << " Max image 3D height:\t\t\t\t " << (*i).getInfo<CL_DEVICE_IMAGE3D_MAX_HEIGHT>() << std::endl; std::cout << " Max image 3D depth:\t\t\t\t " << (*i).getInfo<CL_DEVICE_IMAGE3D_MAX_DEPTH>() << std::endl; std::cout << " Max samplers within kernel:\t\t\t " << (*i).getInfo<CL_DEVICE_MAX_SAMPLERS>() << std::endl; } std::cout << " Max size of kernel argument:\t\t\t " << (*i).getInfo<CL_DEVICE_MAX_PARAMETER_SIZE>() << std::endl; std::cout << " Alignment (bits) of base address:\t\t " << (*i).getInfo<CL_DEVICE_MEM_BASE_ADDR_ALIGN>() << std::endl; std::cout << " Minimum alignment (bytes) for any datatype:\t " << (*i).getInfo<CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE>() << std::endl; std::cout << " Single precision floating point capability" << std::endl; std::cout << " Denorms:\t\t\t\t\t " << ((*i).getInfo<CL_DEVICE_SINGLE_FP_CONFIG>() & CL_FP_DENORM ? "Yes" : "No") << std::endl; std::cout << " Quiet NaNs:\t\t\t\t\t " << ((*i).getInfo<CL_DEVICE_SINGLE_FP_CONFIG>() & CL_FP_INF_NAN ? "Yes" : "No") << std::endl; std::cout << " Round to nearest even:\t\t\t " << ((*i).getInfo<CL_DEVICE_SINGLE_FP_CONFIG>() & CL_FP_ROUND_TO_NEAREST ? "Yes" : "No") << std::endl; std::cout << " Round to zero:\t\t\t\t " << ((*i).getInfo<CL_DEVICE_SINGLE_FP_CONFIG>() & CL_FP_ROUND_TO_ZERO ? "Yes" : "No") << std::endl; std::cout << " Round to +ve and infinity:\t\t\t " << ((*i).getInfo<CL_DEVICE_SINGLE_FP_CONFIG>() & CL_FP_ROUND_TO_INF ? "Yes" : "No") << std::endl; std::cout << " IEEE754-2008 fused multiply-add:\t\t " << ((*i).getInfo<CL_DEVICE_SINGLE_FP_CONFIG>() & CL_FP_FMA ? "Yes" : "No") << std::endl; std::cout << " Cache type:\t\t\t\t\t " ; switch ((*i).getInfo<CL_DEVICE_GLOBAL_MEM_CACHE_TYPE>()) { case CL_NONE: std::cout << "None" << std::endl; break; case CL_READ_ONLY_CACHE: std::cout << "Read only" << std::endl; break; case CL_READ_WRITE_CACHE: std::cout << "Read/Write" << std::endl; break; } std::cout << " Cache line size:\t\t\t\t " << (*i).getInfo<CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE>() << std::endl; std::cout << " Cache size:\t\t\t\t\t " << (*i).getInfo<CL_DEVICE_GLOBAL_MEM_CACHE_SIZE>() << std::endl; std::cout << " Global memory size:\t\t\t\t " << (*i).getInfo<CL_DEVICE_GLOBAL_MEM_SIZE>() << std::endl; std::cout << " Constant buffer size:\t\t\t\t " << (*i).getInfo<CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE>() << std::endl; std::cout << " Max number of constant args:\t\t\t " << (*i).getInfo<CL_DEVICE_MAX_CONSTANT_ARGS>() << std::endl; std::cout << " Local memory type:\t\t\t\t " ; switch ((*i).getInfo<CL_DEVICE_LOCAL_MEM_TYPE>()) { case CL_LOCAL: std::cout << "Scratchpad" << std::endl; break; case CL_GLOBAL: std::cout << "Global" << std::endl; break; } std::cout << " Local memory size:\t\t\t\t " << (*i).getInfo<CL_DEVICE_LOCAL_MEM_SIZE>() << std::endl; #ifdef CL_VERSION_1_1 cl_context_properties cps[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties)(*p)(), 0 }; std::vector<cl::Device> device; device.push_back(*i); cl::Context context(device, cps, NULL, NULL, &err); if (err != CL_SUCCESS) { std::cerr << "Context::Context() failed (" << err << ")\n"; return 1; } std::string kernelStr("__kernel void hello(){ size_t i = get_global_id(0); size_t j = get_global_id(1);}"); cl::Program::Sources sources(1, std::make_pair(kernelStr.data(), kernelStr.size())); cl::Program program = cl::Program(context, sources, &err); if (err != CL_SUCCESS) { std::cerr << "Program::Program() failed (" << err << ")\n"; return 1; } err = program.build(device); if (err != CL_SUCCESS) { if(err == CL_BUILD_PROGRAM_FAILURE) { cl::string str = program.getBuildInfo<CL_PROGRAM_BUILD_LOG>((*i)); std::cout << " \n\t\t\tBUILD LOG\n"; std::cout << " ************************************************\n"; std::cout << str.c_str() << std::endl; std::cout << " ************************************************\n"; } std::cerr << "Program::build() failed (" << err << ")\n"; return 1; } cl::Kernel kernel(program, "hello", &err); if (err != CL_SUCCESS) { std::cerr << "Kernel::Kernel() failed (" << err << ")\n"; return 1; } std::cout << " Kernel Preferred work group size multiple:\t " << kernel.getWorkGroupInfo<CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE>((*i), &err) << std::endl; #endif // CL_VERSION_1_1 std::cout << " Error correction support:\t\t\t " << (*i).getInfo<CL_DEVICE_ERROR_CORRECTION_SUPPORT>() << std::endl; #ifdef CL_VERSION_1_1 std::cout << " Unified memory for Host and Device:\t\t " << (*i).getInfo<CL_DEVICE_HOST_UNIFIED_MEMORY>() << std::endl; #endif // CL_VERSION_1_1 std::cout << " Profiling timer resolution:\t\t\t " << (*i).getInfo<CL_DEVICE_PROFILING_TIMER_RESOLUTION>() << std::endl; std::cout << " Device endianess:\t\t\t\t " << ((*i).getInfo<CL_DEVICE_ENDIAN_LITTLE>() ? "Little" : "Big") << std::endl; std::cout << " Available:\t\t\t\t\t " << ((*i).getInfo<CL_DEVICE_AVAILABLE>() ? "Yes" : "No") << std::endl; std::cout << " Compiler available:\t\t\t\t " << ((*i).getInfo<CL_DEVICE_COMPILER_AVAILABLE>() ? "Yes" : "No") << std::endl; std::cout << " Execution capabilities:\t\t\t\t " << std::endl; std::cout << " Execute OpenCL kernels:\t\t\t " << ((*i).getInfo<CL_DEVICE_EXECUTION_CAPABILITIES>() & CL_EXEC_KERNEL ? "Yes" : "No") << std::endl; std::cout << " Execute native function:\t\t\t " << ((*i).getInfo<CL_DEVICE_EXECUTION_CAPABILITIES>() & CL_EXEC_NATIVE_KERNEL ? "Yes" : "No") << std::endl; std::cout << " Queue properties:\t\t\t\t " << std::endl; std::cout << " Out-of-Order:\t\t\t\t " << ((*i).getInfo<CL_DEVICE_QUEUE_PROPERTIES>() & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE ? "Yes" : "No") << std::endl; std::cout << " Profiling :\t\t\t\t\t " << ((*i).getInfo<CL_DEVICE_QUEUE_PROPERTIES>() & CL_QUEUE_PROFILING_ENABLE ? "Yes" : "No") << std::endl; std::cout << " Platform ID:\t\t\t\t\t " << (*i).getInfo<CL_DEVICE_PLATFORM>() << std::endl; std::cout << " Name:\t\t\t\t\t\t " << (*i).getInfo<CL_DEVICE_NAME>().c_str() << std::endl; std::cout << " Vendor:\t\t\t\t\t " << (*i).getInfo<CL_DEVICE_VENDOR>().c_str() << std::endl; #ifdef CL_VERSION_1_1 //std::cout << " Device OpenCL C version:\t\t\t " // << (*i).getInfo<CL_DEVICE_OPENCL_C_VERSION>().c_str() // << std::endl; #endif // CL_VERSION_1_1 std::cout << " Driver version:\t\t\t\t " << (*i).getInfo<CL_DRIVER_VERSION>().c_str() << std::endl; std::cout << " Profile:\t\t\t\t\t " << (*i).getInfo<CL_DEVICE_PROFILE>().c_str() << std::endl; std::cout << " Version:\t\t\t\t\t " << (*i).getInfo<CL_DEVICE_VERSION>().c_str() << std::endl; std::cout << " Extensions:\t\t\t\t\t " << (*i).getInfo<CL_DEVICE_EXTENSIONS>().c_str() << std::endl; std::cout << std::endl << std::endl; } } } catch (cl::Error err) { std::cerr << "ERROR: " << err.what() << "(" << err.err() << ")" << std::endl; } return status; }

0 Likes
rollyng
Journeyman III

Howto debug with Eclipse+CDT+gdb

I double check gdb with SDK example HelloCL, it also ends with segmentation fault, please find the output below, is this a bug in the SDK?

 

rolly@rolly-X8DTG-QF:~/AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86_64$ gdb GNU gdb (GDB) 7.2-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. (gdb) file HelloCL Reading symbols from /home/rolly/AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86_64/HelloCL...done. (gdb) break main Breakpoint 1 at 0x401b72: file HelloCL.cpp, line 113. (gdb) run Starting program: /home/rolly/AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86_64/HelloCL [Thread debugging using libthread_db enabled] Breakpoint 1, main () at HelloCL.cpp:113 113 std::vector<cl::Platform> platforms; (gdb) step std::vector<cl::Platform, std::allocator<cl::Platform> >::vector ( this=0x7fffffffe0a0) at /usr/include/c++/4.4/bits/stl_vector.h:208 208 : _Base() { } (gdb) step std::_Vector_base<cl::Platform, std::allocator<cl::Platform> >::_Vector_base ( this=0x7fffffffe0a0) at /usr/include/c++/4.4/bits/stl_vector.h:105 105 : _M_impl() { } (gdb) step std::_Vector_base<cl::Platform, std::allocator<cl::Platform> >::_Vector_impl::_Vector_impl (this=0x7fffffffe0a0) at /usr/include/c++/4.4/bits/stl_vector.h:81 81 : _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0) (gdb) step std::allocator<cl::Platform>::allocator (this=0x7fffffffe0a0) at /usr/include/c++/4.4/bits/allocator.h:101 101 allocator() throw() { } (gdb) step __gnu_cxx::new_allocator<cl::Platform>::new_allocator (this=0x7fffffffe0a0) at /usr/include/c++/4.4/ext/new_allocator.h:66 66 new_allocator() throw() { } (gdb) step std::_Vector_base<cl::Platform, std::allocator<cl::Platform> >::_Vector_impl::_Vector_impl (this=0x7fffffffe0a0) at /usr/include/c++/4.4/bits/stl_vector.h:82 82 { } (gdb) step main () at HelloCL.cpp:114 114 std::cout<<"HelloCL!\nGetting Platform Information\n"; (gdb) step HelloCL! Getting Platform Information 115 err = cl::Platform::get(&platforms); (gdb) step cl::Platform::get (platforms=0x7fffffffe0a0) at ../../../../../include/CL/cl.hpp:1469 1469 static cl_int get( (gdb) step 1472 cl_uint n = 0; (gdb) step 1473 cl_int err = ::clGetPlatformIDs(0, NULL, &n); (gdb) step Program received signal SIGSEGV, Segmentation fault. 0x00007ffff41d5d60 in ?? () from /usr/lib/fglrx/libaticaldd.so (gdb) backtrace #0 0x00007ffff41d5d60 in ?? () from /usr/lib/fglrx/libaticaldd.so #1 0x00007ffff41ca55d in ?? () from /usr/lib/fglrx/libaticaldd.so #2 0x00007ffff41ca61d in ?? () from /usr/lib/fglrx/libaticaldd.so #3 0x00007ffff4049933 in ?? () from /usr/lib/fglrx/libaticaldd.so #4 0x00007ffff421a973 in ?? () from /usr/lib/fglrx/libaticaldd.so #5 0x00007ffff421557d in ?? () from /usr/lib/fglrx/libaticaldd.so #6 0x00007ffff42155ec in ?? () from /usr/lib/fglrx/libaticaldd.so #7 0x00007ffff422b43f in ?? () from /usr/lib/fglrx/libaticaldd.so #8 0x00007ffff422b1bd in ?? () from /usr/lib/fglrx/libaticaldd.so #9 0x00007ffff4227129 in ?? () from /usr/lib/fglrx/libaticaldd.so #10 0x00007ffff592ac8c in ?? () from /usr/lib/libamdocl64.so #11 0x00007ffff592b240 in ?? () from /usr/lib/libamdocl64.so #12 0x00007ffff59098d3 in ?? () from /usr/lib/libamdocl64.so #13 0x00007ffff595d94a in ?? () from /usr/lib/libamdocl64.so #14 0x00007ffff58ea3f9 in clGetPlatformInfo () from /usr/lib/libamdocl64.so #15 0x00007ffff77b7e7d in ?? () from /usr/lib/libOpenCL.so.1 #16 0x00007ffff77b9763 in ?? () from /usr/lib/libOpenCL.so.1 #17 0x00007ffff77b90a0 in clGetPlatformIDs () from /usr/lib/libOpenCL.so.1 #18 0x000000000040295f in cl::Platform::get (platforms=0x7fffffffe0a0) at ../../../../../include/CL/cl.hpp:1473 #19 0x0000000000401b9f in main () at HelloCL.cpp:115 (gdb)

0 Likes
himanshu_gautam
Grandmaster

Howto debug with Eclipse+CDT+gdb

It appears to be a installation problem. Have you done ICD registration properly.

Try after uninstalling & reinstalling.

Are you able to compile any sample properly.

0 Likes
rollyng
Journeyman III

Howto debug with gdb?

Hi himanshu,

Thank you! I install the SDK with nou's SDK package posted on this forum and i am not sure how to check if ICD has been registered properly, but I can complie the SDK examples and run them without any issue as shown above. I only encounter segmentation fault with debug mode.

I have checked nou's package, there is one 'amd-app_2.4_amd64.deb' which inlcudes icd files such as /etc/OpenCL/vendors/amdocl64.icd and amdocl32.icd, so I believe by installing nou's package I should have these icd files inserted into these directory and all SDK examples can now be compiled and run but not debug?

Could you please help? Thanks a lot!

0 Likes