Open MPI logo

Hardware Locality Users' Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Users mailing list

Subject: Re: [hwloc-users] Trying to get last cpu location
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2013-03-05 16:02:01


I don't see any obvious problem in the code.
Are you sure you're not using an old hwloc by mistake?
Can you add this after #include <hwloc.h> and compile again ?
#if HWLOC_API_VERSION < 0x00010200
#error Too old
#endif

Brice

Le 05/03/2013 21:58, Fabio Tordini a écrit :
> I'm using release 1.6.1 and, as I said, it is the only weird behaviour
> I'm experiencing.
>
> the test program is actually very straight and easy: I load and
> initialise the topology, perform some checks on current bindings and
> the try to get the current thread's location, so that I can bind it to
> the nodeset it belongs to:
>
> hwloc_topology_init(&topo);
> hwloc_topology_load(topo);
>
> ...
>
> hwloc_bitmap_t cpuset = hwloc_bitmap_alloc();
> hwloc_bitmap_t nodeset = hwloc_bitmap_alloc();
> char *str;
>
> ...
>
> if( hwloc_get_last_cpu_location(topology, cpuset,
> HWLOC_CPUBIND_THREAD) < 0 )
> abort();
> hwloc_bitmap_asprintf(&str, cpuset);
> printf("current thread running on cpuset %s\n", str);
> free(str);
>
> hwloc_cpuset_from_nodeset(topology, cpuset, nodeset);
> if( hwloc_set_membind_nodeset(topology, nodeset, HWLOC_MEMBIND_BIND,
> HWLOC_MEMBIND_THREAD) < 0 )
> abort();
>
> ...
>
>
> if( hwloc_get_last_cpu_location(topology, cpuset,
> HWLOC_CPUBIND_THREAD) < 0 )
> abort();
> hwloc_bitmap_asprintf(&str, cpuset);
> printf("current thread running on cpuset %s\n", str);
> free(str);
>
> hwloc_cpuset_from_nodeset(topology, cpuset, nodeset);
> if( hwloc_set_membind_nodeset(topology, nodeset, HWLOC_MEMBIND_BIND,
> HWLOC_MEMBIND_THREAD) < 0 )
> abort();
>
> ...
>
> I omitted some out-of-the-scope parts, but this is mostly it: is there
> something wrong?
> Fabio
>
>
> On 05/03/13 18:25, Brice Goglin wrote:
>> Hello Fabio,
>> Which hwloc release are you using ? get_last_cpu_location() was only
>> added in hwloc v1.2. It has always been available since then, even on
>> when not supported (it will return -1 with errno=ENOSYS in this case).
>> If this doesn't help, can you send your test program?
>> Brice
>>
>>
>>
>> Le 05/03/2013 18:01, Fabio Tordini a écrit :
>>> Hello,
>>>
>>> I'm experiencing a problem using the function
>>> 'hwloc_get_last_cpu_location(...)': when compiling i first get a
>>> warning about an implicit declaration of the function, and then it
>>> gives an "undefined reference" error.
>>> Everything else works just fine and I was thinking whether I have to
>>> link some other libraries or perform some other actions in order to be
>>> able to use the function.
>>>
>>> The tests I'm executing are run on a x86_64 GNU/Linux machine, and as
>>> far as I know that function should be totally supported on Linux
>>> systems.
>>>
>>> thanks,
>>> Fabio
>>>
>>> _______________________________________________
>>> hwloc-users mailing list
>>> hwloc-users_at_[hidden]
>>> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users
>