2004-01-29 02:35:33 +00:00
|
|
|
/*
|
2005-11-05 19:57:48 +00:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-09-01 01:07:30 +00:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2004-11-28 20:09:25 +00:00
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 12:43:37 +00:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2006-12-07 00:21:25 +00:00
|
|
|
* Copyright (c) 2006 Los Alamos National Security, LLC. All rights
|
2006-12-07 00:24:01 +00:00
|
|
|
* reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
2005-09-01 01:07:30 +00:00
|
|
|
*
|
2004-11-22 01:38:40 +00:00
|
|
|
* Additional copyrights may follow
|
2005-09-01 01:07:30 +00:00
|
|
|
*
|
2004-01-29 02:35:33 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 15:33:53 +00:00
|
|
|
#include "ompi_config.h"
|
2005-03-14 20:57:21 +00:00
|
|
|
|
2005-09-12 20:22:59 +00:00
|
|
|
#include "ompi/proc/proc.h"
|
2005-07-03 22:45:48 +00:00
|
|
|
#include "opal/threads/condition.h"
|
2005-07-03 23:31:27 +00:00
|
|
|
#include "opal/util/output.h"
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "orte/util/proc_info.h"
|
2006-12-11 21:27:30 +00:00
|
|
|
#include "orte/class/orte_proc_table.h"
|
2005-03-14 20:57:21 +00:00
|
|
|
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "orte/dss/dss.h"
|
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "orte/mca/rml/rml.h"
|
|
|
|
#include "orte/mca/schema/schema.h"
|
|
|
|
#include "orte/mca/gpr/gpr.h"
|
|
|
|
#include "orte/mca/gpr/base/base.h"
|
|
|
|
#include "orte/mca/ns/ns.h"
|
|
|
|
#include "ompi/constants.h"
|
|
|
|
#include "ompi/mca/pml/pml.h"
|
|
|
|
#include "ompi/mca/pml/base/pml_base_module_exchange.h"
|
2004-01-29 02:35:33 +00:00
|
|
|
|
2006-12-11 21:27:30 +00:00
|
|
|
/* MODEX DESIGN
|
|
|
|
*
|
|
|
|
* Modex data is always associated with a given ompi_proc_t. However,
|
|
|
|
* because modex data is received from the GPR for entire jobids, it
|
|
|
|
* is possible that the modex callback will receive data for a process
|
|
|
|
* not yet in the ompi_proc_all() list of processes. This information
|
|
|
|
* must be kept for later use, because if accept/connect causes the
|
|
|
|
* proc to be added to the ompi_proc_all() list, the subscription to
|
|
|
|
* the mdoex information can not be reliably fired without causing a
|
|
|
|
* potential connection storm. Therefore, we use an orte_proc_table
|
|
|
|
* backing store to contain all modex information. Backpointers are
|
|
|
|
* provided from the ompi_proc_t structure to improve lookup
|
|
|
|
* performance in the common case.
|
|
|
|
*
|
|
|
|
* While we could add the now discovered proc into the ompi_proc_all()
|
|
|
|
* list, this has some problems, in that we don't have the
|
|
|
|
* architecture and hostname information needed to properly fill in
|
|
|
|
* the ompi_proc_t structure and we don't want to cause GPR
|
|
|
|
* communication to get it when we dont' really need to know anything
|
|
|
|
* about the remote proc.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-10-14 20:50:06 +00:00
|
|
|
/**
|
2006-12-07 00:21:25 +00:00
|
|
|
* callback data for modex
|
2004-10-14 20:50:06 +00:00
|
|
|
*/
|
2006-04-27 16:15:35 +00:00
|
|
|
struct mca_pml_base_modex_cb_t {
|
2006-12-07 00:24:01 +00:00
|
|
|
opal_list_item_t super;
|
|
|
|
mca_base_component_t *component;
|
|
|
|
mca_pml_base_modex_cb_fn_t cbfunc;
|
|
|
|
void *cbdata;
|
2006-04-27 16:15:35 +00:00
|
|
|
};
|
|
|
|
typedef struct mca_pml_base_modex_cb_t mca_pml_base_modex_cb_t;
|
|
|
|
|
2006-12-07 00:21:25 +00:00
|
|
|
OBJ_CLASS_INSTANCE(mca_pml_base_modex_cb_t,
|
2007-04-11 15:19:51 +00:00
|
|
|
opal_list_item_t,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2006-04-27 16:15:35 +00:00
|
|
|
|
|
|
|
|
2004-03-03 16:44:41 +00:00
|
|
|
/**
|
2005-08-05 18:03:30 +00:00
|
|
|
* mca_pml_base_modex_module_t
|
2004-03-03 16:44:41 +00:00
|
|
|
*
|
|
|
|
* Data for a specic proc and module.
|
|
|
|
*/
|
2005-08-05 18:03:30 +00:00
|
|
|
struct mca_pml_base_modex_module_t {
|
2006-12-07 00:24:01 +00:00
|
|
|
opal_list_item_t super;
|
|
|
|
mca_base_component_t component;
|
|
|
|
void *module_data;
|
|
|
|
size_t module_data_size;
|
|
|
|
bool module_data_avail;
|
|
|
|
opal_list_t module_cbs;
|
|
|
|
opal_condition_t module_data_cond;
|
2004-03-03 16:44:41 +00:00
|
|
|
};
|
2005-08-05 18:03:30 +00:00
|
|
|
typedef struct mca_pml_base_modex_module_t mca_pml_base_modex_module_t;
|
2004-03-03 16:44:41 +00:00
|
|
|
|
2006-12-07 00:21:25 +00:00
|
|
|
static void
|
|
|
|
mca_pml_base_modex_module_construct(mca_pml_base_modex_module_t * module)
|
2004-03-03 16:44:41 +00:00
|
|
|
{
|
2006-12-07 00:24:01 +00:00
|
|
|
OBJ_CONSTRUCT(&module->module_data_cond, opal_condition_t);
|
|
|
|
OBJ_CONSTRUCT(&module->module_cbs, opal_list_t);
|
|
|
|
memset(&module->component, 0, sizeof(module->component));
|
|
|
|
module->module_data = NULL;
|
|
|
|
module->module_data_size = 0;
|
|
|
|
module->module_data_avail = false;
|
2004-03-03 16:44:41 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 00:21:25 +00:00
|
|
|
static void
|
|
|
|
mca_pml_base_modex_module_destruct(mca_pml_base_modex_module_t * module)
|
2004-03-03 16:44:41 +00:00
|
|
|
{
|
2006-12-07 00:24:01 +00:00
|
|
|
OBJ_DESTRUCT(&module->module_data_cond);
|
2004-03-03 16:44:41 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 00:21:25 +00:00
|
|
|
OBJ_CLASS_INSTANCE(mca_pml_base_modex_module_t,
|
2007-04-11 15:19:51 +00:00
|
|
|
opal_list_item_t,
|
|
|
|
mca_pml_base_modex_module_construct,
|
|
|
|
mca_pml_base_modex_module_destruct);
|
2006-12-07 00:21:25 +00:00
|
|
|
|
2004-03-03 16:44:41 +00:00
|
|
|
|
|
|
|
/**
|
2005-08-05 18:03:30 +00:00
|
|
|
* mca_pml_base_modex_t
|
2004-03-03 16:44:41 +00:00
|
|
|
*
|
2005-09-01 01:07:30 +00:00
|
|
|
* List of modules (mca_pml_base_modex_module_t) for which data has been
|
2004-03-03 16:44:41 +00:00
|
|
|
* received from peers.
|
|
|
|
*/
|
2005-08-05 18:03:30 +00:00
|
|
|
struct mca_pml_base_modex_t {
|
2006-12-11 21:27:30 +00:00
|
|
|
opal_list_item_t super;
|
|
|
|
opal_mutex_t modex_lock;
|
2006-12-07 00:24:01 +00:00
|
|
|
opal_list_t modex_modules;
|
2004-03-03 16:44:41 +00:00
|
|
|
};
|
2005-08-05 18:03:30 +00:00
|
|
|
typedef struct mca_pml_base_modex_t mca_pml_base_modex_t;
|
2004-03-03 16:44:41 +00:00
|
|
|
|
2006-12-07 00:21:25 +00:00
|
|
|
static void
|
|
|
|
mca_pml_base_modex_construct(mca_pml_base_modex_t * modex)
|
2004-03-03 16:44:41 +00:00
|
|
|
{
|
2006-12-11 21:27:30 +00:00
|
|
|
OBJ_CONSTRUCT(&modex->modex_lock, opal_mutex_t);
|
2006-12-07 00:24:01 +00:00
|
|
|
OBJ_CONSTRUCT(&modex->modex_modules, opal_list_t);
|
2004-03-03 16:44:41 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 00:21:25 +00:00
|
|
|
static void
|
|
|
|
mca_pml_base_modex_destruct(mca_pml_base_modex_t * modex)
|
2004-03-03 16:44:41 +00:00
|
|
|
{
|
2006-12-07 00:24:01 +00:00
|
|
|
OBJ_DESTRUCT(&modex->modex_modules);
|
2006-12-11 21:27:30 +00:00
|
|
|
OBJ_DESTRUCT(&modex->modex_lock);
|
2004-03-03 16:44:41 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 00:21:25 +00:00
|
|
|
OBJ_CLASS_INSTANCE(mca_pml_base_modex_t,
|
2007-04-11 15:19:51 +00:00
|
|
|
opal_object_t,
|
|
|
|
mca_pml_base_modex_construct,
|
|
|
|
mca_pml_base_modex_destruct);
|
2006-12-07 00:21:25 +00:00
|
|
|
|
2004-03-03 16:44:41 +00:00
|
|
|
|
2004-10-14 20:50:06 +00:00
|
|
|
/**
|
2005-08-05 18:03:30 +00:00
|
|
|
* mca_pml_base_modex_subscription_t
|
2004-10-14 20:50:06 +00:00
|
|
|
*
|
|
|
|
* Track segments we have subscribed to.
|
|
|
|
*/
|
2005-08-05 18:03:30 +00:00
|
|
|
struct mca_pml_base_modex_subscription_t {
|
2006-12-07 00:24:01 +00:00
|
|
|
opal_list_item_t item;
|
|
|
|
orte_jobid_t jobid;
|
2004-10-14 20:50:06 +00:00
|
|
|
};
|
2005-08-05 18:03:30 +00:00
|
|
|
typedef struct mca_pml_base_modex_subscription_t mca_pml_base_modex_subscription_t;
|
2004-10-14 20:50:06 +00:00
|
|
|
|
2006-12-07 00:21:25 +00:00
|
|
|
OBJ_CLASS_INSTANCE(mca_pml_base_modex_subscription_t,
|
2007-04-11 15:19:51 +00:00
|
|
|
opal_list_item_t,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2004-10-14 20:50:06 +00:00
|
|
|
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Globals to track the list of subscriptions.
|
|
|
|
*/
|
2006-12-07 00:21:25 +00:00
|
|
|
static opal_list_t mca_pml_base_modex_subscriptions;
|
2006-12-11 21:27:30 +00:00
|
|
|
static opal_hash_table_t mca_pml_base_modex_data;
|
2005-08-05 18:03:30 +00:00
|
|
|
static opal_mutex_t mca_pml_base_modex_lock;
|
2004-10-14 20:50:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize global state.
|
|
|
|
*/
|
2006-12-07 00:21:25 +00:00
|
|
|
int
|
|
|
|
mca_pml_base_modex_init(void)
|
2004-10-14 20:50:06 +00:00
|
|
|
{
|
2006-12-11 21:27:30 +00:00
|
|
|
OBJ_CONSTRUCT(&mca_pml_base_modex_data, opal_hash_table_t);
|
2006-12-07 00:24:01 +00:00
|
|
|
OBJ_CONSTRUCT(&mca_pml_base_modex_subscriptions, opal_list_t);
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_base_modex_lock, opal_mutex_t);
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
|
2006-12-11 21:27:30 +00:00
|
|
|
opal_hash_table_init(&mca_pml_base_modex_data, 256);
|
|
|
|
|
2006-12-07 00:24:01 +00:00
|
|
|
return OMPI_SUCCESS;
|
2004-10-14 20:50:06 +00:00
|
|
|
}
|
|
|
|
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
|
2004-10-14 20:50:06 +00:00
|
|
|
/**
|
|
|
|
* Cleanup global state.
|
|
|
|
*/
|
2006-12-07 00:21:25 +00:00
|
|
|
int
|
|
|
|
mca_pml_base_modex_finalize(void)
|
2004-10-14 20:50:06 +00:00
|
|
|
{
|
2006-12-07 00:24:01 +00:00
|
|
|
opal_list_item_t *item;
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
|
2006-12-11 21:27:30 +00:00
|
|
|
opal_hash_table_remove_all(&mca_pml_base_modex_data);
|
|
|
|
OBJ_DESTRUCT(&mca_pml_base_modex_data);
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
|
2006-12-07 00:24:01 +00:00
|
|
|
while (NULL != (item = opal_list_remove_first(&mca_pml_base_modex_subscriptions)))
|
2007-04-11 15:19:51 +00:00
|
|
|
OBJ_RELEASE(item);
|
2006-12-07 00:24:01 +00:00
|
|
|
OBJ_DESTRUCT(&mca_pml_base_modex_subscriptions);
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
|
2007-04-05 13:52:05 +00:00
|
|
|
OBJ_DESTRUCT(&mca_pml_base_modex_lock);
|
|
|
|
|
2006-12-07 00:24:01 +00:00
|
|
|
return OMPI_SUCCESS;
|
2004-10-14 20:50:06 +00:00
|
|
|
}
|
|
|
|
|
2004-03-03 16:44:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Look to see if there is any data associated with a specified module.
|
|
|
|
*/
|
2006-12-07 00:21:25 +00:00
|
|
|
static mca_pml_base_modex_module_t *
|
|
|
|
mca_pml_base_modex_lookup_module(mca_pml_base_modex_t * modex,
|
2007-04-11 15:19:51 +00:00
|
|
|
mca_base_component_t * component)
|
2004-03-03 16:44:41 +00:00
|
|
|
{
|
2006-12-07 00:24:01 +00:00
|
|
|
mca_pml_base_modex_module_t *modex_module;
|
|
|
|
for (modex_module = (mca_pml_base_modex_module_t *) opal_list_get_first(&modex->modex_modules);
|
2007-04-11 15:19:51 +00:00
|
|
|
modex_module != (mca_pml_base_modex_module_t *) opal_list_get_end(&modex->modex_modules);
|
|
|
|
modex_module = (mca_pml_base_modex_module_t *) opal_list_get_next(modex_module)) {
|
|
|
|
if (mca_base_component_compatible(&modex_module->component, component) == 0) {
|
|
|
|
return modex_module;
|
|
|
|
}
|
2004-03-03 16:44:41 +00:00
|
|
|
}
|
2006-12-07 00:24:01 +00:00
|
|
|
return NULL;
|
2004-03-03 16:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a placeholder for data associated with the specified module.
|
|
|
|
*/
|
2006-12-07 00:21:25 +00:00
|
|
|
static mca_pml_base_modex_module_t *
|
|
|
|
mca_pml_base_modex_create_module(mca_pml_base_modex_t * modex,
|
2007-04-11 15:19:51 +00:00
|
|
|
mca_base_component_t * component)
|
2004-03-03 16:44:41 +00:00
|
|
|
{
|
2006-12-07 00:24:01 +00:00
|
|
|
mca_pml_base_modex_module_t *modex_module;
|
|
|
|
if (NULL == (modex_module = mca_pml_base_modex_lookup_module(modex, component))) {
|
2007-04-11 15:19:51 +00:00
|
|
|
modex_module = OBJ_NEW(mca_pml_base_modex_module_t);
|
|
|
|
if (NULL != modex_module) {
|
|
|
|
modex_module->component = *component;
|
|
|
|
opal_list_append(&modex->modex_modules, (opal_list_item_t *) modex_module);
|
|
|
|
}
|
2004-03-03 16:44:41 +00:00
|
|
|
}
|
2006-12-07 00:24:01 +00:00
|
|
|
return modex_module;
|
2004-03-03 16:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2004-10-14 20:50:06 +00:00
|
|
|
* Callback for registry notifications.
|
|
|
|
*/
|
2006-12-07 00:21:25 +00:00
|
|
|
static void
|
|
|
|
mca_pml_base_modex_registry_callback(orte_gpr_notify_data_t * data,
|
2007-04-11 15:19:51 +00:00
|
|
|
void *cbdata)
|
2004-10-14 20:50:06 +00:00
|
|
|
{
|
2006-12-07 00:24:01 +00:00
|
|
|
orte_std_cntr_t i, j, k;
|
|
|
|
orte_gpr_value_t **values, *value;
|
|
|
|
orte_gpr_keyval_t **keyval;
|
|
|
|
orte_process_name_t *proc_name;
|
|
|
|
mca_pml_base_modex_t *modex;
|
|
|
|
mca_pml_base_modex_module_t *modex_module;
|
|
|
|
mca_base_component_t component;
|
|
|
|
int rc;
|
2006-12-09 23:10:25 +00:00
|
|
|
ompi_proc_t *proc;
|
2006-12-07 00:24:01 +00:00
|
|
|
|
|
|
|
/* process the callback */
|
|
|
|
values = (orte_gpr_value_t **) (data->values)->addr;
|
|
|
|
for (i = 0, k = 0; k < data->cnt &&
|
2007-04-11 15:19:51 +00:00
|
|
|
i < (data->values)->size; i++) {
|
2006-12-09 23:10:25 +00:00
|
|
|
if (NULL != values[i]) {
|
|
|
|
k++;
|
|
|
|
value = values[i];
|
|
|
|
if (0 < value->cnt) { /* needs to be at least one keyval */
|
|
|
|
/* Find the process name in the keyvals */
|
|
|
|
keyval = value->keyvals;
|
|
|
|
for (j = 0; j < value->cnt; j++) {
|
|
|
|
if (0 != strcmp(keyval[j]->key, ORTE_PROC_NAME_KEY)) continue;
|
|
|
|
/* this is the process name - extract it */
|
|
|
|
if (ORTE_SUCCESS != orte_dss.get((void**)&proc_name, keyval[j]->value, ORTE_NAME)) {
|
|
|
|
opal_output(0, "mca_pml_base_modex_registry_callback: unable to extract process name\n");
|
|
|
|
return; /* nothing we can do */
|
|
|
|
}
|
|
|
|
goto GOTNAME;
|
|
|
|
}
|
|
|
|
opal_output(0, "mca_pml_base_modex_registry_callback: unable to find process name in notify message\n");
|
|
|
|
return; /* if the name wasn't here, there is nothing we can do */
|
|
|
|
|
2007-04-11 15:19:51 +00:00
|
|
|
GOTNAME:
|
2006-12-11 21:27:30 +00:00
|
|
|
/* look up the modex data structure */
|
|
|
|
OPAL_THREAD_LOCK(&mca_pml_base_modex_lock);
|
2007-01-08 22:04:01 +00:00
|
|
|
modex = (mca_pml_base_modex_t*)orte_hash_table_get_proc(&mca_pml_base_modex_data, proc_name);
|
2006-12-11 21:27:30 +00:00
|
|
|
if (modex == NULL) {
|
|
|
|
/* create a modex data structure for this proc */
|
|
|
|
modex = OBJ_NEW(mca_pml_base_modex_t);
|
|
|
|
if (NULL == modex) {
|
|
|
|
opal_output(0, "mca_pml_base_modex_registry_callback: unable to allocate mca_pml_base_modex_t\n");
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_base_modex_lock);
|
|
|
|
return;
|
2006-12-09 23:10:25 +00:00
|
|
|
}
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
|
2006-12-11 21:27:30 +00:00
|
|
|
orte_hash_table_set_proc(&mca_pml_base_modex_data, proc_name, modex);
|
2006-12-09 23:10:25 +00:00
|
|
|
}
|
2006-12-11 21:27:30 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_base_modex_lock);
|
|
|
|
OPAL_THREAD_LOCK(&modex->modex_lock);
|
|
|
|
proc = NULL;
|
2006-12-09 23:10:25 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Extract the component name and version from the keyval object's key
|
|
|
|
* Could be multiple keyvals returned since there is one for each
|
|
|
|
* component type/name/version - process them all
|
|
|
|
*/
|
|
|
|
keyval = value->keyvals;
|
|
|
|
for (j = 0; j < value->cnt; j++) {
|
|
|
|
orte_buffer_t buffer;
|
|
|
|
opal_list_item_t *item;
|
|
|
|
char *ptr;
|
|
|
|
void *bytes = NULL;
|
|
|
|
orte_std_cntr_t cnt;
|
|
|
|
size_t num_bytes;
|
|
|
|
orte_byte_object_t *bo;
|
|
|
|
|
|
|
|
if (strcmp(keyval[j]->key, OMPI_MODEX_KEY) != 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&buffer, orte_buffer_t);
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.get((void **) &bo, keyval[j]->value, ORTE_BYTE_OBJECT))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.load(&buffer, bo->bytes, bo->size))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
cnt = 1;
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.unpack(&buffer, &ptr, &cnt, ORTE_STRING))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
strcpy(component.mca_type_name, ptr);
|
|
|
|
free(ptr);
|
|
|
|
|
|
|
|
cnt = 1;
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.unpack(&buffer, &ptr, &cnt, ORTE_STRING))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
strcpy(component.mca_component_name, ptr);
|
|
|
|
free(ptr);
|
|
|
|
|
|
|
|
cnt = 1;
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.unpack(&buffer,
|
2007-04-11 15:19:51 +00:00
|
|
|
&component.mca_component_major_version, &cnt, ORTE_INT32))) {
|
2006-12-09 23:10:25 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
cnt = 1;
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.unpack(&buffer,
|
2007-04-11 15:19:51 +00:00
|
|
|
&component.mca_component_minor_version, &cnt, ORTE_INT32))) {
|
2006-12-09 23:10:25 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
cnt = 1;
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.unpack(&buffer, &num_bytes, &cnt, ORTE_SIZE))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (num_bytes != 0) {
|
|
|
|
if (NULL == (bytes = malloc(num_bytes))) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
|
|
|
continue;
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
}
|
2006-12-09 23:10:25 +00:00
|
|
|
cnt = (orte_std_cntr_t) num_bytes;
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.unpack(&buffer, bytes, &cnt, ORTE_BYTE))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
num_bytes = cnt;
|
|
|
|
} else {
|
|
|
|
bytes = NULL;
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
}
|
2006-12-09 23:10:25 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Lookup the corresponding modex structure
|
|
|
|
*/
|
|
|
|
if (NULL == (modex_module = mca_pml_base_modex_create_module(modex, &component))) {
|
|
|
|
opal_output(0, "mca_pml_base_modex_registry_callback: mca_pml_base_modex_create_module failed\n");
|
|
|
|
OBJ_RELEASE(data);
|
2006-12-12 18:48:42 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&modex->modex_lock);
|
2006-12-11 21:27:30 +00:00
|
|
|
OBJ_RELEASE(modex);
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
return;
|
|
|
|
}
|
2006-12-09 23:10:25 +00:00
|
|
|
modex_module->module_data = bytes;
|
|
|
|
modex_module->module_data_size = num_bytes;
|
|
|
|
modex_module->module_data_avail = true;
|
|
|
|
opal_condition_signal(&modex_module->module_data_cond);
|
|
|
|
|
2006-12-11 21:27:30 +00:00
|
|
|
if (opal_list_get_size(&modex_module->module_cbs)) {
|
|
|
|
if (NULL == proc) {
|
|
|
|
proc = ompi_proc_find(proc_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != proc) {
|
|
|
|
OPAL_THREAD_LOCK(&proc->proc_lock);
|
|
|
|
/* call any registered callbacks */
|
|
|
|
for (item = opal_list_get_first(&modex_module->module_cbs);
|
|
|
|
item != opal_list_get_end(&modex_module->module_cbs);
|
|
|
|
item = opal_list_get_next(item)) {
|
|
|
|
mca_pml_base_modex_cb_t *cb = (mca_pml_base_modex_cb_t *) item;
|
|
|
|
cb->cbfunc(cb->component, proc, bytes, num_bytes, cb->cbdata);
|
|
|
|
}
|
|
|
|
OPAL_THREAD_UNLOCK(&proc->proc_lock);
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
}
|
2006-12-09 23:10:25 +00:00
|
|
|
}
|
|
|
|
}
|
2006-12-12 18:48:42 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&modex->modex_lock);
|
2006-12-09 23:10:25 +00:00
|
|
|
} /* if value[i]->cnt > 0 */
|
|
|
|
} /* if value[i] != NULL */
|
2004-10-14 20:50:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Make sure we have subscribed to this segment.
|
|
|
|
*/
|
|
|
|
|
2006-12-07 00:21:25 +00:00
|
|
|
static int
|
|
|
|
mca_pml_base_modex_subscribe(orte_process_name_t * name)
|
2004-10-14 20:50:06 +00:00
|
|
|
{
|
2006-12-07 00:24:01 +00:00
|
|
|
char *segment, *sub_name, *trig_name;
|
|
|
|
orte_gpr_subscription_id_t sub_id;
|
|
|
|
orte_jobid_t jobid;
|
|
|
|
opal_list_item_t *item;
|
|
|
|
mca_pml_base_modex_subscription_t *subscription;
|
|
|
|
int rc;
|
2006-12-09 23:10:25 +00:00
|
|
|
char *keys[] = {
|
|
|
|
ORTE_PROC_NAME_KEY,
|
|
|
|
OMPI_MODEX_KEY,
|
|
|
|
NULL
|
|
|
|
};
|
2006-12-07 00:24:01 +00:00
|
|
|
|
|
|
|
/* check for an existing subscription */
|
|
|
|
OPAL_LOCK(&mca_pml_base_modex_lock);
|
|
|
|
if (!opal_list_is_empty(&mca_pml_base_modex_subscriptions)) {
|
2007-04-11 15:19:51 +00:00
|
|
|
for (item = opal_list_get_first(&mca_pml_base_modex_subscriptions);
|
|
|
|
item != opal_list_get_end(&mca_pml_base_modex_subscriptions);
|
|
|
|
item = opal_list_get_next(item)) {
|
|
|
|
subscription = (mca_pml_base_modex_subscription_t *) item;
|
|
|
|
if (subscription->jobid == name->jobid) {
|
|
|
|
OPAL_UNLOCK(&mca_pml_base_modex_lock);
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
2005-03-14 20:57:21 +00:00
|
|
|
}
|
2006-12-07 00:24:01 +00:00
|
|
|
OPAL_UNLOCK(&mca_pml_base_modex_lock);
|
2005-09-01 01:07:30 +00:00
|
|
|
|
2006-12-07 00:24:01 +00:00
|
|
|
/* otherwise - subscribe to get this jobid's contact info */
|
|
|
|
jobid = name->jobid;
|
2005-03-14 20:57:21 +00:00
|
|
|
|
2006-12-07 00:24:01 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_schema.get_std_subscription_name(&sub_name,
|
2007-04-11 15:19:51 +00:00
|
|
|
OMPI_MODEX_SUBSCRIPTION, jobid))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
/* attach to the stage-1 standard trigger */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_schema.get_std_trigger_name(&trig_name,
|
2007-04-11 15:19:51 +00:00
|
|
|
ORTE_STG1_TRIGGER, jobid))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
free(sub_name);
|
|
|
|
return rc;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
/* define the segment */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_schema.get_job_segment_name(&segment, jobid))) {
|
2007-04-11 15:19:51 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
free(sub_name);
|
|
|
|
free(trig_name);
|
|
|
|
return rc;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
if (jobid != orte_process_info.my_name->jobid) {
|
2006-12-09 23:10:25 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_gpr.subscribe_N(&sub_id, NULL, NULL,
|
2007-04-11 15:19:51 +00:00
|
|
|
ORTE_GPR_NOTIFY_ADD_ENTRY |
|
|
|
|
ORTE_GPR_NOTIFY_VALUE_CHG |
|
|
|
|
ORTE_GPR_NOTIFY_PRE_EXISTING,
|
|
|
|
ORTE_GPR_KEYS_OR | ORTE_GPR_TOKENS_OR | ORTE_GPR_STRIPPED,
|
|
|
|
segment,
|
|
|
|
NULL, /* look at all
|
|
|
|
* containers on this
|
|
|
|
* segment */
|
|
|
|
2, keys,
|
|
|
|
mca_pml_base_modex_registry_callback, NULL))) {
|
2006-12-09 23:10:25 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
free(sub_name);
|
|
|
|
free(trig_name);
|
|
|
|
free(segment);
|
|
|
|
return rc;
|
|
|
|
}
|
2006-12-07 00:24:01 +00:00
|
|
|
} else {
|
2006-12-09 23:10:25 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_gpr.subscribe_N(&sub_id, trig_name, sub_name,
|
2007-04-11 15:19:51 +00:00
|
|
|
ORTE_GPR_NOTIFY_ADD_ENTRY |
|
|
|
|
ORTE_GPR_NOTIFY_VALUE_CHG |
|
|
|
|
ORTE_GPR_NOTIFY_STARTS_AFTER_TRIG,
|
|
|
|
ORTE_GPR_KEYS_OR | ORTE_GPR_TOKENS_OR | ORTE_GPR_STRIPPED,
|
|
|
|
segment,
|
|
|
|
NULL, /* look at all
|
|
|
|
* containers on this
|
|
|
|
* segment */
|
|
|
|
2, keys,
|
|
|
|
mca_pml_base_modex_registry_callback, NULL))) {
|
2006-12-09 23:10:25 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
free(sub_name);
|
|
|
|
free(trig_name);
|
|
|
|
free(segment);
|
|
|
|
return rc;
|
|
|
|
}
|
2006-12-07 00:21:25 +00:00
|
|
|
}
|
2006-12-07 00:24:01 +00:00
|
|
|
free(sub_name);
|
|
|
|
free(trig_name);
|
|
|
|
free(segment);
|
|
|
|
|
|
|
|
/* add this jobid to our list of subscriptions */
|
|
|
|
OPAL_LOCK(&mca_pml_base_modex_lock);
|
|
|
|
subscription = OBJ_NEW(mca_pml_base_modex_subscription_t);
|
|
|
|
subscription->jobid = name->jobid;
|
|
|
|
opal_list_append(&mca_pml_base_modex_subscriptions, &subscription->item);
|
|
|
|
OPAL_UNLOCK(&mca_pml_base_modex_lock);
|
|
|
|
return OMPI_SUCCESS;
|
2004-10-14 20:50:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Store the data associated with the specified module in the
|
2005-03-14 20:57:21 +00:00
|
|
|
* gpr. Note that the gpr is in a mode where it caches
|
2004-10-14 20:50:06 +00:00
|
|
|
* individual puts during startup and sends them as an aggregate
|
|
|
|
* command.
|
2004-03-03 16:44:41 +00:00
|
|
|
*/
|
|
|
|
|
2006-12-07 00:21:25 +00:00
|
|
|
int
|
|
|
|
mca_pml_base_modex_send(mca_base_component_t * source_component,
|
2007-04-11 15:19:51 +00:00
|
|
|
const void *data,
|
|
|
|
size_t size)
|
2004-03-03 16:44:41 +00:00
|
|
|
{
|
2006-12-07 00:24:01 +00:00
|
|
|
orte_jobid_t jobid;
|
|
|
|
int rc;
|
|
|
|
orte_buffer_t buffer;
|
|
|
|
orte_std_cntr_t i, num_tokens;
|
|
|
|
char *ptr, *segment, **tokens;
|
|
|
|
orte_byte_object_t bo;
|
|
|
|
orte_data_value_t value = ORTE_DATA_VALUE_EMPTY;
|
|
|
|
|
|
|
|
jobid = ORTE_PROC_MY_NAME->jobid;
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_schema.get_job_segment_name(&segment, jobid))) {
|
2007-04-11 15:19:51 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_schema.get_proc_tokens(&tokens,
|
2007-04-11 15:19:51 +00:00
|
|
|
&num_tokens, orte_process_info.my_name))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
free(segment);
|
|
|
|
return rc;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
OBJ_CONSTRUCT(&buffer, orte_buffer_t);
|
|
|
|
ptr = source_component->mca_type_name;
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, &ptr, 1, ORTE_STRING))) {
|
2007-04-11 15:19:51 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
ptr = source_component->mca_component_name;
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, &ptr, 1, ORTE_STRING))) {
|
2007-04-11 15:19:51 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, &source_component->mca_component_major_version, 1, ORTE_INT32))) {
|
2007-04-11 15:19:51 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, &source_component->mca_component_minor_version, 1, ORTE_INT32))) {
|
2007-04-11 15:19:51 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
2005-09-01 15:05:03 +00:00
|
|
|
}
|
2006-12-07 00:24:01 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, &size, 1, ORTE_SIZE))) {
|
2007-04-11 15:19:51 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
if (0 != size) {
|
2007-04-11 15:19:51 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, (void *) data, size, ORTE_BYTE))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.unload(&buffer, (void **) &(bo.bytes), &(bo.size)))) {
|
2007-04-11 15:19:51 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
OBJ_DESTRUCT(&buffer);
|
|
|
|
|
|
|
|
/* setup the data_value structure to hold the byte object */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.set(&value, (void *) &bo, ORTE_BYTE_OBJECT))) {
|
2007-04-11 15:19:51 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
rc = orte_gpr.put_1(ORTE_GPR_TOKENS_AND | ORTE_GPR_KEYS_OR,
|
2007-04-11 15:19:51 +00:00
|
|
|
segment, tokens, OMPI_MODEX_KEY, &value);
|
2005-09-01 15:05:03 +00:00
|
|
|
|
2007-04-11 15:19:51 +00:00
|
|
|
cleanup:
|
2006-12-07 00:24:01 +00:00
|
|
|
free(segment);
|
|
|
|
for (i = 0; i < num_tokens; i++) {
|
2007-04-11 15:19:51 +00:00
|
|
|
free(tokens[i]);
|
|
|
|
tokens[i] = NULL;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
if (NULL != tokens)
|
2007-04-11 15:19:51 +00:00
|
|
|
free(tokens);
|
2006-12-07 00:24:01 +00:00
|
|
|
|
|
|
|
return rc;
|
2004-03-03 16:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retreive the data for the specified module from the source process.
|
|
|
|
*/
|
|
|
|
|
2006-12-07 00:21:25 +00:00
|
|
|
int
|
|
|
|
mca_pml_base_modex_recv(mca_base_component_t * component,
|
2007-04-11 15:19:51 +00:00
|
|
|
ompi_proc_t * proc,
|
|
|
|
void **buffer,
|
|
|
|
size_t * size)
|
2004-01-29 02:35:33 +00:00
|
|
|
{
|
2006-12-07 00:24:01 +00:00
|
|
|
mca_pml_base_modex_t *modex;
|
|
|
|
mca_pml_base_modex_module_t *modex_module;
|
2004-09-30 20:54:26 +00:00
|
|
|
|
2007-02-13 18:34:03 +00:00
|
|
|
/* make sure we could possibly have modex data */
|
|
|
|
if (0 == strcmp(orte_gpr_base_selected_component.gpr_version.mca_component_name,
|
|
|
|
"null")) {
|
|
|
|
return OMPI_ERR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2006-12-07 00:24:01 +00:00
|
|
|
/* check the proc for cached data */
|
|
|
|
if (NULL == (modex = (mca_pml_base_modex_t *) proc->proc_modex)) {
|
2006-12-11 21:27:30 +00:00
|
|
|
/* see if we already have data for this proc... */
|
|
|
|
OPAL_THREAD_LOCK(&mca_pml_base_modex_lock);
|
2007-01-08 22:04:01 +00:00
|
|
|
modex = (mca_pml_base_modex_t*)orte_hash_table_get_proc(&mca_pml_base_modex_data, &proc->proc_name);
|
2006-12-11 21:27:30 +00:00
|
|
|
if (NULL == modex) {
|
|
|
|
/* create an empty modex data... */
|
|
|
|
modex = OBJ_NEW(mca_pml_base_modex_t);
|
|
|
|
if (NULL == modex) {
|
|
|
|
opal_output(0, "mca_pml_base_modex_recv: unable to allocate mca_pml_base_modex_t\n");
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_base_modex_lock);
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
orte_hash_table_set_proc(&mca_pml_base_modex_data, &proc->proc_name, modex);
|
|
|
|
OBJ_RETAIN(modex);
|
|
|
|
proc->proc_modex = &modex->super.super;
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_base_modex_lock);
|
|
|
|
/* verify that we have subscribed to this segment */
|
|
|
|
mca_pml_base_modex_subscribe(&proc->proc_name);
|
|
|
|
} else {
|
|
|
|
/* create a backpointer from the proc to the modex data */
|
|
|
|
OBJ_RETAIN(modex);
|
|
|
|
proc->proc_modex = &modex->super.super;
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_base_modex_lock);
|
|
|
|
}
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
2006-12-11 21:27:30 +00:00
|
|
|
OPAL_THREAD_LOCK(&modex->modex_lock);
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
|
2006-12-07 00:24:01 +00:00
|
|
|
/* lookup/create the module */
|
|
|
|
if (NULL == (modex_module = mca_pml_base_modex_create_module(modex, component))) {
|
2007-04-11 15:19:51 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&modex->modex_lock);
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
/* wait until data is available */
|
|
|
|
while (modex_module->module_data_avail == false) {
|
2007-04-11 15:19:51 +00:00
|
|
|
opal_condition_wait(&modex_module->module_data_cond, &modex->modex_lock);
|
2006-12-07 00:21:25 +00:00
|
|
|
}
|
2006-12-07 00:24:01 +00:00
|
|
|
|
|
|
|
/* copy the data out to the user */
|
|
|
|
if (modex_module->module_data_size == 0) {
|
2007-04-11 15:19:51 +00:00
|
|
|
*buffer = NULL;
|
|
|
|
*size = 0;
|
2006-12-07 00:24:01 +00:00
|
|
|
} else {
|
2007-04-11 15:19:51 +00:00
|
|
|
void *copy = malloc(modex_module->module_data_size);
|
|
|
|
if (copy == NULL) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
memcpy(copy, modex_module->module_data, modex_module->module_data_size);
|
|
|
|
*buffer = copy;
|
|
|
|
*size = modex_module->module_data_size;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
2006-12-11 21:27:30 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&modex->modex_lock);
|
2006-12-07 00:24:01 +00:00
|
|
|
return OMPI_SUCCESS;
|
2004-01-29 02:35:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-04-27 16:15:35 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-12-07 00:21:25 +00:00
|
|
|
int
|
|
|
|
mca_pml_base_modex_recv_nb(mca_base_component_t * component,
|
2007-04-11 15:19:51 +00:00
|
|
|
ompi_proc_t * proc,
|
|
|
|
mca_pml_base_modex_cb_fn_t cbfunc,
|
|
|
|
void *cbdata)
|
2006-04-27 16:15:35 +00:00
|
|
|
{
|
2006-12-07 00:24:01 +00:00
|
|
|
mca_pml_base_modex_t *modex;
|
|
|
|
mca_pml_base_modex_module_t *module;
|
|
|
|
mca_pml_base_modex_cb_t *cb;
|
2006-04-27 16:15:35 +00:00
|
|
|
|
2006-12-11 21:27:30 +00:00
|
|
|
/* check the proc for cached data */
|
2006-12-07 00:24:01 +00:00
|
|
|
if (NULL == (modex = (mca_pml_base_modex_t *) proc->proc_modex)) {
|
2006-12-11 21:27:30 +00:00
|
|
|
/* see if we already have data for this proc... */
|
|
|
|
OPAL_THREAD_LOCK(&mca_pml_base_modex_lock);
|
2007-01-08 22:04:01 +00:00
|
|
|
modex = (mca_pml_base_modex_t*)orte_hash_table_get_proc(&mca_pml_base_modex_data, &proc->proc_name);
|
2006-12-11 21:27:30 +00:00
|
|
|
if (NULL == modex) {
|
|
|
|
/* create an empty modex data... */
|
|
|
|
modex = OBJ_NEW(mca_pml_base_modex_t);
|
|
|
|
if (NULL == modex) {
|
|
|
|
opal_output(0, "mca_pml_base_modex_recv: unable to allocate mca_pml_base_modex_t\n");
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_base_modex_lock);
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
orte_hash_table_set_proc(&mca_pml_base_modex_data, &proc->proc_name, modex);
|
|
|
|
OBJ_RETAIN(modex);
|
|
|
|
proc->proc_modex = &modex->super.super;
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_base_modex_lock);
|
|
|
|
/* verify that we have subscribed to this segment */
|
|
|
|
mca_pml_base_modex_subscribe(&proc->proc_name);
|
|
|
|
} else {
|
|
|
|
/* create a backpointer from the proc to the modex data */
|
|
|
|
OBJ_RETAIN(modex);
|
|
|
|
proc->proc_modex = &modex->super.super;
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_base_modex_lock);
|
|
|
|
}
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
2006-12-11 21:27:30 +00:00
|
|
|
OPAL_THREAD_LOCK(&modex->modex_lock);
|
Clean up the way procs are added to the global process list after MPI_INIT:
* Do not add new procs to the global list during modex callback or
when sharing orte names during accept/connect. For modex, we
cache the modex info for later, in case that proc ever does get
added to the global proc list. For accept/connect orte name
exchange between the roots, we only need the orte name, so no
need to add a proc structure anyway. The procs will be added
to the global process list during the proc exchange later in
the wireup process
* Rename proc_get_namebuf and proc_get_proclist to proc_pack
and proc_unpack and extend them to include all information
needed to build that proc struct on a remote node (which
includes ORTE name, architecture, and hostname). Change
unpack to call pml_add_procs for the entire list of new
procs at once, rather than one at a time.
* Remove ompi_proc_find_and_add from the public proc
interface and make it a private function. This function
would add a half-created proc to the global proc list, so
making it harder to call is a good thing.
This means that there's only two ways to add new procs into the global proc list at this time: During MPI_INIT via the call to ompi_proc_init, where my job is added to the list and via ompi_proc_unpack using a buffer from a packed proc list sent to us by someone else. Currently, this is enough to implement MPI semantics. We can extend the interface more if we like, but that may require HNP communication to get the remote proc information and I wanted to avoid that if at all possible.
Refs trac:564
This commit was SVN r12798.
The following Trac tickets were found above:
Ticket 564 --> https://svn.open-mpi.org/trac/ompi/ticket/564
2006-12-07 19:56:54 +00:00
|
|
|
|
2006-12-07 00:24:01 +00:00
|
|
|
/* lookup/create the module */
|
|
|
|
if (NULL == (module = mca_pml_base_modex_create_module(modex, component))) {
|
2007-04-11 15:19:51 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&modex->modex_lock);
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2006-12-07 00:24:01 +00:00
|
|
|
}
|
|
|
|
/* register the callback */
|
|
|
|
cb = OBJ_NEW(mca_pml_base_modex_cb_t);
|
|
|
|
cb->component = component;
|
|
|
|
cb->cbfunc = cbfunc;
|
|
|
|
cb->cbdata = cbdata;
|
|
|
|
opal_list_append(&module->module_cbs, (opal_list_item_t *) cb);
|
2006-12-11 21:27:30 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&modex->modex_lock);
|
2006-12-07 00:24:01 +00:00
|
|
|
return OMPI_SUCCESS;
|
2006-04-27 16:15:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-03 16:44:41 +00:00
|
|
|
/**
|
2004-10-14 20:50:06 +00:00
|
|
|
* Subscribe to the segment corresponding
|
|
|
|
* to this job.
|
2004-03-03 16:44:41 +00:00
|
|
|
*/
|
|
|
|
|
2006-12-07 00:21:25 +00:00
|
|
|
int
|
|
|
|
mca_pml_base_modex_exchange(void)
|
2004-01-29 02:35:33 +00:00
|
|
|
{
|
2006-12-07 00:24:01 +00:00
|
|
|
return mca_pml_base_modex_subscribe(orte_process_info.my_name);
|
2004-01-29 02:35:33 +00:00
|
|
|
}
|