From c7be9a712185067da34b1407d0cf1f8ed050c8da Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 7 Feb 2007 14:22:37 +0000 Subject: [PATCH] Complete backout of prior sched_yield and paffinity changes This commit was SVN r13530. --- ompi/proc/proc.c | 11 ------ ompi/proc/proc.h | 4 -- ompi/runtime/ompi_mpi_init.c | 74 ++++++++++++++++++++++++------------ opal/runtime/opal_progress.c | 3 +- 4 files changed, 51 insertions(+), 41 deletions(-) diff --git a/ompi/proc/proc.c b/ompi/proc/proc.c index 4aad3f7c77..b31fa0a33e 100644 --- a/ompi/proc/proc.c +++ b/ompi/proc/proc.c @@ -80,11 +80,6 @@ void ompi_proc_construct(ompi_proc_t* proc) opal_list_append(&ompi_proc_list, (opal_list_item_t*)proc); OPAL_THREAD_UNLOCK(&ompi_proc_lock); - /* init the number of local procs */ - proc->num_local_procs = 0; - - /* init my local rank */ - proc->local_rank = 0; } @@ -605,12 +600,6 @@ static void callback(orte_gpr_notify_data_t *data, void *cbdata) proc->proc_arch = arch; if (0 == strcmp(str, orte_system_info.nodename)) { proc->proc_flags |= OMPI_PROC_FLAG_LOCAL; - /* increment the number of procs on my node */ - ompi_proc_local_proc->num_local_procs++; - /* is this vpid < mine? if so, bump my local rank */ - if (name.vpid < ORTE_PROC_MY_NAME->vpid) { - ompi_proc_local_proc->local_rank++; - } } /* if arch is different than mine, create a diff --git a/ompi/proc/proc.h b/ompi/proc/proc.h index cd9b49d1a3..112bd2ca4b 100644 --- a/ompi/proc/proc.h +++ b/ompi/proc/proc.h @@ -53,10 +53,6 @@ struct ompi_proc_t { char *proc_hostname; /** flags for this proc */ uint8_t proc_flags; - /** number of local procs sharing this node */ - uint8_t num_local_procs; - /** my local rank */ - orte_vpid_t local_rank; }; /** * Convenience typedef diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index 46bb91a8aa..f15327726b 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2006 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2006 University of Houston. All rights reserved. @@ -213,8 +213,11 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) bool timing = false; int param, value; struct timeval ompistart, ompistop; +#if 0 + /* see comment below about sched_yield */ int num_processors; - +#endif + /* Join the run-time environment - do the things that don't hit the registry */ @@ -283,6 +286,40 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) goto error; } + /* Setup process affinity */ + + if (ompi_mpi_paffinity_alone) { + bool set = false; + param = mca_base_param_find("mpi", NULL, "paffinity_processor"); + if (param >= 0) { + if (OMPI_SUCCESS == mca_base_param_lookup_int(param, &value)) { + if (value >= 0) { + if (OPAL_SUCCESS == opal_paffinity_base_set(value)) { + set = true; + } + } + } + if (!set) { + char *vpid; + orte_ns.get_vpid_string(&vpid, orte_process_info.my_name); + opal_show_help("help-mpi-runtime", + "mpi_init:startup:paffinity-unavailable", + true, vpid); + free(vpid); + } + + /* If we were able to set processor affinity, try setting + up memory affinity */ + + else { + if (OPAL_SUCCESS == opal_maffinity_base_open() && + OPAL_SUCCESS == opal_maffinity_base_select()) { + ompi_mpi_maffinity_setup = true; + } + } + } + } + /* initialize datatypes. This step should be done early as it will * create the local convertor and local arch used in the proc * init. @@ -508,29 +545,6 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) gettimeofday(&ompistart, NULL); } - /* Setup process affinity */ - - if (ompi_mpi_paffinity_alone) { - if (OPAL_SUCCESS == - opal_paffinity_base_set(ompi_proc_local_proc->local_rank)) { - /* If we were able to set processor affinity, also try to - setup memory affinity */ - if (OPAL_SUCCESS == opal_maffinity_base_open() && - OPAL_SUCCESS == opal_maffinity_base_select()) { - ompi_mpi_maffinity_setup = true; - } - } else { - /* If we failed to setup paffinity, then print a warning - because the user did specifically ask for it */ - char *vpid; - orte_ns.get_vpid_string(&vpid, orte_process_info.my_name); - opal_show_help("help-mpi-runtime", - "mpi_init:startup:paffinity-unavailable", - true, vpid); - free(vpid); - } - } - /* start PTL's */ ret = MCA_PML_CALL(enable(true)); if( OMPI_SUCCESS != ret ) { @@ -676,6 +690,13 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) param = mca_base_param_find("mpi", NULL, "yield_when_idle"); mca_base_param_lookup_int(param, &value); if (value < 0) { + /* TEMPORARY FIX - RIGHT NOW, WE DO NOT HAVE ACCESS TO + * INFO ON THE NUMBER OF LOCAL PROCS. THE ORTED IS SETTING + * THE MCA PARAM (OR THE PLS WILL, DEPENDING ON SYSTEM) SO + * THE FOLLOWING CODE WILL **NEVER** BE EXECUTED *EXCEPT* + * POSSIBLY BY SINGLETONS IN THE ABSENCE OF AN ENVIRO MCA PARAM + */ +#if 0 /* nope - so let's figure out what we can/should do... * first, get the number of processors - if we can't then * we can't do anything but set conservative values @@ -695,6 +716,9 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) /* couldn't get num_processors - be conservative */ opal_progress_set_yield_when_idle(true); } +#endif + /* always just default to conservative */ + opal_progress_set_yield_when_idle(true); } else { /* yep, they specified it - so set idle accordingly */ opal_progress_set_yield_when_idle(value == 0 ? false : true); diff --git a/opal/runtime/opal_progress.c b/opal/runtime/opal_progress.c index 923b0a7a7f..a51d889508 100644 --- a/opal/runtime/opal_progress.c +++ b/opal/runtime/opal_progress.c @@ -271,7 +271,8 @@ opal_progress_set_yield_when_idle(bool yieldopt) bool tmp = (call_yield == 0) ? false : true; call_yield = (yieldopt) ? 1 : 0; - OPAL_OUTPUT((debug_output, "progress: progress_set_yield_when_idle to %d", call_yield)); + OPAL_OUTPUT((debug_output, "progress: progress_set_yield_when_idle to %s", + call_yield == 0 ? "false" : "true")); return tmp; }