Open MPI logo

Hardware Locality Users' Mailing List Archives

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

Subject: [hwloc-users] Having trouble getting CPU Model string on Windows 7 x64
From: Robin Scher (robin_at_[hidden])
Date: 2014-01-27 19:59:23

Hi again.

I’m trying to use hwloc 1.8 on Windows, Linux and Mac to get the CPU model string (e.g., “Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz”). Since hwloc on different platforms seem to stash this in different objects, I’m using code like this:

String name;
hwloc_obj_type_t objs[] = {
    HWLOC_OBJ_PU, };
for( size_t index = 0; index < (sizeof( objs ) / sizeof( hwloc_obj_type_t )) && name.Empty(); ++index )
    hwloc_obj_t obj = hwloc_get_obj_by_type( topology, objs[ index ], 0 );
    if( !obj ) continue;
    const char *str = hwloc_obj_get_info_by_name( obj, "CPUModel" );
    if( str ) name = String( str ).Trim();

On Mac, it works (found string at HWLOC_OBJ_MACHINE), and on Linux it works (found string at HWLOC_OBJ_SOCKET), but on Windows x64, none of these find the string. They all return a NULL pointer.

Am I missing something? I tried a few other of the object types, but didn’t find it with them either (I actually tried looping through all integer values between 0 and HWLOC_OBJ_TYPE_MAX and it didn’t appear in any of them).

Thank you for any help you can provide.

Robin Scher
+1 (213) 448-0443