2004-11-22 03:37:56 +03:00
|
|
|
/*
|
2004-11-22 04:38:40 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-11-22 03:37:56 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-10-20 05:03:09 +04:00
|
|
|
#include "ompi_config.h"
|
2004-12-07 18:39:57 +03:00
|
|
|
#include <sched.h>
|
2004-04-06 20:32:40 +04:00
|
|
|
#include "event/event.h"
|
|
|
|
#include "mca/pml/pml.h"
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "runtime/ompi_progress.h"
|
2004-04-06 20:32:40 +04:00
|
|
|
|
2004-12-03 00:43:29 +03:00
|
|
|
|
2004-10-28 19:40:46 +04:00
|
|
|
static int ompi_progress_event_flag = OMPI_EVLOOP_ONCE;
|
2004-12-03 00:43:29 +03:00
|
|
|
|
2004-10-28 19:40:46 +04:00
|
|
|
void ompi_progress_events(int flag)
|
|
|
|
{
|
2004-12-03 00:43:29 +03:00
|
|
|
if(flag != 0 || ompi_progress_event_flag == OMPI_EVLOOP_ONCE) {
|
|
|
|
ompi_progress_event_flag = flag;
|
|
|
|
}
|
2004-10-28 19:40:46 +04:00
|
|
|
}
|
2004-12-03 00:43:29 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
void ompi_progress(void)
|
2004-04-06 20:32:40 +04:00
|
|
|
{
|
2004-12-03 00:43:29 +03:00
|
|
|
/* progress any outstanding communications */
|
|
|
|
int events = 0;
|
2004-12-07 18:39:57 +03:00
|
|
|
#if OMPI_HAVE_THREADS == 0
|
2004-10-28 19:40:46 +04:00
|
|
|
if(ompi_progress_event_flag != 0)
|
2004-12-03 00:43:29 +03:00
|
|
|
events += ompi_event_loop(ompi_progress_event_flag);
|
2004-12-07 18:39:57 +03:00
|
|
|
#endif
|
2004-12-03 00:43:29 +03:00
|
|
|
events += mca_pml.pml_progress();
|
2004-12-07 18:39:57 +03:00
|
|
|
|
2004-12-03 00:43:29 +03:00
|
|
|
#if 0
|
|
|
|
/* TSW - disable this until can validate that it doesn't impact SMP
|
|
|
|
* performance
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* if there is nothing to do - yield the processor - otherwise
|
|
|
|
* we could consume the processor for the entire time slice. If
|
|
|
|
* the processor is oversubscribed - this will result in a best-case
|
|
|
|
* latency equivalent to the time-slice.
|
|
|
|
*/
|
|
|
|
if(events == 0)
|
|
|
|
sched_yield();
|
|
|
|
#endif
|
2004-04-06 20:32:40 +04:00
|
|
|
}
|
|
|
|
|