From 10a0d0f6ff74568067691e266ec31462f437dc34 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 29 Nov 2016 08:31:35 -0800 Subject: [PATCH 1/2] Never collect data when doing the fence at the end of MPI_Init Signed-off-by: Ralph Castain (cherry picked from commit 114e20ad6635405ed96e67619a465f338ec016d1) Conflicts: ompi/runtime/ompi_mpi_init.c --- ompi/runtime/ompi_mpi_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index a41b29f2b72..823e0e56c1d 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -17,7 +17,7 @@ * Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. - * Copyright (c) 2014-2015 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2016 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. @@ -808,11 +808,11 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) active = true; opal_pmix.commit(); if (NULL != opal_pmix.fence_nb) { - opal_pmix.fence_nb(NULL, opal_pmix_collect_all_data, + opal_pmix.fence_nb(NULL, false, fence_release, (void*)&active); OMPI_LAZY_WAIT_FOR_COMPLETION(active); } else { - opal_pmix.fence(NULL, opal_pmix_collect_all_data); + opal_pmix.fence(NULL, false); } /* check for timing request - get stop time and report elapsed From 9ae3aa0fd956386b55db80a66c0cb64e2776fc04 Mon Sep 17 00:00:00 2001 From: Artem Polyakov Date: Wed, 22 Feb 2017 07:36:38 +0700 Subject: [PATCH 2/2] ompi: Avoid unnecessary PMIx lookups when adding procs. Signed-off-by: Artem Polyakov (cherry-picked from 9f4464a558d288fef4ba0f640535a602ff291562) --- ompi/proc/proc.c | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/ompi/proc/proc.c b/ompi/proc/proc.c index 1445085dda3..d05cfce5792 100644 --- a/ompi/proc/proc.c +++ b/ompi/proc/proc.c @@ -16,7 +16,7 @@ * Copyright (c) 2013-2015 Intel, Inc. All rights reserved * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2017 Mellanox Technologies. All rights reserved. * * $COPYRIGHT$ * @@ -38,6 +38,7 @@ #include "opal/util/show_help.h" #include "opal/mca/hwloc/base/base.h" #include "opal/mca/pmix/pmix.h" +#include "opal/util/argv.h" #include "ompi/proc/proc.h" #include "ompi/datatype/ompi_datatype.h" @@ -342,29 +343,24 @@ int ompi_proc_complete_init(void) opal_mutex_unlock (&ompi_proc_lock); if (ompi_process_info.num_procs >= ompi_add_procs_cutoff) { - uint16_t u16, *u16ptr; - - u16ptr = &u16; - - /* find and add all local processes */ - for (ompi_vpid_t i = 0 ; i < ompi_process_info.num_procs ; ++i ) { - opal_process_name_t proc_name = {.vpid = i, .jobid = OMPI_PROC_MY_NAME->jobid}; - uint16_t locality = OPAL_PROC_NON_LOCAL; - - if (OMPI_PROC_MY_NAME->vpid == i) { - continue; - } - - /* the runtime is required to fill in locality for all local processes by this - * point. only local processes will have locality set */ - OPAL_MODEX_RECV_VALUE_OPTIONAL(ret, OPAL_PMIX_LOCALITY, &proc_name, &u16ptr, OPAL_UINT16); - if (OPAL_SUCCESS == ret) { - locality = u16; - } - - if (OPAL_PROC_NON_LOCAL != locality) { - (void) ompi_proc_for_name (proc_name); + char *val; + /* retrieve the local peers */ + OPAL_MODEX_RECV_VALUE(ret, OPAL_PMIX_LOCAL_PEERS, + ORTE_PROC_MY_NAME, &val, OPAL_STRING); + if (OPAL_SUCCESS == ret && NULL != val) { + char **peers = opal_argv_split(val, ','); + int i; + free(val); + for (i=0; NULL != peers[i]; i++) { + ompi_vpid_t local_rank = strtoul(peers[i], NULL, 10); + opal_process_name_t proc_name = {.vpid = local_rank, .jobid = OMPI_PROC_MY_NAME->jobid}; + + if (OMPI_PROC_MY_NAME->vpid == local_rank) { + continue; + } + (void) ompi_proc_for_name (proc_name); } + opal_argv_free(peers); } }