tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Strange pthread_self() return value

For some trivia/background, I am working on OpenCL support (some parallel
computing standard that someone mentioned wanting) in pkgsrc.

I've ported a "portable" CPU-based OpenCL implementation (parallel/pocl)
to NetBSD.

However, currently all reference OpenCL programs linked with -lOpenCL
fail, such as this one:

The segfault is actually in hwloc, a library used by OpenCL:

Program received signal SIGSEGV, Segmentation fault.                                                               
0x0000764e5660a2c8 in pthread_getaffinity_np () from /usr/lib/
(gdb) bt
#0  0x0000764e5660a2c8 in pthread_getaffinity_np () from /usr/lib/
#1  0x0000764e5ec1f86e in hwloc_netbsd_get_thread_cpubind (topology=topology@entry=0x764e60060000, 
    tid=0xffffffffffffffff, hwloc_cpuset=hwloc_cpuset@entry=0x764e60078a80, flags=flags@entry=4)
    at topology-netbsd.c:112                             
#2  0x0000764e5ec1f8d3 in hwloc_netbsd_get_thisthread_cpubind (topology=0x764e60060000, 
    hwloc_cpuset=0x764e60078a80, flags=4) at topology-netbsd.c:133

Notice how "tid" is 0xffffffffffffffff. Attempting to set the affinity
of thread "0xffffffffffffffff" obviously fails.

However, this value comes from the return value of pthread_self():

static int
hwloc_netbsd_get_thisthread_cpubind(hwloc_topology_t topology, hwloc_bitmap_t hwloc_cpuset, int flags)
  return hwloc_netbsd_get_thread_cpubind(topology, pthread_self(), hwloc_cpuset, flags);

What's going on?

Home | Main Index | Thread Index | Old Index