2005-12-19 19:37:05 +03:00
|
|
|
/*
|
2006-01-16 06:01:12 +03:00
|
|
|
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
2005-12-19 19:37:05 +03:00
|
|
|
* 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.
|
|
|
|
* 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.
|
2006-05-25 19:47:59 +04:00
|
|
|
* Copyright (c) 2006 Sandia National Laboratories. All rights
|
|
|
|
* reserved.
|
2005-12-19 19:37:05 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/constants.h"
|
2005-12-19 19:37:05 +03:00
|
|
|
#include "opal/event/event.h"
|
|
|
|
#include "opal/util/if.h"
|
|
|
|
#include "opal/util/argv.h"
|
|
|
|
#include "opal/util/output.h"
|
2006-01-12 07:05:02 +03:00
|
|
|
#include "ompi/mca/pml/pml.h"
|
|
|
|
#include "ompi/mca/btl/btl.h"
|
2005-12-19 19:37:05 +03:00
|
|
|
|
2006-01-12 07:05:02 +03:00
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "ompi/mca/mpool/base/base.h"
|
2006-03-21 03:12:55 +03:00
|
|
|
#include "ompi/mca/mpool/udapl/mpool_udapl.h"
|
2005-12-19 19:37:05 +03:00
|
|
|
#include "btl_udapl.h"
|
|
|
|
#include "btl_udapl_frag.h"
|
|
|
|
#include "btl_udapl_endpoint.h"
|
2006-03-21 03:12:55 +03:00
|
|
|
#include "btl_udapl_proc.h"
|
2006-01-12 07:05:02 +03:00
|
|
|
#include "ompi/mca/btl/base/base.h"
|
|
|
|
#include "ompi/mca/btl/base/btl_base_error.h"
|
|
|
|
#include "ompi/datatype/convertor.h"
|
|
|
|
#include "btl_udapl_endpoint.h"
|
|
|
|
#include "orte/util/proc_info.h"
|
|
|
|
#include "ompi/mca/pml/base/pml_base_module_exchange.h"
|
2005-12-19 19:37:05 +03:00
|
|
|
|
2006-03-21 03:12:55 +03:00
|
|
|
|
2005-12-19 19:37:05 +03:00
|
|
|
mca_btl_udapl_component_t mca_btl_udapl_component = {
|
|
|
|
{
|
|
|
|
/* First, the mca_base_component_t struct containing meta information
|
|
|
|
about the component itself */
|
|
|
|
{
|
|
|
|
/* Indicate that we are a pml v1.0.0 component (which also implies a
|
|
|
|
specific MCA version) */
|
|
|
|
|
|
|
|
MCA_BTL_BASE_VERSION_1_0_0,
|
|
|
|
|
|
|
|
"udapl", /* MCA component name */
|
|
|
|
OMPI_MAJOR_VERSION, /* MCA component major version */
|
|
|
|
OMPI_MINOR_VERSION, /* MCA component minor version */
|
|
|
|
OMPI_RELEASE_VERSION, /* MCA component release version */
|
|
|
|
mca_btl_udapl_component_open, /* component open */
|
|
|
|
mca_btl_udapl_component_close /* component close */
|
|
|
|
},
|
|
|
|
|
|
|
|
/* Next the MCA v1.0.0 component meta data */
|
|
|
|
{
|
|
|
|
/* Whether the component is checkpointable or not */
|
|
|
|
|
|
|
|
false
|
|
|
|
},
|
|
|
|
|
|
|
|
mca_btl_udapl_component_init,
|
|
|
|
mca_btl_udapl_component_progress,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-02-11 00:49:15 +03:00
|
|
|
/**
|
|
|
|
* Report a uDAPL error - for debugging
|
|
|
|
*/
|
|
|
|
|
2006-03-31 20:25:19 +04:00
|
|
|
#if OMPI_ENABLE_DEBUG
|
2006-02-11 00:49:15 +03:00
|
|
|
void
|
|
|
|
mca_btl_udapl_error(DAT_RETURN ret, char* str)
|
|
|
|
{
|
|
|
|
char* major;
|
|
|
|
char* minor;
|
|
|
|
|
|
|
|
if(DAT_SUCCESS != dat_strerror(ret,
|
|
|
|
(const char**)&major, (const char**)&minor))
|
|
|
|
{
|
|
|
|
printf("dat_strerror failed! ret is %d\n", ret);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
OPAL_OUTPUT((0, "ERROR: %s %s %s\n", str, major, minor));
|
|
|
|
}
|
2006-03-31 20:25:19 +04:00
|
|
|
#endif
|
2006-02-11 00:49:15 +03:00
|
|
|
|
|
|
|
|
2005-12-19 19:37:05 +03:00
|
|
|
/*
|
2006-02-11 00:49:15 +03:00
|
|
|
* Utility routines for parameter registration
|
2005-12-19 19:37:05 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
static inline char* mca_btl_udapl_param_register_string(
|
|
|
|
const char* param_name,
|
|
|
|
const char* default_value)
|
|
|
|
{
|
|
|
|
char *param_value;
|
2006-01-12 07:05:02 +03:00
|
|
|
int id = mca_base_param_register_string("btl","udapl",param_name,NULL,default_value);
|
2005-12-19 19:37:05 +03:00
|
|
|
mca_base_param_lookup_string(id, ¶m_value);
|
|
|
|
return param_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mca_btl_udapl_param_register_int(
|
|
|
|
const char* param_name,
|
|
|
|
int default_value)
|
|
|
|
{
|
2006-01-12 07:05:02 +03:00
|
|
|
int id = mca_base_param_register_int("btl","udapl",param_name,NULL,default_value);
|
2005-12-19 19:37:05 +03:00
|
|
|
int param_value = default_value;
|
|
|
|
mca_base_param_lookup_int(id,¶m_value);
|
|
|
|
return param_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called by MCA framework to open the component, registers
|
|
|
|
* component parameters.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_udapl_component_open(void)
|
2006-01-12 07:05:02 +03:00
|
|
|
{
|
|
|
|
int param, value;
|
2005-12-19 19:37:05 +03:00
|
|
|
|
|
|
|
/* initialize state */
|
|
|
|
mca_btl_udapl_component.udapl_num_btls=0;
|
|
|
|
mca_btl_udapl_component.udapl_btls=NULL;
|
|
|
|
|
|
|
|
/* initialize objects */
|
|
|
|
OBJ_CONSTRUCT(&mca_btl_udapl_component.udapl_procs, opal_list_t);
|
2006-01-12 07:05:02 +03:00
|
|
|
OBJ_CONSTRUCT(&mca_btl_udapl_component.udapl_lock, opal_mutex_t);
|
2005-12-19 19:37:05 +03:00
|
|
|
|
|
|
|
/* register uDAPL component parameters */
|
|
|
|
mca_btl_udapl_component.udapl_free_list_num =
|
2006-02-11 00:49:15 +03:00
|
|
|
mca_btl_udapl_param_register_int("free_list_num", 8);
|
2005-12-19 19:37:05 +03:00
|
|
|
mca_btl_udapl_component.udapl_free_list_max =
|
2006-02-11 00:49:15 +03:00
|
|
|
mca_btl_udapl_param_register_int("free_list_max", -1);
|
2005-12-19 19:37:05 +03:00
|
|
|
mca_btl_udapl_component.udapl_free_list_inc =
|
2006-02-11 00:49:15 +03:00
|
|
|
mca_btl_udapl_param_register_int("free_list_inc", 8);
|
|
|
|
mca_btl_udapl_component.udapl_mpool_name =
|
|
|
|
mca_btl_udapl_param_register_string("mpool", "udapl");
|
2006-01-12 07:05:02 +03:00
|
|
|
mca_btl_udapl_component.udapl_max_btls =
|
2006-05-25 19:47:59 +04:00
|
|
|
mca_btl_udapl_param_register_int("max_modules", 8);
|
2006-01-16 06:01:12 +03:00
|
|
|
mca_btl_udapl_component.udapl_evd_qlen =
|
2006-06-13 02:42:01 +04:00
|
|
|
mca_btl_udapl_param_register_int("evd_qlen", 32);
|
|
|
|
mca_btl_udapl_component.udapl_num_recvs =
|
|
|
|
mca_btl_udapl_param_register_int("num_recvs", 8);
|
|
|
|
mca_btl_udapl_component.udapl_num_sends =
|
|
|
|
mca_btl_udapl_param_register_int("num_sends", 8);
|
2006-03-21 03:12:55 +03:00
|
|
|
mca_btl_udapl_component.udapl_port_low =
|
|
|
|
mca_btl_udapl_param_register_int("port_low", 45000);
|
|
|
|
mca_btl_udapl_component.udapl_port_high =
|
2006-06-13 02:42:01 +04:00
|
|
|
mca_btl_udapl_param_register_int("port_high", 49000);
|
2006-03-21 03:12:55 +03:00
|
|
|
mca_btl_udapl_component.udapl_timeout =
|
|
|
|
mca_btl_udapl_param_register_int("timeout", 10000000);
|
2006-01-12 07:05:02 +03:00
|
|
|
|
|
|
|
/* register uDAPL module parameters */
|
2005-12-19 19:37:05 +03:00
|
|
|
mca_btl_udapl_module.super.btl_exclusivity =
|
2006-06-13 02:42:01 +04:00
|
|
|
mca_btl_udapl_param_register_int ("exclusivity",
|
|
|
|
MCA_BTL_EXCLUSIVITY_DEFAULT - 10);
|
2005-12-19 19:37:05 +03:00
|
|
|
mca_btl_udapl_module.super.btl_eager_limit =
|
2006-01-12 07:05:02 +03:00
|
|
|
mca_btl_udapl_param_register_int ("eager_limit", 32*1024);
|
2005-12-19 19:37:05 +03:00
|
|
|
mca_btl_udapl_module.super.btl_min_send_size =
|
2006-05-25 19:47:59 +04:00
|
|
|
mca_btl_udapl_param_register_int ("min_send_size", 16*1024);
|
2005-12-19 19:37:05 +03:00
|
|
|
mca_btl_udapl_module.super.btl_max_send_size =
|
2006-01-12 07:05:02 +03:00
|
|
|
mca_btl_udapl_param_register_int ("max_send_size", 64*1024);
|
2005-12-19 19:37:05 +03:00
|
|
|
mca_btl_udapl_module.super.btl_min_rdma_size =
|
2006-01-12 07:05:02 +03:00
|
|
|
mca_btl_udapl_param_register_int("min_rdma_size", 512*1024);
|
2005-12-19 19:37:05 +03:00
|
|
|
mca_btl_udapl_module.super.btl_max_rdma_size =
|
2006-02-11 00:49:15 +03:00
|
|
|
mca_btl_udapl_param_register_int("max_rdma_size", 128*1024);
|
2006-01-12 07:05:02 +03:00
|
|
|
mca_btl_udapl_module.super.btl_bandwidth =
|
|
|
|
mca_btl_udapl_param_register_int("bandwidth", 225);
|
|
|
|
|
2006-03-31 20:25:19 +04:00
|
|
|
/* compute udapl_eager_frag_size and udapl_max_frag_size */
|
2006-01-25 05:21:34 +03:00
|
|
|
mca_btl_udapl_component.udapl_eager_frag_size =
|
2006-05-25 19:47:59 +04:00
|
|
|
mca_btl_udapl_module.super.btl_eager_limit;
|
|
|
|
mca_btl_udapl_module.super.btl_eager_limit -=
|
|
|
|
sizeof(mca_btl_base_header_t);
|
|
|
|
|
2006-01-25 05:21:34 +03:00
|
|
|
mca_btl_udapl_component.udapl_max_frag_size =
|
2006-05-25 19:47:59 +04:00
|
|
|
mca_btl_udapl_module.super.btl_max_send_size;
|
|
|
|
mca_btl_udapl_module.super.btl_max_send_size -=
|
|
|
|
sizeof(mca_btl_base_header_t);
|
|
|
|
|
2006-01-12 07:05:02 +03:00
|
|
|
|
|
|
|
/* leave pinned option */
|
|
|
|
value = 0;
|
|
|
|
param = mca_base_param_find("mpi", NULL, "leave_pinned");
|
|
|
|
mca_base_param_lookup_int(param, &value);
|
|
|
|
mca_btl_udapl_component.leave_pinned = value;
|
2005-12-19 19:37:05 +03:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-01-12 07:05:02 +03:00
|
|
|
|
2005-12-19 19:37:05 +03:00
|
|
|
/*
|
|
|
|
* component cleanup - sanity checking of queue lengths
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_udapl_component_close(void)
|
|
|
|
{
|
2006-01-17 00:54:50 +03:00
|
|
|
/* TODO - what needs to be done here? */
|
2005-12-19 19:37:05 +03:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-01-12 07:05:02 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Register uDAPL component addressing information. The MCA framework
|
|
|
|
* will make this available to all peers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
|
|
|
mca_btl_udapl_modex_send(void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
size_t i;
|
|
|
|
size_t size;
|
|
|
|
mca_btl_udapl_addr_t *addrs = NULL;
|
|
|
|
|
2006-01-25 05:21:34 +03:00
|
|
|
size = sizeof(mca_btl_udapl_addr_t) *
|
|
|
|
mca_btl_udapl_component.udapl_num_btls;
|
|
|
|
|
2006-01-12 07:05:02 +03:00
|
|
|
if (0 != size) {
|
2006-03-31 20:25:19 +04:00
|
|
|
addrs = (mca_btl_udapl_addr_t*)malloc(size);
|
2006-01-12 07:05:02 +03:00
|
|
|
if (NULL == addrs) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < mca_btl_udapl_component.udapl_num_btls; i++) {
|
2006-03-31 20:25:19 +04:00
|
|
|
mca_btl_udapl_module_t* btl = mca_btl_udapl_component.udapl_btls[i];
|
2006-01-12 07:05:02 +03:00
|
|
|
addrs[i] = btl->udapl_addr;
|
|
|
|
}
|
|
|
|
}
|
2006-03-31 20:25:19 +04:00
|
|
|
|
|
|
|
rc = mca_pml_base_modex_send(
|
|
|
|
&mca_btl_udapl_component.super.btl_version, addrs, size);
|
2006-01-12 07:05:02 +03:00
|
|
|
if (NULL != addrs) {
|
|
|
|
free (addrs);
|
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
2006-01-17 00:54:50 +03:00
|
|
|
|
|
|
|
|
2005-12-19 19:37:05 +03:00
|
|
|
/*
|
2006-01-12 07:05:02 +03:00
|
|
|
* Initialize the uDAPL component,
|
|
|
|
* check how many interfaces are available and create a btl module for each.
|
2005-12-19 19:37:05 +03:00
|
|
|
*/
|
|
|
|
|
2006-01-12 07:05:02 +03:00
|
|
|
mca_btl_base_module_t **
|
|
|
|
mca_btl_udapl_component_init (int *num_btl_modules,
|
|
|
|
bool enable_progress_threads,
|
|
|
|
bool enable_mpi_threads)
|
2005-12-19 19:37:05 +03:00
|
|
|
{
|
2006-01-12 07:05:02 +03:00
|
|
|
DAT_PROVIDER_INFO* datinfo;
|
2006-05-10 23:50:30 +04:00
|
|
|
DAT_PROVIDER_INFO** datinfoptr;
|
2006-01-12 07:05:02 +03:00
|
|
|
mca_btl_base_module_t **btls;
|
2006-01-16 06:01:12 +03:00
|
|
|
mca_btl_udapl_module_t *btl;
|
2006-01-25 05:21:34 +03:00
|
|
|
DAT_COUNT num_ias;
|
|
|
|
int32_t i;
|
2006-01-16 06:01:12 +03:00
|
|
|
|
2006-01-12 07:05:02 +03:00
|
|
|
/* enumerate uDAPL interfaces */
|
2006-05-25 19:47:59 +04:00
|
|
|
/* Have to do weird pointer stuff to make uDAPL happy -
|
|
|
|
just an array of DAT_PROVIDER_INFO isn't good enough. */
|
2006-01-25 05:21:34 +03:00
|
|
|
datinfo = malloc(sizeof(DAT_PROVIDER_INFO) *
|
|
|
|
mca_btl_udapl_component.udapl_max_btls);
|
2006-05-10 23:50:30 +04:00
|
|
|
datinfoptr = malloc(sizeof(DAT_PROVIDER_INFO*) *
|
|
|
|
mca_btl_udapl_component.udapl_max_btls);
|
|
|
|
if(NULL == datinfo || NULL == datinfoptr) {
|
2006-01-16 06:01:12 +03:00
|
|
|
return NULL;
|
|
|
|
}
|
2006-05-10 23:50:30 +04:00
|
|
|
|
2006-05-25 19:47:59 +04:00
|
|
|
for(i = 0; i < (int32_t)mca_btl_udapl_component.udapl_max_btls; i++) {
|
|
|
|
datinfoptr[i] = &datinfo[i];
|
|
|
|
}
|
2006-05-10 23:50:30 +04:00
|
|
|
|
2006-01-25 05:21:34 +03:00
|
|
|
if(DAT_SUCCESS != dat_registry_list_providers(
|
|
|
|
mca_btl_udapl_component.udapl_max_btls,
|
2006-05-25 19:47:59 +04:00
|
|
|
(DAT_COUNT*)&num_ias, datinfoptr)) {
|
2006-01-16 06:01:12 +03:00
|
|
|
free(datinfo);
|
2006-05-25 19:47:59 +04:00
|
|
|
free(datinfoptr);
|
2006-01-16 06:01:12 +03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-05-25 19:47:59 +04:00
|
|
|
free(datinfoptr);
|
2006-05-10 23:50:30 +04:00
|
|
|
|
2006-01-25 05:21:34 +03:00
|
|
|
/* allocate space for the each possible BTL */
|
2006-02-11 00:49:15 +03:00
|
|
|
mca_btl_udapl_component.udapl_btls = (mca_btl_udapl_module_t **)
|
2006-01-25 05:21:34 +03:00
|
|
|
malloc(num_ias * sizeof(mca_btl_udapl_module_t *));
|
2006-01-16 06:01:12 +03:00
|
|
|
if(NULL == mca_btl_udapl_component.udapl_btls) {
|
|
|
|
free(datinfo);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-01-25 05:21:34 +03:00
|
|
|
/* create a BTL module for each interface */
|
|
|
|
for(mca_btl_udapl_component.udapl_num_btls = i = 0; i < num_ias; i++) {
|
2006-01-16 06:01:12 +03:00
|
|
|
btl = malloc(sizeof(mca_btl_udapl_module_t));
|
|
|
|
if(NULL == btl) {
|
|
|
|
free(datinfo);
|
|
|
|
free(mca_btl_udapl_component.udapl_btls);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* copy default values into the new BTL */
|
|
|
|
memcpy(btl, &mca_btl_udapl_module, sizeof(mca_btl_udapl_module_t));
|
|
|
|
|
2006-01-25 05:21:34 +03:00
|
|
|
/* initialize this BTL */
|
|
|
|
/* TODO - make use of the thread-safety info in datinfo also */
|
2006-01-17 00:54:50 +03:00
|
|
|
if(OMPI_SUCCESS != mca_btl_udapl_init(datinfo[i].ia_name, btl)) {
|
2006-01-16 06:01:12 +03:00
|
|
|
free(btl);
|
2006-01-25 05:21:34 +03:00
|
|
|
continue;
|
2006-01-16 06:01:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* successful btl creation */
|
2006-05-25 19:47:59 +04:00
|
|
|
mca_btl_udapl_component.udapl_btls[mca_btl_udapl_component.udapl_num_btls] = btl;
|
2006-01-25 05:21:34 +03:00
|
|
|
if(++mca_btl_udapl_component.udapl_num_btls >=
|
|
|
|
mca_btl_udapl_component.udapl_max_btls) {
|
|
|
|
break;
|
|
|
|
}
|
2006-01-16 06:01:12 +03:00
|
|
|
}
|
2006-01-12 07:05:02 +03:00
|
|
|
|
|
|
|
/* finished with datinfo */
|
|
|
|
free(datinfo);
|
|
|
|
|
2006-01-25 05:21:34 +03:00
|
|
|
/* Make sure we have some interfaces */
|
|
|
|
if(0 == mca_btl_udapl_component.udapl_num_btls) {
|
|
|
|
mca_btl_base_error_no_nics("uDAPL", "NIC");
|
|
|
|
free(mca_btl_udapl_component.udapl_btls);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-01-12 07:05:02 +03:00
|
|
|
/* publish uDAPL parameters with the MCA framework */
|
|
|
|
if (OMPI_SUCCESS != mca_btl_udapl_modex_send()) {
|
2006-01-25 05:21:34 +03:00
|
|
|
free(mca_btl_udapl_component.udapl_btls);
|
2006-01-12 07:05:02 +03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-04-07 19:26:05 +04:00
|
|
|
/* Post OOB receive */
|
|
|
|
mca_btl_udapl_endpoint_post_oob_recv();
|
|
|
|
|
2006-01-12 07:05:02 +03:00
|
|
|
/* return array of BTLs */
|
2006-01-25 05:21:34 +03:00
|
|
|
btls = (mca_btl_base_module_t**) malloc(sizeof(mca_btl_base_module_t *) *
|
|
|
|
mca_btl_udapl_component.udapl_num_btls);
|
2006-01-12 07:05:02 +03:00
|
|
|
if (NULL == btls) {
|
2006-01-25 05:21:34 +03:00
|
|
|
free(mca_btl_udapl_component.udapl_btls);
|
2006-01-12 07:05:02 +03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(btls, mca_btl_udapl_component.udapl_btls,
|
2006-01-25 05:21:34 +03:00
|
|
|
mca_btl_udapl_component.udapl_num_btls *
|
|
|
|
sizeof(mca_btl_udapl_module_t *));
|
2006-01-12 07:05:02 +03:00
|
|
|
*num_btl_modules = mca_btl_udapl_component.udapl_num_btls;
|
|
|
|
return btls;
|
2005-12-19 19:37:05 +03:00
|
|
|
}
|
2006-01-17 00:54:50 +03:00
|
|
|
|
2005-12-19 19:37:05 +03:00
|
|
|
|
2006-06-13 02:42:01 +04:00
|
|
|
static int mca_btl_udapl_accept_connect(mca_btl_udapl_module_t* btl,
|
|
|
|
DAT_CR_HANDLE cr_handle)
|
2006-03-21 03:12:55 +03:00
|
|
|
{
|
|
|
|
DAT_EP_HANDLE endpoint;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = dat_ep_create(btl->udapl_ia, btl->udapl_pz,
|
|
|
|
btl->udapl_evd_dto, btl->udapl_evd_dto,
|
|
|
|
btl->udapl_evd_conn, NULL, &endpoint);
|
|
|
|
if(DAT_SUCCESS != rc) {
|
2006-03-31 20:25:19 +04:00
|
|
|
MCA_BTL_UDAPL_ERROR(rc, "dat_ep_create");
|
2006-03-21 03:12:55 +03:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = dat_cr_accept(cr_handle, endpoint, 0, NULL);
|
|
|
|
if(DAT_SUCCESS != rc) {
|
2006-03-31 20:25:19 +04:00
|
|
|
MCA_BTL_UDAPL_ERROR(rc, "dat_cr_accept");
|
2006-03-21 03:12:55 +03:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-12-19 19:37:05 +03:00
|
|
|
/*
|
2006-01-16 06:01:12 +03:00
|
|
|
* uDAPL component progress.
|
2005-12-19 19:37:05 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_udapl_component_progress()
|
|
|
|
{
|
2006-02-11 00:49:15 +03:00
|
|
|
mca_btl_udapl_module_t* btl;
|
2006-01-12 07:05:02 +03:00
|
|
|
static int32_t inprogress = 0;
|
2006-02-11 00:49:15 +03:00
|
|
|
DAT_EVENT event;
|
2006-01-12 07:05:02 +03:00
|
|
|
int count = 0;
|
|
|
|
size_t i;
|
2006-01-16 06:01:12 +03:00
|
|
|
|
2006-01-25 05:21:34 +03:00
|
|
|
/* prevent deadlock - only one thread should be 'progressing' at a time */
|
2006-01-12 07:05:02 +03:00
|
|
|
if(OPAL_THREAD_ADD32(&inprogress, 1) > 1) {
|
|
|
|
OPAL_THREAD_ADD32(&inprogress, -1);
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-01-25 05:21:34 +03:00
|
|
|
/* check for work to do on each uDAPL btl */
|
2006-03-30 01:55:41 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_btl_udapl_component.udapl_lock);
|
2006-02-11 00:49:15 +03:00
|
|
|
for(i = 0; i < mca_btl_udapl_component.udapl_num_btls; i++) {
|
|
|
|
btl = mca_btl_udapl_component.udapl_btls[i];
|
|
|
|
|
|
|
|
/* Check DTO EVD */
|
|
|
|
while(DAT_SUCCESS ==
|
|
|
|
dat_evd_dequeue(btl->udapl_evd_dto, &event)) {
|
2006-03-21 03:12:55 +03:00
|
|
|
DAT_DTO_COMPLETION_EVENT_DATA* dto;
|
2006-03-30 01:55:41 +04:00
|
|
|
mca_btl_udapl_frag_t* frag;
|
2006-06-13 02:42:01 +04:00
|
|
|
|
2006-02-11 00:49:15 +03:00
|
|
|
switch(event.event_number) {
|
|
|
|
case DAT_DTO_COMPLETION_EVENT:
|
2006-03-21 03:12:55 +03:00
|
|
|
dto = &event.event_data.dto_completion_event_data;
|
|
|
|
|
2006-05-25 19:47:59 +04:00
|
|
|
frag = dto->user_cookie.as_ptr;
|
2006-03-21 03:12:55 +03:00
|
|
|
/* Was the DTO successful? */
|
|
|
|
if(DAT_DTO_SUCCESS != dto->status) {
|
|
|
|
OPAL_OUTPUT((0,
|
2006-05-25 19:47:59 +04:00
|
|
|
"btl_udapl ***** DTO error %d *****\n",
|
|
|
|
dto->status));
|
2006-03-21 03:12:55 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(frag->type) {
|
|
|
|
case MCA_BTL_UDAPL_SEND:
|
2006-06-13 02:42:01 +04:00
|
|
|
{
|
|
|
|
mca_btl_udapl_endpoint_t* endpoint = frag->endpoint;
|
|
|
|
/*OPAL_OUTPUT((0, "btl_udapl UDAPL_SEND %d",
|
|
|
|
dto->transfered_length));*/
|
|
|
|
|
|
|
|
assert(frag->base.des_src == &frag->segment);
|
|
|
|
assert(frag->base.des_src_cnt == 1);
|
|
|
|
assert(frag->base.des_dst == NULL);
|
|
|
|
assert(frag->base.des_dst_cnt == 0);
|
|
|
|
assert(frag->type == MCA_BTL_UDAPL_SEND);
|
2006-03-30 01:55:41 +04:00
|
|
|
|
|
|
|
frag->base.des_cbfunc(&btl->super, frag->endpoint,
|
|
|
|
&frag->base, OMPI_SUCCESS);
|
2006-06-13 02:42:01 +04:00
|
|
|
|
|
|
|
if(frag->size ==
|
|
|
|
mca_btl_udapl_component.udapl_eager_frag_size) {
|
|
|
|
if(!opal_list_is_empty(
|
|
|
|
&endpoint->endpoint_eager_frags)) {
|
|
|
|
DAT_DTO_COOKIE cookie;
|
|
|
|
|
|
|
|
frag = (mca_btl_udapl_frag_t*)
|
|
|
|
opal_list_remove_first(
|
|
|
|
&endpoint->endpoint_eager_frags);
|
|
|
|
|
|
|
|
assert(frag->triplet.segment_length ==
|
|
|
|
frag->segment.seg_len +
|
|
|
|
sizeof(mca_btl_base_header_t));
|
|
|
|
|
|
|
|
cookie.as_ptr = frag;
|
|
|
|
dat_ep_post_send(endpoint->endpoint_eager,
|
|
|
|
1, &frag->triplet, cookie,
|
|
|
|
DAT_COMPLETION_DEFAULT_FLAG);
|
|
|
|
} else {
|
|
|
|
OPAL_THREAD_ADD32(
|
|
|
|
&endpoint->endpoint_eager_sends, 1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
assert(frag->size ==
|
|
|
|
mca_btl_udapl_component.udapl_max_frag_size);
|
|
|
|
if(!opal_list_is_empty(
|
|
|
|
&endpoint->endpoint_max_frags)) {
|
|
|
|
DAT_DTO_COOKIE cookie;
|
|
|
|
|
|
|
|
frag = (mca_btl_udapl_frag_t*)
|
|
|
|
opal_list_remove_first(
|
|
|
|
&endpoint->endpoint_max_frags);
|
|
|
|
|
|
|
|
assert(frag->triplet.segment_length ==
|
|
|
|
frag->segment.seg_len +
|
|
|
|
sizeof(mca_btl_base_header_t));
|
|
|
|
|
|
|
|
cookie.as_ptr = frag;
|
|
|
|
dat_ep_post_send(endpoint->endpoint_max,
|
|
|
|
1, &frag->triplet, cookie,
|
|
|
|
DAT_COMPLETION_DEFAULT_FLAG);
|
|
|
|
} else {
|
|
|
|
OPAL_THREAD_ADD32(
|
|
|
|
&endpoint->endpoint_max_sends, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-30 01:55:41 +04:00
|
|
|
break;
|
2006-06-13 02:42:01 +04:00
|
|
|
}
|
2006-03-30 01:55:41 +04:00
|
|
|
case MCA_BTL_UDAPL_RECV:
|
|
|
|
{
|
|
|
|
mca_btl_base_recv_reg_t* reg =
|
|
|
|
&btl->udapl_reg[frag->hdr->tag];
|
|
|
|
|
2006-06-13 02:42:01 +04:00
|
|
|
assert(frag->base.des_dst == &frag->segment);
|
|
|
|
assert(frag->base.des_dst_cnt == 1);
|
|
|
|
assert(frag->base.des_src == NULL);
|
|
|
|
assert(frag->base.des_src_cnt == 0);
|
|
|
|
assert(frag->type == MCA_BTL_UDAPL_RECV);
|
|
|
|
assert(frag->triplet.virtual_address ==
|
|
|
|
(DAT_VADDR)frag->hdr);
|
|
|
|
assert(frag->triplet.segment_length == frag->size);
|
|
|
|
assert(frag->btl == btl);
|
|
|
|
|
|
|
|
/*OPAL_OUTPUT((0, "btl_udapl UDAPL_RECV %d",
|
|
|
|
dto->transfered_length));*/
|
|
|
|
|
|
|
|
/* OPAL_OUTPUT((0, "recv from %s %d %p\n",
|
|
|
|
inet_ntoa(addr->sin_addr), ntohs(addr->sin_port),
|
|
|
|
frag->endpoint));*/
|
2006-03-30 01:55:41 +04:00
|
|
|
frag->segment.seg_addr.pval = frag->hdr + 1;
|
|
|
|
frag->segment.seg_len = dto->transfered_length -
|
|
|
|
sizeof(mca_btl_base_header_t);
|
|
|
|
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_btl_udapl_component.udapl_lock);
|
|
|
|
reg->cbfunc(&btl->super,
|
|
|
|
frag->hdr->tag, &frag->base, reg->cbdata);
|
|
|
|
OPAL_THREAD_LOCK(&mca_btl_udapl_component.udapl_lock);
|
|
|
|
|
|
|
|
/* Repost the frag */
|
|
|
|
frag->segment.seg_addr.pval = frag->hdr;
|
2006-04-20 02:20:22 +04:00
|
|
|
frag->segment.seg_len =
|
|
|
|
frag->size - sizeof(mca_btl_base_header_t);
|
2006-06-13 02:42:01 +04:00
|
|
|
frag->base.des_flags = 0;
|
2006-04-07 19:26:05 +04:00
|
|
|
|
2006-05-25 19:47:59 +04:00
|
|
|
if(frag->size ==
|
|
|
|
mca_btl_udapl_component.udapl_eager_frag_size) {
|
|
|
|
dat_ep_post_recv(frag->endpoint->endpoint_eager,
|
|
|
|
1, &frag->triplet, dto->user_cookie,
|
|
|
|
DAT_COMPLETION_DEFAULT_FLAG);
|
2006-06-13 02:42:01 +04:00
|
|
|
} else {
|
|
|
|
assert(frag->size ==
|
|
|
|
mca_btl_udapl_component.udapl_max_frag_size);
|
2006-05-25 19:47:59 +04:00
|
|
|
dat_ep_post_recv(frag->endpoint->endpoint_max,
|
|
|
|
1, &frag->triplet, dto->user_cookie,
|
|
|
|
DAT_COMPLETION_DEFAULT_FLAG);
|
|
|
|
}
|
2006-03-21 03:12:55 +03:00
|
|
|
|
|
|
|
break;
|
2006-05-25 19:47:59 +04:00
|
|
|
}
|
2006-03-21 03:12:55 +03:00
|
|
|
default:
|
|
|
|
OPAL_OUTPUT((0, "WARNING unknown frag type: %d\n",
|
|
|
|
frag->type));
|
|
|
|
}
|
2006-02-11 00:49:15 +03:00
|
|
|
count++;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
OPAL_OUTPUT((0, "WARNING unknown dto event: %d\n",
|
|
|
|
event.event_number));
|
|
|
|
}
|
|
|
|
}
|
2006-01-12 07:05:02 +03:00
|
|
|
|
2006-02-11 00:49:15 +03:00
|
|
|
/* Check connection EVD */
|
|
|
|
while(DAT_SUCCESS ==
|
|
|
|
dat_evd_dequeue(btl->udapl_evd_conn, &event)) {
|
2006-03-21 03:12:55 +03:00
|
|
|
|
2006-02-11 00:49:15 +03:00
|
|
|
switch(event.event_number) {
|
|
|
|
case DAT_CONNECTION_REQUEST_EVENT:
|
|
|
|
/* Accept a new connection */
|
2006-03-21 03:12:55 +03:00
|
|
|
mca_btl_udapl_accept_connect(btl,
|
|
|
|
event.event_data.cr_arrival_event_data.cr_handle);
|
2006-02-11 00:49:15 +03:00
|
|
|
count++;
|
|
|
|
break;
|
|
|
|
case DAT_CONNECTION_EVENT_ESTABLISHED:
|
2006-03-21 03:12:55 +03:00
|
|
|
/* Both the client and server side of a connection generate
|
|
|
|
this event */
|
2006-05-25 19:47:59 +04:00
|
|
|
|
|
|
|
mca_btl_udapl_endpoint_finish_connect(btl,
|
|
|
|
event.event_data.connect_event_data.ep_handle);
|
2006-03-21 03:12:55 +03:00
|
|
|
|
2006-02-11 00:49:15 +03:00
|
|
|
count++;
|
|
|
|
break;
|
|
|
|
case DAT_CONNECTION_EVENT_PEER_REJECTED:
|
|
|
|
case DAT_CONNECTION_EVENT_NON_PEER_REJECTED:
|
|
|
|
case DAT_CONNECTION_EVENT_ACCEPT_COMPLETION_ERROR:
|
|
|
|
case DAT_CONNECTION_EVENT_DISCONNECTED:
|
|
|
|
case DAT_CONNECTION_EVENT_BROKEN:
|
|
|
|
case DAT_CONNECTION_EVENT_TIMED_OUT:
|
2006-03-21 03:12:55 +03:00
|
|
|
/* handle this case specially? if we have finite timeout,
|
|
|
|
we might want to try connecting again here. */
|
2006-02-11 00:49:15 +03:00
|
|
|
case DAT_CONNECTION_EVENT_UNREACHABLE:
|
2006-03-21 03:12:55 +03:00
|
|
|
/* Need to set the BTL endpoint to MCA_BTL_UDAPL_FAILED
|
|
|
|
See dat_ep_connect documentation pdf pg 198 */
|
2006-02-11 00:49:15 +03:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
OPAL_OUTPUT((0, "WARNING unknown conn event: %d\n",
|
|
|
|
event.event_number));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check async EVD */
|
|
|
|
while(DAT_SUCCESS ==
|
|
|
|
dat_evd_dequeue(btl->udapl_evd_async, &event)) {
|
|
|
|
switch(event.event_number) {
|
|
|
|
case DAT_ASYNC_ERROR_EVD_OVERFLOW:
|
|
|
|
case DAT_ASYNC_ERROR_IA_CATASTROPHIC:
|
|
|
|
case DAT_ASYNC_ERROR_EP_BROKEN:
|
|
|
|
case DAT_ASYNC_ERROR_TIMED_OUT:
|
|
|
|
case DAT_ASYNC_ERROR_PROVIDER_INTERNAL_ERROR:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
OPAL_OUTPUT((0, "WARNING unknown async event: %d\n",
|
|
|
|
event.event_number));
|
|
|
|
}
|
|
|
|
}
|
2006-01-12 07:05:02 +03:00
|
|
|
}
|
2006-01-25 05:21:34 +03:00
|
|
|
|
|
|
|
/* unlock and return */
|
2006-03-30 01:55:41 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_btl_udapl_component.udapl_lock);
|
2006-01-12 07:05:02 +03:00
|
|
|
OPAL_THREAD_ADD32(&inprogress, -1);
|
|
|
|
return count;
|
2005-12-19 19:37:05 +03:00
|
|
|
}
|
|
|
|
|