1
1

Fix a bunch of RUI's and ensure that all the Right functions are

invoked from the various finalize functions so that we don't have
resource leaks

This commit was SVN r2374.
Этот коммит содержится в:
Jeff Squyres 2004-08-29 09:05:14 +00:00
родитель d2ea3eea6d
Коммит 7f83536f7a
6 изменённых файлов: 54 добавлений и 5 удалений

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

@ -140,7 +140,7 @@ ompi_attrkey_item_destruct(ompi_attrkey_item_t *item)
*/
int
ompi_attr_init()
ompi_attr_init(void)
{
attr_hash = OBJ_NEW(ompi_attrkey_t);
if (NULL == attr_hash) {
@ -163,11 +163,13 @@ ompi_attr_init()
* This will destroy the list, mostly during MPI_Finalize()
*/
void
ompi_attr_destroy()
int
ompi_attr_finalize(void)
{
OBJ_RELEASE(attr_hash);
OBJ_RELEASE(key_bitmap);
return OMPI_SUCCESS;
}

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

@ -134,7 +134,7 @@ int ompi_attr_init(void);
* Destroy the main attribute hash that stores the key and meta data
*/
void ompi_attr_destroy(void);
int ompi_attr_finalize(void);
/**

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

@ -47,6 +47,8 @@ int mca_base_init_select_components(int requested,
/* JMS: At some point, we'll need to feed it the thread level to
ensure to pick one high enough (e.g., if we need CR) */
user_threads = true;
hidden_threads = false;
if (OMPI_SUCCESS != mca_pml_base_select(&mca_pml,
&user_threads, &hidden_threads)) {
return OMPI_ERROR;

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

@ -9,12 +9,16 @@
#include "mpi.h"
#include "group/group.h"
#include "errhandler/errhandler.h"
#include "errhandler/errcode.h"
#include "errhandler/errclass.h"
#include "errhandler/errcode-internal.h"
#include "communicator/communicator.h"
#include "datatype/datatype.h"
#include "op/op.h"
#include "file/file.h"
#include "info/info.h"
#include "runtime/runtime.h"
#include "util/common_cmd_line.h"
#include "mca/base/base.h"
#include "mca/ptl/ptl.h"
@ -54,11 +58,31 @@ int ompi_mpi_finalize(void)
/* 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;
}
/* 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;
}
/* free errhandler resources */
if (OMPI_SUCCESS != (ret = ompi_errhandler_finalize())) {
return ret;
@ -113,6 +137,16 @@ int ompi_mpi_finalize(void)
return ret;
}
/* Leave OMPI land */
if (OMPI_SUCCESS != (ret = ompi_finalize())) {
return ret;
}
if (OMPI_SUCCESS != (ret = ompi_common_cmd_line_finalize())) {
return ret;
}
/* All done */
return MPI_SUCCESS;

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

@ -85,6 +85,8 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
}
/* Join the run-time environment */
allow_multi_user_threads = true;
have_hidden_threads = false;
if (OMPI_SUCCESS != (ret = ompi_rte_init(&allow_multi_user_threads,
&have_hidden_threads))) {
/* JMS show_help */
@ -287,7 +289,6 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
}
/* Wait for everyone to initialize */
/* Change the Barrier call to the backend call */
if (MPI_SUCCESS != (ret =
MPI_COMM_WORLD->c_coll.coll_barrier(MPI_COMM_WORLD))) {

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

@ -100,6 +100,8 @@ int ompi_rte_init(bool *allow_multi_user_threads, bool *have_hidden_threads)
printf("show_help: ompi_rte_init failed in oob_base_open\n");
return ret;
}
user_threads = true;
hidden_threads = false;
if (OMPI_SUCCESS != (ret = mca_oob_base_init(&user_threads,
&hidden_threads))) {
/* JMS show_help */
@ -117,6 +119,8 @@ int ompi_rte_init(bool *allow_multi_user_threads, bool *have_hidden_threads)
printf("show_help: ompi_rte_init failed in ns_base_open\n");
return ret;
}
user_threads = true;
hidden_threads = false;
if (OMPI_SUCCESS != (ret = mca_ns_base_select(&user_threads,
&hidden_threads))) {
/* JMS show_help */
@ -134,6 +138,8 @@ int ompi_rte_init(bool *allow_multi_user_threads, bool *have_hidden_threads)
printf("show_help: ompi_rte_init failed in pcmclient_base_open\n");
return ret;
}
user_threads = true;
hidden_threads = false;
if (OMPI_SUCCESS != (ret = mca_pcmclient_base_select(&user_threads,
&hidden_threads))) {
printf("show_help: ompi_rte_init failed in pcmclient_base_select\n");
@ -160,6 +166,8 @@ int ompi_rte_init(bool *allow_multi_user_threads, bool *have_hidden_threads)
printf("show_help: ompi_rte_init failed in pcm_base_open\n");
return ret;
}
user_threads = true;
hidden_threads = false;
if (OMPI_SUCCESS != (ret = mca_pcm_base_select(&user_threads,
&hidden_threads))) {
printf("show_help: ompi_rte_init failed in pcm_base_select\n");
@ -177,6 +185,8 @@ int ompi_rte_init(bool *allow_multi_user_threads, bool *have_hidden_threads)
printf("show_help: ompi_rte_init failed in mca_gpr_base_open()\n");
return ret;
}
user_threads = true;
hidden_threads = false;
if (OMPI_SUCCESS != (ret = mca_gpr_base_select(&user_threads,
&hidden_threads))) {
/* JMS show_help */