2004-01-15 09:08:25 +03:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-01-15 09:08:25 +03:00
|
|
|
|
2004-03-19 00:35:28 +03:00
|
|
|
#include "include/constants.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "runtime/runtime.h"
|
2004-01-15 09:08:25 +03:00
|
|
|
#include "mpi.h"
|
2004-09-16 13:22:28 +04:00
|
|
|
#include "event/event.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "group/group.h"
|
2004-03-19 09:12:43 +03:00
|
|
|
#include "errhandler/errhandler.h"
|
2004-08-29 13:05:14 +04:00
|
|
|
#include "errhandler/errcode.h"
|
|
|
|
#include "errhandler/errclass.h"
|
|
|
|
#include "errhandler/errcode-internal.h"
|
2004-04-21 02:38:22 +04:00
|
|
|
#include "communicator/communicator.h"
|
|
|
|
#include "datatype/datatype.h"
|
|
|
|
#include "op/op.h"
|
2004-08-14 05:56:05 +04:00
|
|
|
#include "file/file.h"
|
2004-08-12 20:56:24 +04:00
|
|
|
#include "info/info.h"
|
2004-09-23 18:34:35 +04:00
|
|
|
#include "util/proc_info.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "runtime/runtime.h"
|
2004-09-28 05:38:16 +04:00
|
|
|
#include "runtime/ompi_rte_wait.h"
|
2004-08-14 05:56:05 +04:00
|
|
|
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "mca/base/base.h"
|
|
|
|
#include "mca/ptl/ptl.h"
|
|
|
|
#include "mca/ptl/base/base.h"
|
|
|
|
#include "mca/pml/pml.h"
|
|
|
|
#include "mca/pml/base/base.h"
|
|
|
|
#include "mca/coll/coll.h"
|
|
|
|
#include "mca/coll/base/base.h"
|
2004-08-14 05:56:05 +04:00
|
|
|
#include "mca/topo/topo.h"
|
|
|
|
#include "mca/topo/base/base.h"
|
|
|
|
#include "mca/io/io.h"
|
|
|
|
#include "mca/io/base/base.h"
|
2004-09-16 12:38:24 +04:00
|
|
|
#include "mca/oob/base/base.h"
|
2004-09-23 18:34:35 +04:00
|
|
|
#include "mca/ns/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
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_mpi_finalized = true;
|
2004-01-29 22:40:22 +03:00
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* Shut down any bindings-specific issues: C++, F77, F90 (may or
|
|
|
|
may not be necessary...?) */
|
2004-01-29 22:40:22 +03:00
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* Free communication objects */
|
|
|
|
|
2004-08-14 05:56:05 +04:00
|
|
|
/* free window resources */
|
|
|
|
|
|
|
|
/* free file resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_file_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* free communicator resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_comm_finalize())) {
|
|
|
|
return ret;
|
2004-01-29 22:40:22 +03:00
|
|
|
}
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* Free secondary resources */
|
2004-01-30 06:56:21 +03:00
|
|
|
|
2004-08-29 13:05:14 +04:00
|
|
|
/* free attr resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_attr_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* free group resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_group_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-08-29 13:05:14 +04:00
|
|
|
/* free internal error resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_errcode_intern_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
}
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* free errhandler resources */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_errhandler_finalize())) {
|
|
|
|
return ret;
|
2004-01-30 06:56:21 +03:00
|
|
|
}
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* free request resources */
|
|
|
|
|
|
|
|
/* Free all other resources */
|
2004-01-29 22:40:22 +03:00
|
|
|
|
2004-04-21 02:38:22 +04:00
|
|
|
/* free op resources */
|
2004-06-07 19:33:53 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = ompi_op_finalize())) {
|
2004-04-21 02:38:22 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free ddt resources */
|
2004-06-07 19:33:53 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = ompi_ddt_finalize())) {
|
2004-04-21 02:38:22 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* free info resources */
|
2004-08-12 20:56:24 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = ompi_info_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
2004-04-21 02:38:22 +04:00
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* Close down MCA modules */
|
|
|
|
|
2004-08-14 05:56:05 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = mca_io_base_close())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
if (OMPI_SUCCESS != (ret = mca_topo_base_close())) {
|
|
|
|
return ret;
|
|
|
|
}
|
2004-06-29 04:02:25 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = mca_coll_base_close())) {
|
|
|
|
return ret;
|
|
|
|
}
|
2004-09-16 12:38:24 +04:00
|
|
|
|
2004-09-16 13:22:28 +04:00
|
|
|
/* unregister process */
|
2004-09-23 18:34:35 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = ompi_registry.rte_unregister(
|
|
|
|
ns_base_get_proc_name_string(ompi_process_info.name)))) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* wait for all processes to reach same state */
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_rte_monitor_procs_unregistered())) {
|
|
|
|
if (ompi_rte_debug_flag) {
|
|
|
|
ompi_output(0, "mpi_finalize: gave up waiting for other processes to complete");
|
|
|
|
}
|
2004-09-16 13:22:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* cleanup */
|
2004-06-29 04:02:25 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = mca_ptl_base_close())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
if (OMPI_SUCCESS != (ret = mca_pml_base_close())) {
|
|
|
|
return ret;
|
2004-02-18 09:07:06 +03:00
|
|
|
}
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* Leave the RTE */
|
|
|
|
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_rte_finalize())) {
|
|
|
|
return ret;
|
2004-03-19 09:12:43 +03:00
|
|
|
}
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* Close down the MCA */
|
|
|
|
|
|
|
|
if (OMPI_SUCCESS != (ret = mca_base_close())) {
|
2004-01-15 09:08:25 +03:00
|
|
|
return ret;
|
|
|
|
}
|
2004-08-31 13:37:28 +04:00
|
|
|
|
2004-08-29 13:05:14 +04:00
|
|
|
/* Leave OMPI land */
|
|
|
|
|
|
|
|
if (OMPI_SUCCESS != (ret = ompi_finalize())) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-01-15 09:08:25 +03:00
|
|
|
/* All done */
|
|
|
|
|
|
|
|
return MPI_SUCCESS;
|
|
|
|
}
|