From af4299ebc56aa226e4854873c37609284324236a Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 4 Jan 2018 09:58:50 -0800 Subject: [PATCH] hwloc: updates for hwloc 2.0.x API Signed-off-by: Jeff Squyres --- opal/mca/btl/openib/btl_openib_component.c | 6 +++++- opal/mca/hwloc/base/hwloc_base_util.c | 13 +++++++++---- orte/mca/rtc/hwloc/rtc_hwloc.c | 7 ++++++- orte/orted/pmix/pmix_server_register_fns.c | 6 +++++- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/opal/mca/btl/openib/btl_openib_component.c b/opal/mca/btl/openib/btl_openib_component.c index 554a5eaa60..abf92257bb 100644 --- a/opal/mca/btl/openib/btl_openib_component.c +++ b/opal/mca/btl/openib/btl_openib_component.c @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2006-2015 Mellanox Technologies. All rights reserved. * Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights * reserved. @@ -1524,7 +1524,11 @@ static uint64_t calculate_total_mem (void) if (NULL == machine) { return 0; } +#if HWLOC_API_VERSION < 0x20000 return machine->memory.total_memory; +#else + return machine->total_memory; +#endif } /* couldn't find it */ diff --git a/opal/mca/hwloc/base/hwloc_base_util.c b/opal/mca/hwloc/base/hwloc_base_util.c index fcc5f6d4ad..35b3223594 100644 --- a/opal/mca/hwloc/base/hwloc_base_util.c +++ b/opal/mca/hwloc/base/hwloc_base_util.c @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2011-2017 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2011-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2012-2017 Los Alamos National Security, LLC. * All rights reserved. * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. @@ -54,6 +54,11 @@ #include "opal/mca/hwloc/hwloc-internal.h" #include "opal/mca/hwloc/base/base.h" +#if HWLOC_API_VERSION >= 0x20000 +// JMS Is this right? +#include "hwloc/shmem.h" +#endif + static bool topo_in_shmem = false; /* @@ -149,7 +154,7 @@ int opal_hwloc_base_filter_cpus(hwloc_topology_t topo) avail = hwloc_bitmap_alloc(); hwloc_bitmap_and(avail, root->online_cpuset, root->allowed_cpuset); #else - avail = hwloc_bitmap_dup(root->allowed_cpuset); + avail = hwloc_bitmap_dup(root->cpuset); #endif OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output, "hwloc:base: no cpus specified - using root available cpuset")); @@ -173,7 +178,7 @@ int opal_hwloc_base_filter_cpus(hwloc_topology_t topo) hwloc_bitmap_and(pucpus, pu->online_cpuset, pu->allowed_cpuset); #else hwloc_bitmap_free(pucpus); - pucpus = hwloc_bitmap_dup(pu->allowed_cpuset); + pucpus = hwloc_bitmap_dup(pu->cpuset); #endif hwloc_bitmap_or(res, avail, pucpus); hwloc_bitmap_copy(avail, res); @@ -195,7 +200,7 @@ int opal_hwloc_base_filter_cpus(hwloc_topology_t topo) hwloc_bitmap_and(pucpus, pu->online_cpuset, pu->allowed_cpuset); #else hwloc_bitmap_free(pucpus); - pucpus = hwloc_bitmap_dup(pu->allowed_cpuset); + pucpus = hwloc_bitmap_dup(pu->cpuset); #endif hwloc_bitmap_or(res, avail, pucpus); hwloc_bitmap_copy(avail, res); diff --git a/orte/mca/rtc/hwloc/rtc_hwloc.c b/orte/mca/rtc/hwloc/rtc_hwloc.c index b832d4cf6b..312b1f9e77 100644 --- a/orte/mca/rtc/hwloc/rtc_hwloc.c +++ b/orte/mca/rtc/hwloc/rtc_hwloc.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2017 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2017-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2017 Inria. All rights reserved. * $COPYRIGHT$ * @@ -48,6 +48,11 @@ #include "orte/mca/rtc/base/base.h" #include "rtc_hwloc.h" +#if HWLOC_API_VERSION >= 0x20000 +// JMS Is this right? +#include "hwloc/shmem.h" +#endif + static int init(void); static void finalize(void); static void assign(orte_job_t *jdata); diff --git a/orte/orted/pmix/pmix_server_register_fns.c b/orte/orted/pmix/pmix_server_register_fns.c index b6bbebb25c..395d89e07f 100644 --- a/orte/orted/pmix/pmix_server_register_fns.c +++ b/orte/orted/pmix/pmix_server_register_fns.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2006-2013 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014 Mellanox Technologies, Inc. @@ -270,7 +270,11 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata, bool force) kv = OBJ_NEW(opal_value_t); kv->key = strdup(OPAL_PMIX_AVAIL_PHYS_MEMORY); kv->type = OPAL_UINT64; +#if HWLOC_API_VERSION < 0x20000 kv->data.uint64 = machine->memory.total_memory; +#else + kv->data.uint64 = machine->total_memory; +#endif opal_list_append(info, &kv->super); }