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: Fabio Tordini (tordini_at_[hidden])
Date: 2013-03-05 15:58:16


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

-- 
Fabio Tordini
PhD Candidate
Computer Science Department
University of Torino