2009-02-12 00:01:56 +03:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
2004-01-15 09:08:25 +03:00
|
|
|
/*
|
2010-03-13 02:57:50 +03:00
|
|
|
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2011-10-04 18:50:31 +04:00
|
|
|
* Copyright (c) 2004-2011 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. 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.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
Per RFC, bring in the following changes:
* Remove paffinity, maffinity, and carto frameworks -- they've been
wholly replaced by hwloc.
* Move ompi_mpi_init() affinity-setting/checking code down to ORTE.
* Update sm, smcuda, wv, and openib components to no longer use carto.
Instead, use hwloc data. There are still optimizations possible in
the sm/smcuda BTLs (i.e., making multiple mpools). Also, the old
carto-based code found out how many NUMA nodes were ''available''
-- not how many were used ''in this job''. The new hwloc-using
code computes the same value -- it was not updated to calculate how
many NUMA nodes are used ''by this job.''
* Note that I cannot compile the smcuda and wv BTLs -- I ''think''
they're right, but they need to be verified by their owners.
* The openib component now does a bunch of stuff to figure out where
"near" OpenFabrics devices are. '''THIS IS A CHANGE IN DEFAULT
BEHAVIOR!!''' and still needs to be verified by OpenFabrics vendors
(I do not have a NUMA machine with an OpenFabrics device that is a
non-uniform distance from multiple different NUMA nodes).
* Completely rewrite the OMPI_Affinity_str() routine from the
"affinity" mpiext extension. This extension now understands
hyperthreads; the output format of it has changed a bit to reflect
this new information.
* Bunches of minor changes around the code base to update names/types
from maffinity/paffinity-based names to hwloc-based names.
* Add some helper functions into the hwloc base, mainly having to do
with the fact that we have the hwloc data reporting ''all''
topology information, but sometimes you really only want the
(online | available) data.
This commit was SVN r26391.
2012-05-07 18:52:54 +04:00
|
|
|
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
|
|
|
|
* Copyright (c) 2006-2012 Los Alamos National Security, LLC. All rights
|
2006-11-22 05:06:52 +03:00
|
|
|
* reserved.
|
2006-12-05 22:07:02 +03:00
|
|
|
* Copyright (c) 2006 University of Houston. All rights reserved.
|
2009-02-24 20:17:33 +03:00
|
|
|
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
2012-02-06 21:35:21 +04:00
|
|
|
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
|
2012-06-27 05:28:28 +04:00
|
|
|
*
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-01-15 09:08:25 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi_config.h"
|
2004-01-15 09:08:25 +03:00
|
|
|
|
2006-04-13 21:00:36 +04:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETDB_H
|
|
|
|
#include <netdb.h>
|
|
|
|
#endif
|
|
|
|
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
#include "opal/mca/event/event.h"
|
2009-02-14 05:26:12 +03:00
|
|
|
#include "opal/util/output.h"
|
2005-07-04 01:57:43 +04:00
|
|
|
#include "opal/runtime/opal_progress.h"
|
2005-08-26 14:56:39 +04:00
|
|
|
#include "opal/mca/base/base.h"
|
2012-06-27 05:28:28 +04:00
|
|
|
#include "orte/util/show_help.h"
|
2006-04-13 21:00:36 +04:00
|
|
|
#include "opal/sys/atomic.h"
|
2009-02-12 17:15:25 +03:00
|
|
|
#include "opal/runtime/opal.h"
|
2004-08-14 05:56:05 +04:00
|
|
|
|
2012-06-27 05:28:28 +04:00
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "orte/mca/grpcomm/grpcomm.h"
|
|
|
|
#include "orte/runtime/runtime.h"
|
|
|
|
#include "orte/runtime/orte_globals.h"
|
|
|
|
|
2005-08-26 14:56:39 +04:00
|
|
|
#include "mpi.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/constants.h"
|
2005-08-26 14:56:39 +04:00
|
|
|
#include "ompi/errhandler/errcode.h"
|
|
|
|
#include "ompi/communicator/communicator.h"
|
2009-07-13 08:59:13 +04:00
|
|
|
#include "ompi/datatype/ompi_datatype.h"
|
2012-02-06 21:35:21 +04:00
|
|
|
#include "ompi/message/message.h"
|
2005-08-26 14:56:39 +04:00
|
|
|
#include "ompi/op/op.h"
|
|
|
|
#include "ompi/file/file.h"
|
|
|
|
#include "ompi/info/info.h"
|
|
|
|
#include "ompi/runtime/mpiruntime.h"
|
|
|
|
#include "ompi/attribute/attribute.h"
|
|
|
|
#include "ompi/mca/pml/pml.h"
|
|
|
|
#include "ompi/mca/pml/base/base.h"
|
2006-01-28 18:38:37 +03:00
|
|
|
#include "ompi/mca/osc/base/base.h"
|
2005-08-26 14:56:39 +04:00
|
|
|
#include "ompi/mca/coll/base/base.h"
|
|
|
|
#include "ompi/mca/topo/base/base.h"
|
|
|
|
#include "ompi/mca/io/io.h"
|
|
|
|
#include "ompi/mca/io/base/base.h"
|
|
|
|
#include "ompi/mca/mpool/base/base.h"
|
2009-03-04 18:35:54 +03:00
|
|
|
#include "ompi/mca/mpool/base/mpool_base_tree.h"
|
2005-09-13 02:28:23 +04:00
|
|
|
#include "ompi/mca/rcache/base/base.h"
|
2007-07-17 18:50:52 +04:00
|
|
|
#include "ompi/mca/pml/base/pml_base_bsend.h"
|
2007-08-02 01:33:25 +04:00
|
|
|
#include "ompi/runtime/params.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "ompi/mca/dpm/base/base.h"
|
|
|
|
#include "ompi/mca/pubsub/base/base.h"
|
2010-08-17 08:44:22 +04:00
|
|
|
#include "ompi/mpiext/mpiext.h"
|
2004-01-29 22:40:22 +03:00
|
|
|
|
2010-03-13 02:57:50 +03:00
|
|
|
#if OPAL_ENABLE_FT_CR == 1
|
2007-03-17 02:11:45 +03:00
|
|
|
#include "ompi/mca/crcp/crcp.h"
|
|
|
|
#include "ompi/mca/crcp/base/base.h"
|
|
|
|
#endif
|
|
|
|
#include "ompi/runtime/ompi_cr.h"
|
|
|
|
|
2012-04-06 18:23:13 +04:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_mpi_finalize(void)
|
2004-01-15 09:08:25 +03:00
|
|
|
{
|
2009-01-07 00:30:12 +03:00
|
|
|
int ret, value;
|
2006-04-13 21:00:36 +04:00
|
|
|
static int32_t finalize_has_already_started = 0;
|
2007-12-07 16:09:07 +03:00
|
|
|
opal_list_item_t *item;
|
2009-01-07 00:30:12 +03:00
|
|
|
struct timeval ompistart, ompistop;
|
|
|
|
bool timing = false;
|
2012-06-27 05:28:28 +04:00
|
|
|
orte_grpcomm_collective_t *coll;
|
2004-01-15 09:08:25 +03:00
|
|
|
|
2006-04-13 21:00:36 +04:00
|
|
|
/* Be a bit social if an erroneous program calls MPI_FINALIZE in
|
|
|
|
two different threads, otherwise we may deadlock in
|
|
|
|
ompi_comm_free() (or run into other nasty lions, tigers, or
|
|
|
|
bears) */
|
|
|
|
|
|
|
|
if (! opal_atomic_cmpset_32(&finalize_has_already_started, 0, 1)) {
|
|
|
|
/* Note that if we're already finalized, we cannot raise an
|
|
|
|
MPI exception. The best that we can do is write something
|
|
|
|
to stderr. */
|
|
|
|
char hostname[MAXHOSTNAMELEN];
|
|
|
|
pid_t pid = getpid();
|
2011-11-30 03:24:52 +04:00
|
|
|
gethostname(hostname, sizeof(hostname));
|
2006-04-13 21:00:36 +04:00
|
|
|
|
2012-06-27 05:28:28 +04:00
|
|
|
orte_show_help("help-mpi-runtime.txt",
|
2006-04-13 21:00:36 +04:00
|
|
|
"mpi_finalize:invoked_multiple_times",
|
|
|
|
true, hostname, pid);
|
|
|
|
return MPI_ERR_OTHER;
|
|
|
|
}
|
|
|
|
|
2010-08-17 08:44:22 +04:00
|
|
|
ompi_mpiext_fini();
|
|
|
|
|
2009-11-24 05:33:13 +03:00
|
|
|
/* As finalize is the last legal MPI call, we are allowed to force the release
|
|
|
|
* of the user buffer used for bsend, before going anywhere further.
|
|
|
|
*/
|
|
|
|
(void)mca_pml_base_bsend_detach(NULL, NULL);
|
|
|
|
|
2006-04-13 21:00:36 +04:00
|
|
|
/* Per MPI-2:4.8, we have to free MPI_COMM_SELF before doing
|
|
|
|
anything else in MPI_FINALIZE (to include setting up such that
|
|
|
|
MPI_FINALIZED will return true). */
|
2006-04-12 05:16:45 +04:00
|
|
|
|
2009-02-24 20:17:33 +03:00
|
|
|
if (NULL != ompi_mpi_comm_self.comm.c_keyhash) {
|
2006-04-12 05:16:45 +04:00
|
|
|
ompi_attr_delete_all(COMM_ATTR, &ompi_mpi_comm_self,
|
2009-02-24 20:17:33 +03:00
|
|
|
ompi_mpi_comm_self.comm.c_keyhash);
|
|
|
|
OBJ_RELEASE(ompi_mpi_comm_self.comm.c_keyhash);
|
|
|
|
ompi_mpi_comm_self.comm.c_keyhash = NULL;
|
2006-04-12 05:16:45 +04:00
|
|
|
}
|
|
|
|
|
2006-04-13 21:00:36 +04:00
|
|
|
/* Proceed with MPI_FINALIZE */
|
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
ompi_mpi_finalized = true;
|
2006-08-02 02:23:57 +04:00
|
|
|
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS == 0
|
2010-10-27 00:29:22 +04:00
|
|
|
opal_progress_set_event_flag(OPAL_EVLOOP_ONCE | OPAL_EVLOOP_NONBLOCK);
|
2004-10-28 19:40:46 +04:00
|
|
|
#endif
|
2006-08-02 02:23:57 +04:00
|
|
|
|
2006-11-22 05:06:52 +03:00
|
|
|
/* Redo ORTE calling opal_progress_event_users_increment() during
|
|
|
|
MPI lifetime, to get better latency when not using TCP */
|
|
|
|
opal_progress_event_users_increment();
|
2006-08-02 02:23:57 +04:00
|
|
|
|
2009-01-07 00:30:12 +03:00
|
|
|
/* check to see if we want timing information */
|
|
|
|
mca_base_param_reg_int_name("ompi", "timing",
|
|
|
|
"Request that critical timing loops be measured",
|
|
|
|
false, false, 0, &value);
|
2012-06-27 05:28:28 +04:00
|
|
|
if (value != 0 && 0 == ORTE_PROC_MY_NAME->vpid) {
|
2009-01-07 00:30:12 +03:00
|
|
|
timing = true;
|
|
|
|
gettimeofday(&ompistart, NULL);
|
|
|
|
}
|
|
|
|
|
2009-02-28 15:58:12 +03:00
|
|
|
/* NOTE: MPI-2.1 requires that MPI_FINALIZE is "collective" across
|
|
|
|
*all* connected processes. This only means that all processes
|
|
|
|
have to call it. It does *not* mean that all connected
|
|
|
|
processes need to synchronize (either directly or indirectly).
|
|
|
|
|
|
|
|
For example, it is quite easy to construct complicated
|
|
|
|
scenarios where one job is "connected" to another job via
|
|
|
|
transitivity, but have no direct knowledge of each other.
|
|
|
|
Consider the following case: job A spawns job B, and job B
|
|
|
|
later spawns job C. A "connectedness" graph looks something
|
|
|
|
like this:
|
|
|
|
|
|
|
|
A <--> B <--> C
|
|
|
|
|
|
|
|
So what are we *supposed* to do in this case? If job A is
|
|
|
|
still connected to B when it calls FINALIZE, should it block
|
|
|
|
until jobs B and C also call FINALIZE?
|
|
|
|
|
|
|
|
After lengthy discussions many times over the course of this
|
|
|
|
project, the issue was finally decided at the Louisville Feb
|
|
|
|
2009 meeting: no.
|
|
|
|
|
|
|
|
Rationale:
|
|
|
|
|
|
|
|
- "Collective" does not mean synchronizing. It only means that
|
|
|
|
every process call it. Hence, in this scenario, every
|
|
|
|
process in A, B, and C must call FINALIZE.
|
|
|
|
|
|
|
|
- KEY POINT: if A calls FINALIZE, then it is erroneous for B or
|
|
|
|
C to try to communicate with A again.
|
|
|
|
|
|
|
|
- Hence, OMPI is *correct* to only effect a barrier across each
|
|
|
|
jobs' MPI_COMM_WORLD before exiting. Specifically, if A
|
|
|
|
calls FINALIZE long before B or C, it's *correct* if A exits
|
|
|
|
at any time (and doesn't notify B or C that it is exiting).
|
|
|
|
|
|
|
|
- Arguably, if B or C do try to communicate with the now-gone
|
|
|
|
A, OMPI should try to print a nice error ("you tried to
|
|
|
|
communicate with a job that is already gone...") instead of
|
|
|
|
segv or other Badness. However, that is an *extremely*
|
|
|
|
difficult problem -- sure, it's easy for A to tell B that it
|
|
|
|
is finalizing, but how can A tell C? A doesn't even know
|
|
|
|
about C. You'd need to construct a "connected" graph in a
|
|
|
|
distributed fashion, which is fraught with race conditions,
|
|
|
|
etc.
|
|
|
|
|
|
|
|
Hence, our conclusion is: OMPI is *correct* in its current
|
|
|
|
behavior (of only doing a barrier across its own COMM_WORLD)
|
|
|
|
before exiting. Any problems that occur are as a result of
|
|
|
|
erroneous MPI applications. We *could* tighten up the erroneous
|
|
|
|
cases and ensure that we print nice error messages / don't
|
|
|
|
crash, but that is such a difficult problem that we decided we
|
|
|
|
have many other, much higher priority issues to handle that deal
|
|
|
|
with non-erroneous cases. */
|
|
|
|
|
These changes were mostly captured in a prior RFC (except for #2 below) and are aimed specifically at improving startup performance and setting up the remaining modifications described in that RFC.
The commit has been tested for C/R and Cray operations, and on Odin (SLURM, rsh) and RoadRunner (TM). I tried to update all environments, but obviously could not test them. I know that Windows needs some work, and have highlighted what is know to be needed in the odls process component.
This represents a lot of work by Brian, Tim P, Josh, and myself, with much advice from Jeff and others. For posterity, I have appended a copy of the email describing the work that was done:
As we have repeatedly noted, the modex operation in MPI_Init is the single greatest consumer of time during startup. To-date, we have executed that operation as an ORTE stage gate that held the process until a startup message containing all required modex (and OOB contact info - see #3 below) info could be sent to it. Each process would send its data to the HNP's registry, which assembled and sent the message when all processes had reported in.
In addition, ORTE had taken responsibility for monitoring process status as it progressed through a series of "stage gates". The process reported its status at each gate, and ORTE would then send a "release" message once all procs had reported in.
The incoming changes revamp these procedures in three ways:
1. eliminating the ORTE stage gate system and cleanly delineating responsibility between the OMPI and ORTE layers for MPI init/finalize. The modex stage gate (STG1) has been replaced by a collective operation in the modex itself that performs an allgather on the required modex info. The allgather is implemented using the orte_grpcomm framework since the BTL's are not active at that point. At the moment, the grpcomm framework only has a "basic" component analogous to OMPI's "basic" coll framework - I would recommend that the MPI team create additional, more advanced components to improve performance of this step.
The other stage gates have been replaced by orte_grpcomm barrier functions. We tried to use MPI barriers instead (since the BTL's are active at that point), but - as we discussed on the telecon - these are not currently true barriers so the job would hang when we fell through while messages were still in process. Note that the grpcomm barrier doesn't actually resolve that problem, but Brian has pointed out that we are unlikely to ever see it violated. Again, you might want to spend a little time on an advanced barrier algorithm as the one in "basic" is very simplistic.
Summarizing this change: ORTE no longer tracks process state nor has direct responsibility for synchronizing jobs. This is now done via collective operations within the MPI layer, albeit using ORTE collective communication services. I -strongly- urge the MPI team to implement advanced collective algorithms to improve the performance of this critical procedure.
2. reducing the volume of data exchanged during modex. Data in the modex consisted of the process name, the name of the node where that process is located (expressed as a string), plus a string representation of all contact info. The nodename was required in order for the modex to determine if the process was local or not - in addition, some people like to have it to print pretty error messages when a connection failed.
The size of this data has been reduced in three ways:
(a) reducing the size of the process name itself. The process name consisted of two 32-bit fields for the jobid and vpid. This is far larger than any current system, or system likely to exist in the near future, can support. Accordingly, the default size of these fields has been reduced to 16-bits, which means you can have 32k procs in each of 32k jobs. Since the daemons must have a vpid, and we require one daemon/node, this also restricts the default configuration to 32k nodes.
To support any future "mega-clusters", a configuration option --enable-jumbo-apps has been added. This option increases the jobid and vpid field sizes to 32-bits. Someday, if necessary, someone can add yet another option to increase them to 64-bits, I suppose.
(b) replacing the string nodename with an integer nodeid. Since we have one daemon/node, the nodeid corresponds to the local daemon's vpid. This replaces an often lengthy string with only 2 (or at most 4) bytes, a substantial reduction.
(c) when the mca param requesting that nodenames be sent to support pretty error messages, a second mca param is now used to request FQDN - otherwise, the domain name is stripped (by default) from the message to save space. If someone wants to combine those into a single param somehow (perhaps with an argument?), they are welcome to do so - I didn't want to alter what people are already using.
While these may seem like small savings, they actually amount to a significant impact when aggregated across the entire modex operation. Since every proc must receive the modex data regardless of the collective used to send it, just reducing the size of the process name removes nearly 400MBytes of communication from a 32k proc job (admittedly, much of this comm may occur in parallel). So it does add up pretty quickly.
3. routing RML messages to reduce connections. The default messaging system remains point-to-point - i.e., each proc opens a socket to every proc it communicates with and sends its messages directly. A new option uses the orteds as routers - i.e., each proc only opens a single socket to its local orted. All messages are sent from the proc to the orted, which forwards the message to the orted on the node where the intended recipient proc is located - that orted then forwards the message to its local proc (the recipient). This greatly reduces the connection storm we have encountered during startup.
It also has the benefit of removing the sharing of every proc's OOB contact with every other proc. The orted routing tables are populated during launch since every orted gets a map of where every proc is being placed. Each proc, therefore, only needs to know the contact info for its local daemon, which is passed in via the environment when the proc is fork/exec'd by the daemon. This alone removes ~50 bytes/process of communication that was in the current STG1 startup message - so for our 32k proc job, this saves us roughly 32k*50 = 1.6MBytes sent to 32k procs = 51GBytes of messaging.
Note that you can use the new routing method by specifying -mca routed tree - if you so desire. This mode will become the default at some point in the future.
There are a few minor additional changes in the commit that I'll just note in passing:
* propagation of command line mca params to the orteds - fixes ticket #1073. See note there for details.
* requiring of "finalize" prior to "exit" for MPI procs - fixes ticket #1144. See note there for details.
* cleanup of some stale header files
This commit was SVN r16364.
2007-10-05 23:48:23 +04:00
|
|
|
/* wait for everyone to reach this point
|
|
|
|
This is a grpcomm barrier instead of an MPI barrier because an
|
|
|
|
MPI barrier doesn't ensure that all messages have been transmitted
|
|
|
|
before exiting, so the possibility of a stranded message exists.
|
|
|
|
*/
|
2012-06-27 05:28:28 +04:00
|
|
|
coll = OBJ_NEW(orte_grpcomm_collective_t);
|
|
|
|
coll->id = orte_process_info.peer_fini_barrier;
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_grpcomm.barrier(coll))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
2005-03-14 23:57:21 +03:00
|
|
|
return ret;
|
|
|
|
}
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2012-06-27 05:28:28 +04:00
|
|
|
/* wait for barrier to complete */
|
|
|
|
while (coll->active) {
|
|
|
|
opal_progress(); /* block in progress pending events */
|
|
|
|
}
|
|
|
|
OBJ_RELEASE(coll);
|
|
|
|
|
2009-01-07 00:30:12 +03:00
|
|
|
/* check for timing request - get stop time and report elapsed
|
|
|
|
time if so */
|
2012-06-27 05:28:28 +04:00
|
|
|
if (timing && 0 == ORTE_PROC_MY_NAME->vpid) {
|
2009-01-07 00:30:12 +03:00
|
|
|
gettimeofday(&ompistop, NULL);
|
|
|
|
opal_output(0, "ompi_mpi_finalize[%ld]: time to execute barrier %ld usec",
|
2012-06-27 05:28:28 +04:00
|
|
|
(long)ORTE_PROC_MY_NAME->vpid,
|
2009-01-07 00:30:12 +03:00
|
|
|
(long int)((ompistop.tv_sec - ompistart.tv_sec)*1000000 +
|
|
|
|
(ompistop.tv_usec - ompistart.tv_usec)));
|
|
|
|
}
|
|
|
|
|
2007-03-17 02:11:45 +03:00
|
|
|
/*
|
|
|
|
* Shutdown the Checkpoint/Restart Mech.
|
|
|
|
*/
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_cr_finalize())) {
|
2012-06-27 05:28:28 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
2007-03-17 02:11:45 +03:00
|
|
|
}
|
|
|
|
|
2007-12-07 16:09:07 +03:00
|
|
|
/* Shut down any bindings-specific issues: C++, F77, F90 */
|
|
|
|
|
|
|
|
/* Remove all memory associated by MPI_REGISTER_DATAREP (per
|
|
|
|
MPI-2:9.5.3, there is no way for an MPI application to
|
|
|
|
*un*register datareps, but we don't want the OMPI layer causing
|
|
|
|
memory leaks). */
|
|
|
|
while (NULL != (item = opal_list_remove_first(&ompi_registered_datareps))) {
|
|
|
|
OBJ_RELEASE(item);
|
|
|
|
}
|
2008-09-01 10:01:06 +04:00
|
|
|
OBJ_DESTRUCT(&ompi_registered_datareps);
|
2004-11-20 22:12:43 +03:00
|
|
|
|
2008-09-01 02:37:26 +04:00
|
|
|
/* Remove all F90 types from the hash tables. As the OBJ_DESTRUCT will
|
|
|
|
* call a special destructor able to release predefined types, we can
|
|
|
|
* simply call the OBJ_DESTRUCT on the hash table and all memory will
|
|
|
|
* be correctly released.
|
|
|
|
*/
|
|
|
|
OBJ_DESTRUCT( &ompi_mpi_f90_integer_hashtable );
|
|
|
|
OBJ_DESTRUCT( &ompi_mpi_f90_real_hashtable );
|
|
|
|
OBJ_DESTRUCT( &ompi_mpi_f90_complex_hashtable );
|
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
/* Free communication objects */
|
|
|
|
|
|
|
|
/* free file resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_file_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
2006-01-28 18:38:37 +03:00
|
|
|
/* free window resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_win_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2006-01-28 18:38:37 +03:00
|
|
|
}
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_osc_base_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2006-01-28 18:38:37 +03:00
|
|
|
}
|
|
|
|
|
2007-10-09 19:28:56 +04:00
|
|
|
/* free pml resource */
|
|
|
|
if(OMPI_SUCCESS != (ret = mca_pml_base_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
2004-11-20 22:12:43 +03:00
|
|
|
/* free communicator resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_comm_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* free requests */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_request_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
2012-02-06 21:35:21 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = ompi_message_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-08-02 01:33:25 +04:00
|
|
|
/* If requested, print out a list of memory allocated by ALLOC_MEM
|
|
|
|
but not freed by FREE_MEM */
|
|
|
|
if (0 != ompi_debug_show_mpi_alloc_mem_leaks) {
|
|
|
|
mca_mpool_base_tree_print();
|
|
|
|
}
|
|
|
|
|
2004-12-02 16:28:10 +03:00
|
|
|
/* Now that all MPI objects dealing with communications are gone,
|
|
|
|
shut down MCA types having to do with communications */
|
|
|
|
if (OMPI_SUCCESS != (ret = mca_pml_base_close())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-12-02 16:28:10 +03:00
|
|
|
}
|
|
|
|
|
2007-07-17 18:50:52 +04:00
|
|
|
/* shut down buffered send code */
|
|
|
|
mca_pml_base_bsend_fini();
|
|
|
|
|
2010-03-13 02:57:50 +03:00
|
|
|
#if OPAL_ENABLE_FT_CR == 1
|
2007-03-17 02:11:45 +03:00
|
|
|
/*
|
|
|
|
* Shutdown the CRCP Framework, must happen after PML shutdown
|
|
|
|
*/
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_crcp_base_close() ) ) {
|
2012-06-27 05:28:28 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
2007-03-17 02:11:45 +03:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#endif
|
2004-12-02 16:28:10 +03:00
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
/* Free secondary resources */
|
|
|
|
|
|
|
|
/* free attr resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_attr_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* free group resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_group_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
2004-12-02 16:28:10 +03:00
|
|
|
/* free proc resources */
|
|
|
|
if ( OMPI_SUCCESS != (ret = ompi_proc_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-12-02 16:28:10 +03:00
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
/* finalize the pubsub functions */
|
|
|
|
if ( OMPI_SUCCESS != (ret = ompi_pubsub_base_close())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* finalize the DPM framework */
|
|
|
|
if ( OMPI_SUCCESS != (ret = ompi_dpm_base_close())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
/* free internal error resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_errcode_intern_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
2004-08-29 13:05:14 +04:00
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
/* free error code resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_mpi_errcode_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* free errhandler resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_errhandler_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Free all other resources */
|
|
|
|
|
|
|
|
/* free op resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_op_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* free ddt resources */
|
2009-07-13 08:59:13 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = ompi_datatype_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* free info resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_info_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Close down MCA modules */
|
|
|
|
|
2005-01-04 18:43:26 +03:00
|
|
|
/* io is opened lazily, so it's only necessary to close it if it
|
|
|
|
was actually opened */
|
|
|
|
|
|
|
|
if (mca_io_base_components_opened_valid ||
|
|
|
|
mca_io_base_components_available_valid) {
|
|
|
|
if (OMPI_SUCCESS != (ret = mca_io_base_close())) {
|
|
|
|
return ret;
|
|
|
|
}
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
if (OMPI_SUCCESS != (ret = mca_topo_base_close())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
2006-01-28 18:38:37 +03:00
|
|
|
if (OMPI_SUCCESS != (ret = ompi_osc_base_close())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2006-01-28 18:38:37 +03:00
|
|
|
}
|
2004-11-20 22:12:43 +03:00
|
|
|
if (OMPI_SUCCESS != (ret = mca_coll_base_close())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
2005-01-15 16:20:26 +03:00
|
|
|
if (OMPI_SUCCESS != (ret = mca_mpool_base_close())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2005-01-15 16:20:26 +03:00
|
|
|
}
|
2005-09-13 02:28:23 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = mca_rcache_base_close())) {
|
|
|
|
return ret;
|
|
|
|
}
|
2009-02-13 06:40:53 +03:00
|
|
|
|
|
|
|
/* Free some OMPI MCA string params */
|
|
|
|
if (NULL != ompi_mpi_show_mca_params_file) {
|
|
|
|
free(ompi_mpi_show_mca_params_file);
|
|
|
|
}
|
2010-10-28 00:40:39 +04:00
|
|
|
|
2009-04-27 18:15:33 +04:00
|
|
|
|
2012-06-27 05:28:28 +04:00
|
|
|
/* Leave the RTE */
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_finalize())) {
|
2007-09-13 18:00:59 +04:00
|
|
|
return ret;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
2004-08-29 13:05:14 +04:00
|
|
|
|
2011-10-04 18:50:31 +04:00
|
|
|
if (OPAL_SUCCESS != (ret = opal_finalize_util())) {
|
2009-02-12 00:01:56 +03:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
/* All done */
|
2004-01-15 09:08:25 +03:00
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
return MPI_SUCCESS;
|
2004-01-15 09:08:25 +03:00
|
|
|
}
|