1
1

Bring over r10877 and r10881 from the /tmp/tbird branch:

r10877:
add warm up connection option.. of course this only warms up the first
eager btl but this should be adequate for now..

r10881:
Consulted with Galen and did a few things:

- Fix the algorithm to actually make the connections that we want
- Rename the MCA param to mpi_preconnect_all
- Cleanup the code a bit:
  - move the logic to a separate .c file
  - check return codes properly

This commit was SVN r11114.

The following SVN revisions from the original message are invalid or
inconsistent and therefore were not cross-referenced:
  r10877
  r10877
  r10881
  r10881
Этот коммит содержится в:
Jeff Squyres 2006-08-04 14:41:31 +00:00
родитель 16186978bb
Коммит b6c6d9a2b7
6 изменённых файлов: 108 добавлений и 4 удалений

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

@ -9,6 +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 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -28,4 +29,5 @@ libmpi_la_SOURCES += \
runtime/ompi_mpi_abort.c \
runtime/ompi_mpi_init.c \
runtime/ompi_mpi_finalize.c \
runtime/ompi_mpi_params.c
runtime/ompi_mpi_params.c \
runtime/ompi_mpi_preconnect.c

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

@ -9,6 +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 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -104,6 +105,12 @@ extern "C" {
*/
void ompi_mpi_wait_for_totalview(void);
/**
* Do a preconnect of MPI connections (i.e., force connections to
* be made if they will be made).
*/
int ompi_init_do_preconnect(void);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif

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

@ -9,6 +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 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -626,11 +627,26 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
#endif
/* put the event library in "high performance MPI mode" */
if (OMPI_SUCCESS != opal_progress_mpi_enable()) {
if (OMPI_SUCCESS != (ret = opal_progress_mpi_enable())) {
error = "opal_progress_mpi_enable() failed";
/* This will loop back up above, but ret != OMPI_SUCCESS, so
we'll end up returning out of this function before getting
here (and therefore avoiding an infinite loop) */
goto error;
}
/* If we want the connection warmup, go do it */
if (ompi_mpi_preconnect_all) {
if (OMPI_SUCCESS != (ret = ompi_init_do_preconnect())) {
error = "ompi_mpi_do_preconnect_all() failed";
/* This will loop back up above, but ret != OMPI_SUCCESS,
so we'll end up returning out of this function before
getting here (and therefore avoiding an infinite
loop) */
goto error;
}
}
/* All done. Wasn't that simple? */
ompi_mpi_initialized = true;

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

@ -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 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -47,6 +47,7 @@ bool ompi_mpi_paffinity_alone = false;
bool ompi_mpi_abort_print_stack = false;
int ompi_mpi_abort_delay = 0;
bool ompi_mpi_keep_peer_hostnames = true;
bool ompi_mpi_preconnect_all = false;
int ompi_mpi_register_params(void)
@ -91,6 +92,8 @@ int ompi_mpi_register_params(void)
"Whether MPI_FINALIZE shows all MPI handles that were not freed or not",
false, false,
(int) ompi_debug_show_handle_leaks, &value);
ompi_debug_show_handle_leaks = (bool) value;
/* Whether or not to free MPI handles. Useless without run-time
@ -178,6 +181,13 @@ int ompi_mpi_register_params(void)
ompi_mpi_abort_print_stack = false;
#endif
mca_base_param_reg_int_name("mpi", "preconnect_all",
"Whether to force MPI processes to create connections / warmup with *all* peers during MPI_INIT (vs. making connections lazily -- upon the first MPI traffic between each process peer pair)",
false, false,
(int) ompi_mpi_preconnect_all, &value);
ompi_mpi_preconnect_all = (bool) value;
/* The ddt engine has a few parameters */
return ompi_ddt_register_params();

62
ompi/runtime/ompi_mpi_preconnect.c Обычный файл
Просмотреть файл

@ -0,0 +1,62 @@
/*
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdlib.h>
#include "ompi/mca/pml/pml.h"
#include "ompi/communicator/communicator.h"
#include "ompi/request/request.h"
#include "ompi/runtime/mpiruntime.h"
/*
* do zero byte IRECV / ISEND: upper half sends to lower half (i.e. do
* a ping, not a ping pong)
*/
int ompi_init_do_preconnect(void)
{
div_t result;
int comm_size = ompi_comm_size(MPI_COMM_WORLD);
int comm_half;
int my_rank = ompi_comm_rank(MPI_COMM_WORLD);
int i, j, ret;
struct ompi_request_t **requests;
requests = malloc(comm_size * sizeof(struct ompi_request_t *));
if (NULL == requests) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
for (i = j = 0; i < comm_size; ++i) {
if (i == my_rank) {
continue;
} else if (my_rank < i) {
ret = MCA_PML_CALL(isend(MPI_BOTTOM, 0, MPI_BYTE,
i, 1,
MCA_PML_BASE_SEND_STANDARD,
MPI_COMM_WORLD,
&requests[j++]));
} else {
ret = MCA_PML_CALL(irecv(MPI_BOTTOM,0, MPI_BYTE, i,
1, MPI_COMM_WORLD,
&requests[j++]));
}
if (OMPI_SUCCESS != ret) {
return ret;
}
}
ret = ompi_request_wait_all(j, requests, MPI_STATUSES_IGNORE);
free(requests);
return ret;
}

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

@ -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 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -100,6 +100,13 @@ OMPI_DECLSPEC extern bool ompi_mpi_paffinity_alone;
*/
OMPI_DECLSPEC extern bool ompi_mpi_abort_print_stack;
/**
* Whether we should force all connections to be created during
* MPI_INIT (vs. potentially making all the connection lazily upon
* first communication with an MPI peer process).
*/
OMPI_DECLSPEC extern bool ompi_mpi_preconnect_all;
/**
* Whether MPI_ABORT should print out an identifying message
* (e.g., hostname and PID) and loop waiting for a debugger to