3232#ifdef HAVE_UNISTD_H
3333#include <unistd.h>
3434#endif
35+ #ifdef HAVE_ENDIAN_H
36+ #include <endian.h>
37+ #endif
3538
3639#include "opal/runtime/opal.h"
3740#include "opal/constants.h"
@@ -2163,7 +2166,7 @@ int opal_hwloc_get_sorted_numa_list(hwloc_topology_t topo, char* device_name, op
21632166char * opal_hwloc_base_get_topo_signature (hwloc_topology_t topo )
21642167{
21652168 int nnuma , nsocket , nl3 , nl2 , nl1 , ncore , nhwt ;
2166- char * sig = NULL , * arch = NULL ;
2169+ char * sig = NULL , * arch = NULL , * endian ;
21672170 hwloc_obj_t obj ;
21682171 unsigned i ;
21692172
@@ -2183,14 +2186,22 @@ char* opal_hwloc_base_get_topo_signature(hwloc_topology_t topo)
21832186 break ;
21842187 }
21852188 }
2186-
21872189 if (NULL == arch ) {
2188- asprintf (& sig , "%dN:%dS:%dL3:%dL2:%dL1:%dC:%dH" ,
2189- nnuma , nsocket , nl3 , nl2 , nl1 , ncore , nhwt );
2190- } else {
2191- asprintf (& sig , "%dN:%dS:%dL3:%dL2:%dL1:%dC:%dH:%s" ,
2192- nnuma , nsocket , nl3 , nl2 , nl1 , ncore , nhwt , arch );
2190+ arch = "unknown" ;
21932191 }
2192+
2193+ #ifdef __BYTE_ORDER
2194+ #if __BYTE_ORDER == __LITTLE_ENDIAN
2195+ endian = "le" ;
2196+ #else
2197+ endian = "be" ;
2198+ #endif
2199+ #else
2200+ endian = "unknown" ;
2201+ #endif
2202+
2203+ asprintf (& sig , "%dN:%dS:%dL3:%dL2:%dL1:%dC:%dH:%s:%s" ,
2204+ nnuma , nsocket , nl3 , nl2 , nl1 , ncore , nhwt , arch , endian );
21942205 return sig ;
21952206}
21962207
0 commit comments