2004-01-15 09:08:25 +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.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-01-15 09:08:25 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
#include "orte_config.h"
|
2004-01-15 09:08:25 +03:00
|
|
|
|
2005-07-04 03:09:55 +04:00
|
|
|
#include "opal/event/event.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/maffinity/base/base.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
2004-08-14 05:56:05 +04:00
|
|
|
|
2005-08-26 14:56:39 +04:00
|
|
|
#include "orte/util/proc_info.h"
|
|
|
|
#include "orte/include/orte_constants.h"
|
|
|
|
#include "orte/mca/schema/schema.h"
|
|
|
|
#include "orte/mca/oob/base/base.h"
|
|
|
|
#include "orte/mca/ns/ns.h"
|
|
|
|
#include "orte/mca/gpr/gpr.h"
|
|
|
|
#include "orte/mca/rml/rml.h"
|
|
|
|
#include "orte/mca/soh/soh.h"
|
|
|
|
#include "orte/mca/soh/base/base.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "orte/runtime/runtime.h"
|
|
|
|
|
|
|
|
#include "mpi.h"
|
|
|
|
#include "ompi/include/constants.h"
|
|
|
|
#include "ompi/group/group.h"
|
|
|
|
#include "ompi/errhandler/errcode.h"
|
|
|
|
#include "ompi/errhandler/errclass.h"
|
|
|
|
#include "ompi/communicator/communicator.h"
|
|
|
|
#include "ompi/datatype/datatype.h"
|
|
|
|
#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/base/pml_base_module_exchange.h"
|
|
|
|
#include "ompi/mca/pml/pml.h"
|
|
|
|
#include "ompi/mca/pml/base/base.h"
|
|
|
|
#include "ompi/mca/coll/coll.h"
|
|
|
|
#include "ompi/mca/coll/base/base.h"
|
|
|
|
#include "ompi/mca/topo/topo.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"
|
2005-09-13 02:28:23 +04:00
|
|
|
#include "ompi/mca/rcache/base/base.h"
|
2004-01-29 22:40:22 +03:00
|
|
|
|
2004-01-15 09:08:25 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_mpi_finalize(void)
|
2004-01-15 09:08:25 +03:00
|
|
|
{
|
2004-11-20 22:12:43 +03:00
|
|
|
int ret;
|
2004-01-15 09:08:25 +03:00
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
ompi_mpi_finalized = true;
|
2005-02-16 20:42:07 +03:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS == 0
|
2005-07-04 03:09:55 +04:00
|
|
|
opal_progress_events(OPAL_EVLOOP_NONBLOCK);
|
2004-10-28 19:40:46 +04:00
|
|
|
#endif
|
2005-08-26 14:56:39 +04:00
|
|
|
/* If maffinity was setup, tear it down */
|
|
|
|
if (ompi_mpi_maffinity_setup) {
|
|
|
|
opal_maffinity_base_close();
|
|
|
|
}
|
2004-01-29 22:40:22 +03:00
|
|
|
|
2005-03-30 05:40:26 +04:00
|
|
|
/* Change progress function priority back to RTE level stuff */
|
2005-07-04 01:57:43 +04:00
|
|
|
opal_progress_mpi_disable();
|
2005-03-30 05:40:26 +04:00
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
/* begin recording compound command */
|
2005-03-14 23:57:21 +03:00
|
|
|
/* if (OMPI_SUCCESS != (ret = orte_gpr.begin_compound_cmd())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
/* Set process status to "at stg3" */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_soh.set_proc_soh(orte_process_info.my_name,
|
|
|
|
ORTE_PROC_STATE_AT_STG3, 0))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* execute the compound command - no return data requested
|
|
|
|
*/
|
2005-03-14 23:57:21 +03:00
|
|
|
/* if (OMPI_SUCCESS != (ret = orte_gpr.exec_compound_cmd())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Wait for everyone to get here
|
|
|
|
*/
|
2005-09-01 05:07:30 +04:00
|
|
|
if (ORTE_SUCCESS != (ret = orte_rml.xcast(NULL, NULL, 0, NULL,
|
|
|
|
orte_gpr.deliver_notify_msg, NULL))) {
|
2005-03-14 23:57:21 +03:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
/* Shut down any bindings-specific issues: C++, F77, F90 (may or
|
|
|
|
may not be necessary...?) */
|
|
|
|
|
|
|
|
/* Free communication objects */
|
|
|
|
|
|
|
|
/* free window resources */
|
|
|
|
|
|
|
|
/* free file resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_file_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free communicator resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_comm_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free requests */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_request_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
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())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
/* Free secondary resources */
|
|
|
|
|
|
|
|
/* free attr resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_attr_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free group resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_group_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-12-02 16:28:10 +03:00
|
|
|
/* free proc resources */
|
|
|
|
if ( OMPI_SUCCESS != (ret = ompi_proc_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
/* free internal error resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_errcode_intern_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
2004-08-29 13:05:14 +04:00
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
/* free error class resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_errclass_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free error code resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_mpi_errcode_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free errhandler resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_errhandler_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free all other resources */
|
|
|
|
|
|
|
|
/* free op resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_op_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free ddt resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_ddt_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free info resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_info_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free module exchange resources */
|
2005-08-05 22:03:30 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = mca_pml_base_modex_finalize())) {
|
2004-11-20 22:12:43 +03:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
if (OMPI_SUCCESS != (ret = mca_coll_base_close())) {
|
|
|
|
return ret;
|
|
|
|
}
|
2005-01-15 16:20:26 +03:00
|
|
|
if (OMPI_SUCCESS != (ret = mca_mpool_base_close())) {
|
|
|
|
return ret;
|
|
|
|
}
|
2005-09-13 02:28:23 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = mca_rcache_base_close())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/* Set process status to "finalized" */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_soh.set_proc_soh(orte_process_info.my_name,
|
|
|
|
ORTE_PROC_STATE_FINALIZED, 0))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
Add a job_info segment to the system that holds a container for each job. Within each container is a keyval indicating the job state (i.e., all procs at stage1, finalized, etc.). This provides a rough state-of-health for the job.
This required a little fiddling with a number of areas. Biggest problem was that it uncovered a potential for an infinite loop to be created in the registry. If a callback function modified the registry, the registry checked the triggers to see if anything had fired. Well, if the original callback was due to a trigger firing, that condition hadn't changed - so the trigger fired again....which caused the callback to be called, which modified the registry, which checked the triggers, etc. etc.
Triggers are now checked and then "flagged" as being "in process" so that the registry will NOT recheck that trigger until all callbacks have been processed. Tried doing this with subscriptions as well, but that caused a problem - when we release processes from a stagegate, they (at the moment) immediately place data on the registry that should cause a subscription to fire. Unfortunately, the system will just hang if that subscription doesn't get processed. So, I have left the subscription system alone - any callback function that modifies the registry in a fashion that will fire a subscription will indeed fire that subscription. We'll have to see if this causes problems - it shouldn't, but a careless user could lock things up if the callback generates a callback to itself.
Also fixed the code that placed a process' RML contact info on the registry to eliminate the leading '/' from the string.
This commit was SVN r6684.
2005-07-29 18:11:19 +04:00
|
|
|
/*
|
|
|
|
* Wait for everyone to get here. This is necessary to allow the soh
|
|
|
|
* to update the job state for singletons. Otherwise, we finalize
|
|
|
|
* the RTE while the soh is trying to do the update - which causes
|
|
|
|
* an ugly race condition
|
|
|
|
*/
|
2005-09-01 05:07:30 +04:00
|
|
|
if (ORTE_SUCCESS != (ret = orte_rml.xcast(NULL, NULL, 0, NULL,
|
|
|
|
orte_gpr.deliver_notify_msg, NULL))) {
|
Add a job_info segment to the system that holds a container for each job. Within each container is a keyval indicating the job state (i.e., all procs at stage1, finalized, etc.). This provides a rough state-of-health for the job.
This required a little fiddling with a number of areas. Biggest problem was that it uncovered a potential for an infinite loop to be created in the registry. If a callback function modified the registry, the registry checked the triggers to see if anything had fired. Well, if the original callback was due to a trigger firing, that condition hadn't changed - so the trigger fired again....which caused the callback to be called, which modified the registry, which checked the triggers, etc. etc.
Triggers are now checked and then "flagged" as being "in process" so that the registry will NOT recheck that trigger until all callbacks have been processed. Tried doing this with subscriptions as well, but that caused a problem - when we release processes from a stagegate, they (at the moment) immediately place data on the registry that should cause a subscription to fire. Unfortunately, the system will just hang if that subscription doesn't get processed. So, I have left the subscription system alone - any callback function that modifies the registry in a fashion that will fire a subscription will indeed fire that subscription. We'll have to see if this causes problems - it shouldn't, but a careless user could lock things up if the callback generates a callback to itself.
Also fixed the code that placed a process' RML contact info on the registry to eliminate the leading '/' from the string.
This commit was SVN r6684.
2005-07-29 18:11:19 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/* Leave the RTE */
|
2004-11-20 22:12:43 +03:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
if (OMPI_SUCCESS != (ret = orte_finalize())) {
|
2004-11-20 22:12:43 +03:00
|
|
|
return ret;
|
|
|
|
}
|
2004-08-29 13:05:14 +04:00
|
|
|
|
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
|
|
|
}
|