cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
161 Views
Registered: ‎04-28-2020

OpenCL Singleton Ctor error on U250 sw_emu

I am getting a runtime_error exception running in sw_emu. I'm building C++ host code using Vitis 2020.1 xocc compiler on RedHat 7.9. The same configuration works on an Ubuntu 18.04 machine with the same version of Vitis. Here is my stack trace starting at the call to get_xil_devices(). It seems to be associated with /opt/xilinx/xrt/lib/libxrt_core. XCL_EMULATION_MODE=sw_emu. 

The error I'm getting is:

 

terminate called after throwing an instance of 'std::runtime_error'
  what():  singleton ctor error

 

My test program is:

 

#define CL_HPP_TARGET_OPENCL_VERSION 120
#define CL_HPP_MINIMUM_OPENCL_VERSION 120
#include <CL/cl2.hpp>
#include <iostream>
int main()
{
   int err;
   std::vector<cl::Platform> platforms;
   cl::Platform::get(&platforms);   // <-- Errors out here
   for (auto &p : platforms) {
      std::cout<<"   "<<p.getInfo<CL_PLATFORM_NAME>(&err)<<std::endl;
   }
   return 0;
}

 

Note that the program only depends on OpenCL, not any Xilinx library. It works fine when I don't include libxrt_core.so. But as soon as that lib is added (because my real app needs it), I get the singleton error. In gdb, the backtrace shows:

#0 0x00007ffff3aba387 in raise () from /lib64/libc.so.6
#1 0x00007ffff3abba78 in abort () from /lib64/libc.so.6
#2 0x00007ffff43fa33d in __gnu_cxx::__verbose_terminate_handler () at ../../../../../src/lnx64/libstdc++-v3/libsupc++/vterminate.cc:95
#3 0x00007ffff43f8316 in __cxxabiv1::__terminate (handler=<optimized out>)
at ../../../../../src/lnx64/libstdc++-v3/libsupc++/eh_terminate.cc:47
#4 0x00007ffff43f7349 in __cxa_call_terminate (ue_header=ue_header@entry=0x706ed0)
at ../../../../../src/lnx64/libstdc++-v3/libsupc++/eh_call.cc:54
#5 0x00007ffff43f7c9d in __cxxabiv1::__gxx_personality_v0 (version=<optimized out>, actions=<optimized out>, 
exception_class=5138137972254386944, ue_header=<optimized out>, context=0x7fffffffbcb0)
at ../../../../../src/lnx64/libstdc++-v3/libsupc++/eh_personality.cc:676
#6 0x00007ffff3e61f43 in _Unwind_RaiseException_Phase2 (exc=exc@entry=0x706ed0, context=context@entry=0x7fffffffbcb0)
at ../../../../src/lnx64/libgcc/unwind.inc:62
#7 0x00007ffff3e62447 in _Unwind_Resume (exc=0x706ed0) at ../../../../src/lnx64/libgcc/unwind.inc:230
#8 0x00007ffff14abd70 in (anonymous namespace)::singleton_instance() [clone .cold] () from /opt/xilinx/xrt/lib/libxrt_swemu.so
#9 0x00007ffff7dea9c3 in _dl_init_internal () from /lib64/ld-linux-x86-64.so.2
#10 0x00007ffff7def59e in dl_open_worker () from /lib64/ld-linux-x86-64.so.2
#11 0x00007ffff7dea7d4 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
#12 0x00007ffff7deeb8b in _dl_open () from /lib64/ld-linux-x86-64.so.2
#13 0x00007ffff334cfab in dlopen_doit () from /lib64/libdl.so.2
#14 0x00007ffff7dea7d4 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
#15 0x00007ffff334d5ad in _dlerror_run () from /lib64/libdl.so.2
#16 0x00007ffff334d041 in dlopen@@GLIBC_2.2.5 () from /lib64/libdl.so.2
#17 0x00007ffff3a52e12 in (anonymous namespace)::createHalDevices(std::vector<std::unique_ptr<xrt::hal::device, std::default_delete<xrt::hal::device> >, std::allocator<std::unique_ptr<xrt::hal::device, std::default_delete<xrt::hal::device> > > >&, std::string const&, unsigned int) [clone .constprop.0] () from /opt/xilinx/xrt/lib/libxrt++.so.2
#18 0x00007ffff3a5368d in xrt::hal::loadDevices() () from /opt/xilinx/xrt/lib/libxrt++.so.2
#19 0x00007ffff7fa5482 in std::vector<xrt::device, std::allocator<std::vector> > xrt::loadDevices<xrt::loadDevices()::{lambda(std::string const&)#1}>(xrt::loadDevices()::{lambda(std::string const&)#1}) () from /opt/xilinx/xrt/lib/libxilinxopencl.so.2
#20 0x00007ffff7fa438e in xocl::platform::platform() () from /opt/xilinx/xrt/lib/libxilinxopencl.so.2
#21 0x00007ffff7fa49b9 in xocl::platform::get_shared_platform() () from /opt/xilinx/xrt/lib/libxilinxopencl.so.2
#22 0x00007ffff7fa4a58 in xocl::get_global_platform() () from /opt/xilinx/xrt/lib/libxilinxopencl.so.2
#23 0x00007ffff7f5606e in xocl::clGetPlatformIDs(unsigned int, _cl_platform_id**, unsigned int*) ()
from /opt/xilinx/xrt/lib/libxilinxopencl.so.2
#24 0x00007ffff7f5614a in clGetPlatformIDs () from /opt/xilinx/xrt/lib/libxilinxopencl.so.2
#25 0x0000000000448f7b in cl::Platform::get (platforms=0x7fffffffc770) at /usr/include/CL/cl2.hpp:2475
#26 0x0000000000447f8d in xcl::get_devices (vendor_name=...) at /home/okramer/dev/ortho/host/xcl2.cpp:41
#27 0x0000000000448585 in xcl::get_xil_devices () at /home/okramer/dev/ortho/host/xcl2.cpp:64

 

Tags (4)
0 Kudos
0 Replies