diff --git a/src/runtime/Makefile.am b/src/runtime/Makefile.am index c8a204c1e6..568d624300 100644 --- a/src/runtime/Makefile.am +++ b/src/runtime/Makefile.am @@ -28,13 +28,15 @@ headers = \ runtime_types.h \ runtime_internal.h \ ompi_progress.h \ - orte_wait.h + orte_wait.h \ + opal_finalize.h libruntime_la_SOURCES = \ $(headers) \ orte_abort.c \ ompi_progress.c \ orte_finalize.c \ + orte_system_finalize.c \ orte_init.c \ orte_init_stage1.c \ orte_init_stage2.c \ @@ -42,7 +44,8 @@ libruntime_la_SOURCES = \ orte_setup_hnp.c \ orte_universe_exists.c \ orte_restart.c \ - orte_wait.c + orte_wait.c \ + opal_finalize.c # Conditionally install the header files diff --git a/src/runtime/opal_finalize.c b/src/runtime/opal_finalize.c new file mode 100644 index 0000000000..48f53fc8ac --- /dev/null +++ b/src/runtime/opal_finalize.c @@ -0,0 +1,52 @@ +/* + * 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. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** @file **/ + +#include "orte_config.h" + +#include "include/orte_constants.h" +#include "class/ompi_object.h" +#include "util/output.h" +#include "util/malloc.h" +#include "mca/base/base.h" +#include "runtime/opal_finalize.h" + +/** + * Finalize the OPAL utilities + * + * @retval ORTE_SUCCESS Upon success. + * @retval ORTE_ERROR Upon failure. + * + * This function performs + */ +int opal_finalize(void) +{ + + /* finalize the mca */ + mca_base_close(); + + /* finalize the output system */ + ompi_output_finalize(); + + /* finalize the class/object system */ + ompi_class_finalize(); + + /* finalize the memory allocator */ + ompi_malloc_finalize(); + + return ORTE_SUCCESS; +} diff --git a/src/runtime/opal_finalize.h b/src/runtime/opal_finalize.h new file mode 100644 index 0000000000..828afb4014 --- /dev/null +++ b/src/runtime/opal_finalize.h @@ -0,0 +1,32 @@ +/* + * 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. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** @file **/ + +#ifndef OPAL_FINALIZE_H +#define OPAL_FINALIZE_H + +/** + * Finalize the OPAL utilities + * + * @retval ORTE_SUCCESS Upon success. + * @retval ORTE_ERROR Upon failure. + * + * This function performs + */ +int opal_finalize(void); + +#endif diff --git a/src/runtime/orte_finalize.c b/src/runtime/orte_finalize.c index 3515a19212..e920a330a2 100644 --- a/src/runtime/orte_finalize.c +++ b/src/runtime/orte_finalize.c @@ -19,23 +19,8 @@ #include "orte_config.h" #include "include/orte_constants.h" +#include "runtime/opal_finalize.h" #include "runtime/runtime.h" -#include "runtime/orte_wait.h" -#include "event/event.h" -#include "mca/rml/base/base.h" -#include "dps/dps.h" -#include "mca/ns/base/base.h" -#include "mca/gpr/base/base.h" -#include "mca/iof/base/base.h" -#include "mca/rmgr/base/base.h" -#include "util/if.h" -#include "util/malloc.h" -#include "util/output.h" -#include "util/session_dir.h" -#include "util/sys_info.h" -#include "util/proc_info.h" -#include "util/univ_info.h" -#include "util/os_path.h" /** * Leave ORTE. @@ -47,54 +32,12 @@ */ int orte_finalize(void) { - char *contact_path; + /* finalize the orte system */ + orte_system_finalize(); - /* if I'm the seed, remove the universe contact info file */ - if (orte_process_info.seed) { - contact_path = orte_os_path(false, orte_process_info.universe_session_dir, - "universe-setup.txt", NULL); - unlink(contact_path); - free(contact_path); - } + /* finalize the opal utilities */ + opal_finalize(); - /* rmgr close depends on wait/iof */ - orte_rmgr_base_close(); - orte_wait_finalize(); - orte_iof_base_close(); - - orte_ns_base_close(); - orte_gpr_base_close(); - orte_rml_base_close(); - orte_dps_close(); - - ompi_progress_finalize(); - - ompi_event_fini(); - -#ifndef WIN32 - orte_session_dir_finalize(orte_process_info.my_name); -#endif - - /* clean out the global structures */ - orte_sys_info_finalize(); - orte_proc_info_finalize(); - orte_univ_info_finalize(); - - /* cleanup the if data */ - ompi_iffinalize(); - - /* finalize the mca */ - mca_base_close(); - - /* finalize the output system */ - ompi_output_finalize(); - - /* finalize the class/object system */ - ompi_class_finalize(); - - /* finalize the memory allocator */ - ompi_malloc_finalize(); - return ORTE_SUCCESS; } diff --git a/src/runtime/orte_setup_hnp.c b/src/runtime/orte_setup_hnp.c index cef41eeafe..4f5e695b5f 100644 --- a/src/runtime/orte_setup_hnp.c +++ b/src/runtime/orte_setup_hnp.c @@ -468,11 +468,9 @@ static void orte_setup_hnp_recv(int status, orte_process_name_t* sender, int rc; OMPI_THREAD_LOCK(&orte_setup_hnp_mutex); - ompi_output(0, "HE CALLED HOME!!"); if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &orted_uri, &n, ORTE_STRING))) { ORTE_ERROR_LOG(rc); } - ompi_output(0, "got a uri of: %s", orted_uri); ompi_condition_signal(&orte_setup_hnp_condition); OMPI_THREAD_UNLOCK(&orte_setup_hnp_mutex); } diff --git a/src/runtime/orte_system_finalize.c b/src/runtime/orte_system_finalize.c new file mode 100644 index 0000000000..23688bf203 --- /dev/null +++ b/src/runtime/orte_system_finalize.c @@ -0,0 +1,85 @@ +/* + * 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. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** @file **/ + +#include "orte_config.h" + +#include "include/orte_constants.h" +#include "runtime/runtime.h" +#include "runtime/orte_wait.h" +#include "event/event.h" +#include "mca/rml/base/base.h" +#include "dps/dps.h" +#include "mca/ns/base/base.h" +#include "mca/gpr/base/base.h" +#include "mca/iof/base/base.h" +#include "mca/rmgr/base/base.h" +#include "util/if.h" +#include "util/session_dir.h" +#include "util/sys_info.h" +#include "util/proc_info.h" +#include "util/univ_info.h" +#include "util/os_path.h" + +/** + * Leave ORTE. + * + * @retval ORTE_SUCCESS Upon success. + * @retval ORTE_ERROR Upon failure. + * + * This function performs + */ +int orte_system_finalize(void) +{ + char *contact_path; + + /* if I'm the seed, remove the universe contact info file */ + if (orte_process_info.seed) { + contact_path = orte_os_path(false, orte_process_info.universe_session_dir, + "universe-setup.txt", NULL); + unlink(contact_path); + free(contact_path); + } + + /* rmgr close depends on wait/iof */ + orte_rmgr_base_close(); + orte_wait_finalize(); + orte_iof_base_close(); + + orte_ns_base_close(); + orte_gpr_base_close(); + orte_rml_base_close(); + orte_dps_close(); + + ompi_progress_finalize(); + + ompi_event_fini(); + +#ifndef WIN32 + orte_session_dir_finalize(orte_process_info.my_name); +#endif + + /* clean out the global structures */ + orte_sys_info_finalize(); + orte_proc_info_finalize(); + orte_univ_info_finalize(); + + /* cleanup the if data */ + ompi_iffinalize(); + + return ORTE_SUCCESS; +} diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 5413986b2a..13cfc28e15 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -19,10 +19,10 @@ * * Interface into the Open MPI Run Time Environment */ -#ifndef OMPI_RUNTIME_H -#define OMPI_RUNTIME_H +#ifndef ORTE_RUNTIME_H +#define ORTE_RUNTIME_H -#include "ompi_config.h" +#include "orte_config.h" #ifdef HAVE_SYS_TYPES_H #include @@ -113,6 +113,7 @@ OMPI_DECLSPEC int orte_restart(orte_process_name_t* name, const char* uri); * */ OMPI_DECLSPEC int orte_finalize(void); +OMPI_DECLSPEC int orte_system_finalize(void); /* * Change state as processes complete registration/unregistration diff --git a/src/tools/orteprobe/orteprobe.c b/src/tools/orteprobe/orteprobe.c index 515a3e878a..8fcade8210 100644 --- a/src/tools/orteprobe/orteprobe.c +++ b/src/tools/orteprobe/orteprobe.c @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) ompi_cmd_line_t *cmd_line = NULL; char *contact_path = NULL, *orted=NULL; char *log_path = NULL, **ortedargv; - char *universe, orted_uri[256], *orted_uri_ptr, *path, *param; + char *universe, orted_uri[256], **orted_uri_ptr, *path, *param; orte_universe_t univ; orte_buffer_t buffer; orte_process_name_t requestor; @@ -315,8 +315,8 @@ int main(int argc, char *argv[]) /* universe is here! send info back and die */ fprintf(stderr, "contacted existing universe - sending contact info back\n"); OBJ_CONSTRUCT(&buffer, orte_buffer_t); - orted_uri_ptr = &univ.seed_uri; - if (ORTE_SUCCESS != (ret = orte_dps.pack(&buffer, &orte_uri_ptr, 1, ORTE_STRING))) { + orted_uri_ptr = &(univ.seed_uri); + if (ORTE_SUCCESS != (ret = orte_dps.pack(&buffer, &orted_uri_ptr, 1, ORTE_STRING))) { fprintf(stderr, "orteprobe: failed to pack contact info for existing universe\n"); exit(1); } @@ -417,7 +417,8 @@ fprintf(stderr, "attempting to read from daemon\n"); /* send back the info */ OBJ_CONSTRUCT(&buffer, orte_buffer_t); - orted_uri_ptr = &orted_uri; + param = orted_uri; + orted_uri_ptr = ¶m; if (ORTE_SUCCESS != (ret = orte_dps.pack(&buffer, &orted_uri_ptr, 1, ORTE_STRING))) { fprintf(stderr, "orteprobe: failed to pack daemon uri\n"); exit(1);