1
1

make the opal progress yield variable settable at any time

The semantics of the variable mpi_yield_when_idle are to call
opal_progress_set_yield_when_idle at MPI_Init. It would be difficult
to modify the old variable to support setting this parameter at
runtime. The fix is to add an additional parameter to opal:
opal_progress_yield_when_idle that directly sets the variable. This
variable is settable anytime and does not affect the semantics of
the old mpi_yield_when_idle variable.

Refs trac:193

cmr=v1.8.1:reviewer=jsquyres

This commit was SVN r31255.

The following Trac tickets were found above:
  Ticket 193 --> https://svn.open-mpi.org/trac/ompi/ticket/193
Этот коммит содержится в:
Nathan Hjelm 2014-03-27 15:51:06 +00:00
родитель 714cb8f573
Коммит a4fff57720
3 изменённых файлов: 24 добавлений и 10 удалений

Просмотреть файл

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/* /*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
@ -13,7 +14,7 @@
* reserved. * reserved.
* Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2010-2013 Los Alamos National Security, LLC. * Copyright (c) 2010-2014 Los Alamos National Security, LLC.
* All rights reserved. * All rights reserved.
* Copyright (c) 2014 Hochschule Esslingen. All rights reserved. * Copyright (c) 2014 Hochschule Esslingen. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
@ -104,6 +105,15 @@ int opal_register_params(void)
} }
} }
#if defined(HAVE_SCHED_YIELD)
opal_progress_yield_when_idle = false;
ret = mca_base_var_register ("opal", "opal", "progress", "yield_when_idle",
"Yield the processor when waiting on progress",
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
OPAL_INFO_LVL_8, MCA_BASE_VAR_SCOPE_LOCAL,
&opal_progress_yield_when_idle);
#endif
#if OPAL_ENABLE_DEBUG #if OPAL_ENABLE_DEBUG
opal_progress_debug = false; opal_progress_debug = false;
ret = mca_base_var_register ("opal", "opal", "progress", "debug", ret = mca_base_var_register ("opal", "opal", "progress", "debug",

Просмотреть файл

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/* /*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
@ -9,7 +10,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2006-2013 Los Alamos National Security, LLC. All rights * Copyright (c) 2006-2014 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* *
* $COPYRIGHT$ * $COPYRIGHT$
@ -57,7 +58,7 @@ static size_t callbacks_len = 0;
static size_t callbacks_size = 0; static size_t callbacks_size = 0;
/* do we want to call sched_yield() if nothing happened */ /* do we want to call sched_yield() if nothing happened */
static int call_yield = 1; bool opal_progress_yield_when_idle;
#if OPAL_PROGRESS_USE_TIMERS #if OPAL_PROGRESS_USE_TIMERS
static opal_timer_t event_progress_last_time = 0; static opal_timer_t event_progress_last_time = 0;
@ -105,7 +106,7 @@ opal_progress_init(void)
OPAL_OUTPUT((debug_output, "progress: initialized event flag to: %x", OPAL_OUTPUT((debug_output, "progress: initialized event flag to: %x",
opal_progress_event_flag)); opal_progress_event_flag));
OPAL_OUTPUT((debug_output, "progress: initialized yield_when_idle to: %s", OPAL_OUTPUT((debug_output, "progress: initialized yield_when_idle to: %s",
call_yield == 0 ? "false" : "true")); opal_progress_yield_when_idle ? "true" : "false"));
OPAL_OUTPUT((debug_output, "progress: initialized num users to: %d", OPAL_OUTPUT((debug_output, "progress: initialized num users to: %d",
num_event_users)); num_event_users));
OPAL_OUTPUT((debug_output, "progress: initialized poll rate to: %ld", OPAL_OUTPUT((debug_output, "progress: initialized poll rate to: %ld",
@ -187,7 +188,7 @@ opal_progress(void)
} }
#if defined(HAVE_SCHED_YIELD) #if defined(HAVE_SCHED_YIELD)
if (call_yield && events <= 0) { if (opal_progress_yield_when_idle && events <= 0) {
/* If there is nothing to do - yield the processor - otherwise /* If there is nothing to do - yield the processor - otherwise
* we could consume the processor for the entire time slice. If * we could consume the processor for the entire time slice. If
* the processor is oversubscribed - this will result in a best-case * the processor is oversubscribed - this will result in a best-case
@ -249,11 +250,11 @@ opal_progress_event_users_decrement(void)
bool bool
opal_progress_set_yield_when_idle(bool yieldopt) opal_progress_set_yield_when_idle(bool yieldopt)
{ {
bool tmp = (call_yield == 0) ? false : true; bool tmp = opal_progress_yield_when_idle;
call_yield = (yieldopt) ? 1 : 0; opal_progress_yield_when_idle = (yieldopt) ? 1 : 0;
OPAL_OUTPUT((debug_output, "progress: progress_set_yield_when_idle to %s", OPAL_OUTPUT((debug_output, "progress: progress_set_yield_when_idle to %s",
call_yield == 0 ? "false" : "true")); opal_progress_yield_when_idle ? "true" : "false"));
return tmp; return tmp;
} }

Просмотреть файл

@ -1,4 +1,4 @@
/* /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- *//*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2006 Los Alamos National Security, LLC. All rights * Copyright (c) 2006-2014 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* *
* $COPYRIGHT$ * $COPYRIGHT$
@ -175,6 +175,9 @@ OPAL_DECLSPEC int opal_progress_unregister(opal_progress_callback_t cb);
OPAL_DECLSPEC extern int opal_progress_spin_count; OPAL_DECLSPEC extern int opal_progress_spin_count;
/* do we want to call sched_yield() if nothing happened */
OPAL_DECLSPEC extern bool opal_progress_yield_when_idle;
/** /**
* Progress until flag is true or poll iterations completed * Progress until flag is true or poll iterations completed
*/ */