Dear all,

I want to use hwloc to determine the location of a process or thread 
on a node in an HPC environment. There I'd usually assume that 
processes/threads are already bound to specific PUs and I also assume 
the runtime is handling this part. 

I just want to record the location, and use this location data in 
further analysis. 

Now, I am having difficulties in trying to figure out how to employ  
hwloc correctly to get the information I want and I would appreciate 
it greatly if you could shed some light into this.  

First, I am currently testing not on an HPC platform but on my local 
MacBookPro with Mac OS X 10.6.8. There the processes are not bound, so
I have to use last_location, right?

I wrote a small program to just dump my location to stdout. 

In my current understanding I would have to:
1) Initialize and load topology
2) Get CPU location/binding
3) Evaluate CPU set, which should hold the location (right?)

#include <stdio.h>
#include <stdlib.h>

#include "hwloc.h"

int main(int argc, char* argv[])
{
    hwloc_topology_t topology;
    hwloc_cpuset_t   cpuset;
    char             name[50];
    unsigned int     depth;

    hwloc_topology_init(&topology);
    hwloc_topology_load(topology);

    printf("This system has %i levels\n", hwloc_topology_get_depth(topology));

    cpuset = hwloc_bitmap_alloc();
    hwloc_get_last_cpu_location(topology, cpuset, 0);
    hwloc_bitmap_snprintf(name, 49, cpuset);
    printf("Cpuset: %s\n", name);

    for (depth = 0; depth < hwloc_topology_get_depth(topology); depth++)
    {
        printf("Number of objects at depth %i: %i\n", depth, 
hwloc_get_nbobjs_inside_cpuset_by_depth(topology, cpuset, depth));
    }

    return EXIT_SUCCESS;
}

This yields the following output:

This system has 7 levels
Cpuset: 0x0
Number of objects at depth 0: 0
Number of objects at depth 1: 0
Number of objects at depth 2: 0
Number of objects at depth 3: 0
Number of objects at depth 4: 0
Number of objects at depth 5: 0
Number of objects at depth 6: 0

and I am at a total loss on what I should make of this. It seems I am  
doing something fundamentally wrong, but what and where? Do processes 
need to be bound somewhere for me to get any data out of hwloc? 

Cheers,
Marc-Andre
--
Marc-Andre Hermanns
German Research School for
Simulation Sciences GmbH
c/o Laboratory for Parallel Programming
52056 Aachen | Germany

Tel +49 241 80 99753
Fax +49 241 80 6 99753
Web www.grs-sim.de

Members: Forschungszentrum Jülich GmbH | RWTH Aachen University
Registered in the commercial register of the local court of
Düren (Amtsgericht Düren) under registration number HRB 5268
Registered office: Jülich
Executive board: Prof. Marek Behr Ph.D. | Dr. Norbert Drewes

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to