From c453614f8bd842b966b12f274784f1c028396b0c Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Tue, 18 Oct 2011 02:54:38 +0000 Subject: [PATCH] A more meaningful name for this function (mpi_proc_complete_init instead of ompi_proc_set_arch). Change the comment to reflect the real behavior of the function. This commit was SVN r25312. --- ompi/proc/proc.c | 42 ++++++++++++++++++------------------ ompi/proc/proc.h | 17 ++++++--------- ompi/runtime/ompi_mpi_init.c | 4 ++-- 3 files changed, 29 insertions(+), 34 deletions(-) diff --git a/ompi/proc/proc.c b/ompi/proc/proc.c index d1dbdd37f2..98b048a1d9 100644 --- a/ompi/proc/proc.c +++ b/ompi/proc/proc.c @@ -126,20 +126,20 @@ int ompi_proc_init(void) } -/* in some cases, all MPI procs are required to do a modex so they - * can (at the least) exchange their architecture. Since we cannot - * know in advance if this was required, we provide a separate function - * to set the arch (instead of doing it inside of ompi_proc_init) that - * can be called after the modex completes in ompi_mpi_init. Thus, we - * know that - regardless of how the arch is known, whether via modex - * or dropped in from a local daemon - the arch can be set correctly - * at this time +/** + * The process creation is split into two steps. The second step + * is the important one, it sets the properties of the remote + * process, such as architecture, node name and locality flags. + * + * This function is to be called __only__ after the modex exchange + * has been performed, in order to allow the modex to carry the data + * instead of requiring the runtime to provide it. */ -int ompi_proc_set_arch(void) +int ompi_proc_complete_init(void) { ompi_proc_t *proc = NULL; opal_list_item_t *item = NULL; - int ret; + int ret, errcode = OMPI_SUCCESS; OPAL_THREAD_LOCK(&ompi_proc_lock); @@ -149,6 +149,11 @@ int ompi_proc_set_arch(void) proc = (ompi_proc_t*)item; if (proc->proc_name.vpid != ORTE_PROC_MY_NAME->vpid) { + /* get the locality information */ + proc->proc_flags = orte_ess.proc_get_locality(&proc->proc_name); + /* get the name of the node it is on */ + proc->proc_hostname = orte_ess.proc_get_hostname(&proc->proc_name); + ret = ompi_modex_recv_key_value("OMPI_ARCH", proc, (void*)&(proc->proc_arch), OPAL_UINT32); if (OMPI_SUCCESS == ret) { /* if arch is different than mine, create a new convertor for this proc */ @@ -160,26 +165,21 @@ int ompi_proc_set_arch(void) orte_show_help("help-mpi-runtime", "heterogeneous-support-unavailable", true, orte_process_info.nodename, - proc->proc_hostname == NULL ? "" : - proc->proc_hostname); - OPAL_THREAD_UNLOCK(&ompi_proc_lock); - return OMPI_ERR_NOT_SUPPORTED; + proc->proc_hostname == NULL ? "" : proc->proc_hostname); + errcode = OMPI_ERR_NOT_SUPPORTED; + break; #endif } } else if (OMPI_ERR_NOT_IMPLEMENTED == OPAL_SOS_GET_ERROR_CODE(ret)) { proc->proc_arch = opal_local_arch; } else { - OPAL_THREAD_UNLOCK(&ompi_proc_lock); - return ret; + errcode = ret; + break; } - /* get the locality information */ - proc->proc_flags = orte_ess.proc_get_locality(&proc->proc_name); - /* get the name of the node it is on */ - proc->proc_hostname = orte_ess.proc_get_hostname(&proc->proc_name); } } OPAL_THREAD_UNLOCK(&ompi_proc_lock); - return OMPI_SUCCESS; + return errcode; } diff --git a/ompi/proc/proc.h b/ompi/proc/proc.h index 10d1fec443..3eb7c81d6e 100644 --- a/ompi/proc/proc.h +++ b/ompi/proc/proc.h @@ -113,19 +113,14 @@ OMPI_DECLSPEC extern ompi_proc_t* ompi_proc_local_proc; OMPI_DECLSPEC int ompi_proc_init(void); /** - * Set the arch of each proc in the ompi_proc_list + * Complete filling up the proc information (arch, name and locality) for all + * procs related to this job. This function is to be called only after + * the modex exchange has been completed. * - * In some environments, MPI procs are required to exchange their - * arch via a modex operation during mpi_init. In other environments, - * the arch is determined by other mechanisms and provided to the - * proc directly. To support both mechanisms, we provide a separate - * function to set the arch of the procs -after- the modex operation - * has completed in mpi_init. - * - * @retval OMPI_SUCCESS Archs successfully set - * @retval OMPI_ERROR Archs could not be initialized + * @retval OMPI_SUCCESS All information correctly set. + * @retval OMPI_ERROR Some info could not be initialized. */ -OMPI_DECLSPEC int ompi_proc_set_arch(void); +OMPI_DECLSPEC int ompi_proc_complete_init(void); /** * Finalize the OMPI Process subsystem diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index fe0eb8701a..601c13055c 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -743,8 +743,8 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) /* identify the architectures of remote procs and setup * their datatype convertors, if required */ - if (OMPI_SUCCESS != (ret = ompi_proc_set_arch())) { - error = "ompi_proc_set_arch failed"; + if (OMPI_SUCCESS != (ret = ompi_proc_complete_init())) { + error = "ompi_proc_complete_init failed"; goto error; }