2007-12-21 06:02:00 +00:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
2005-12-19 16:37:05 +00:00
|
|
|
/*
|
2007-03-16 23:11:45 +00:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2005-12-19 16:37:05 +00: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 15:47:59 +00:00
|
|
|
* Copyright (c) 2006 Sandia National Laboratories. All rights
|
|
|
|
* reserved.
|
2007-04-24 18:34:16 +00:00
|
|
|
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
|
2006-07-28 13:58:21 +00:00
|
|
|
*
|
2005-12-19 16:37:05 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
2007-01-02 21:44:12 +00:00
|
|
|
#include <errno.h>
|
2005-12-19 16:37:05 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include "opal/util/output.h"
|
|
|
|
#include "opal/util/if.h"
|
2007-01-11 15:22:08 +00:00
|
|
|
#include "opal/util/show_help.h"
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "ompi/mca/pml/pml.h"
|
|
|
|
#include "ompi/mca/btl/btl.h"
|
2005-12-19 16:37:05 +00:00
|
|
|
|
|
|
|
#include "btl_udapl.h"
|
|
|
|
#include "btl_udapl_endpoint.h"
|
2007-05-15 17:47:00 +00:00
|
|
|
#include "btl_udapl_frag.h"
|
|
|
|
#include "btl_udapl_mca.h"
|
|
|
|
#include "btl_udapl_proc.h"
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "ompi/datatype/convertor.h"
|
|
|
|
#include "ompi/datatype/datatype.h"
|
|
|
|
#include "ompi/mca/mpool/base/base.h"
|
2006-12-17 12:26:41 +00:00
|
|
|
#include "ompi/mca/mpool/rdma/mpool_rdma.h"
|
2007-01-11 15:22:08 +00:00
|
|
|
#include "ompi/mca/btl/base/btl_base_error.h"
|
2006-01-12 04:05:02 +00:00
|
|
|
#include "ompi/proc/proc.h"
|
2005-12-19 16:37:05 +00:00
|
|
|
|
2006-12-17 12:26:41 +00:00
|
|
|
static int udapl_reg_mr(void *reg_data, void *base, size_t size,
|
|
|
|
mca_mpool_base_registration_t *reg);
|
|
|
|
static int udapl_dereg_mr(void *reg_data, mca_mpool_base_registration_t *reg);
|
2007-05-17 23:37:47 +00:00
|
|
|
static int mca_btl_udapl_set_peer_parameters(
|
|
|
|
struct mca_btl_udapl_module_t* udapl_btl,
|
|
|
|
size_t nprocs);
|
2006-03-21 00:12:55 +00:00
|
|
|
|
2005-12-19 16:37:05 +00:00
|
|
|
mca_btl_udapl_module_t mca_btl_udapl_module = {
|
|
|
|
{
|
|
|
|
&mca_btl_udapl_component.super,
|
|
|
|
0, /* max size of first fragment */
|
|
|
|
0, /* min send fragment size */
|
|
|
|
0, /* max send fragment size */
|
2007-06-21 07:12:40 +00:00
|
|
|
0, /* btl_rdma_pipeline_send_length */
|
2007-05-17 07:54:27 +00:00
|
|
|
0, /* btl_rdma_pipeline_frag_size */
|
|
|
|
0, /* btl_min_rdma_pipeline_size */
|
2005-12-19 16:37:05 +00:00
|
|
|
0, /* exclusivity */
|
|
|
|
0, /* latency */
|
|
|
|
0, /* bandwidth */
|
2006-01-25 02:21:34 +00:00
|
|
|
MCA_BTL_FLAGS_SEND,
|
2005-12-19 16:37:05 +00:00
|
|
|
mca_btl_udapl_add_procs,
|
|
|
|
mca_btl_udapl_del_procs,
|
|
|
|
mca_btl_udapl_register,
|
|
|
|
mca_btl_udapl_finalize,
|
|
|
|
mca_btl_udapl_alloc,
|
|
|
|
mca_btl_udapl_free,
|
|
|
|
mca_btl_udapl_prepare_src,
|
2007-01-11 15:22:08 +00:00
|
|
|
mca_btl_udapl_prepare_dst,
|
2005-12-19 16:37:05 +00:00
|
|
|
mca_btl_udapl_send,
|
2007-01-11 15:22:08 +00:00
|
|
|
mca_btl_udapl_put,
|
2006-03-17 17:39:41 +00:00
|
|
|
NULL, /* get */
|
2006-08-18 17:55:57 +00:00
|
|
|
mca_btl_base_dump,
|
2006-08-17 22:02:01 +00:00
|
|
|
NULL, /* mpool */
|
2007-03-16 23:11:45 +00:00
|
|
|
NULL, /* register error cb */
|
|
|
|
mca_btl_udapl_ft_event
|
2005-12-19 16:37:05 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2006-12-17 12:26:41 +00:00
|
|
|
static int udapl_reg_mr(void *reg_data, void *base, size_t size,
|
|
|
|
mca_mpool_base_registration_t *reg)
|
|
|
|
{
|
|
|
|
mca_btl_udapl_module_t *btl = (mca_btl_udapl_module_t*)reg_data;
|
|
|
|
mca_btl_udapl_reg_t *udapl_reg = (mca_btl_udapl_reg_t*)reg;
|
|
|
|
DAT_REGION_DESCRIPTION region;
|
|
|
|
DAT_VLEN dat_size;
|
|
|
|
DAT_VADDR dat_addr;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
region.for_va = base;
|
|
|
|
udapl_reg->lmr_triplet.virtual_address = (DAT_VADDR)base;
|
|
|
|
udapl_reg->lmr_triplet.segment_length = size;
|
|
|
|
udapl_reg->lmr = NULL;
|
|
|
|
|
|
|
|
rc = dat_lmr_create(btl->udapl_ia, DAT_MEM_TYPE_VIRTUAL, region, size,
|
|
|
|
btl->udapl_pz, DAT_MEM_PRIV_ALL_FLAG, &udapl_reg->lmr,
|
|
|
|
&udapl_reg->lmr_triplet.lmr_context, &udapl_reg->rmr_context,
|
|
|
|
&dat_size, &dat_addr);
|
|
|
|
|
|
|
|
if(rc != DAT_SUCCESS) {
|
2007-12-13 15:32:26 +00:00
|
|
|
BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP, ("help-mpi-btl-udapl.txt",
|
|
|
|
"dat_lmr_create DAT_INSUFFICIENT_RESOURCES", true));
|
2006-12-17 12:26:41 +00:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int udapl_dereg_mr(void *reg_data, mca_mpool_base_registration_t *reg)
|
|
|
|
{
|
|
|
|
mca_btl_udapl_reg_t *udapl_reg = (mca_btl_udapl_reg_t*)reg;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
if(udapl_reg->lmr != NULL) {
|
|
|
|
rc = dat_lmr_free(udapl_reg->lmr);
|
|
|
|
if(rc != DAT_SUCCESS) {
|
2007-01-11 15:22:08 +00:00
|
|
|
char* major;
|
|
|
|
char* minor;
|
|
|
|
|
|
|
|
dat_strerror(rc, (const char**)&major,
|
|
|
|
(const char**)&minor);
|
|
|
|
BTL_ERROR(("ERROR: %s %s %s\n", "dat_lmr_free",
|
|
|
|
major, minor));
|
2006-12-17 12:26:41 +00:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2006-01-12 04:05:02 +00:00
|
|
|
|
2006-01-16 21:54:50 +00:00
|
|
|
/**
|
|
|
|
* Initialize module module resources.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
2006-03-21 00:12:55 +00:00
|
|
|
mca_btl_udapl_init(DAT_NAME_PTR ia_name, mca_btl_udapl_module_t* btl)
|
2006-01-16 21:54:50 +00:00
|
|
|
{
|
2006-02-10 21:49:15 +00:00
|
|
|
mca_mpool_base_resources_t res;
|
2006-03-21 00:12:55 +00:00
|
|
|
DAT_CONN_QUAL port;
|
2006-01-16 21:54:50 +00:00
|
|
|
DAT_RETURN rc;
|
|
|
|
|
|
|
|
/* open the uDAPL interface */
|
2006-02-10 21:49:15 +00:00
|
|
|
btl->udapl_evd_async = DAT_HANDLE_NULL;
|
2007-05-15 17:47:00 +00:00
|
|
|
rc = dat_ia_open(ia_name, btl->udapl_async_evd_qlen,
|
2006-02-10 21:49:15 +00:00
|
|
|
&btl->udapl_evd_async, &btl->udapl_ia);
|
2006-01-16 21:54:50 +00:00
|
|
|
if(DAT_SUCCESS != rc) {
|
2007-01-11 15:22:08 +00:00
|
|
|
char* major;
|
|
|
|
char* minor;
|
|
|
|
|
|
|
|
dat_strerror(rc, (const char**)&major,
|
|
|
|
(const char**)&minor);
|
2007-07-11 15:20:35 +00:00
|
|
|
|
2007-12-13 15:32:26 +00:00
|
|
|
BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP, ("help-mpi-btl-udapl.txt",
|
|
|
|
"dat_ia_open fail", true, ia_name, major, minor));
|
2007-07-11 15:20:35 +00:00
|
|
|
|
2006-01-16 21:54:50 +00:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
2006-02-10 21:49:15 +00:00
|
|
|
/* create a protection zone */
|
|
|
|
rc = dat_pz_create(btl->udapl_ia, &btl->udapl_pz);
|
|
|
|
if(DAT_SUCCESS != rc) {
|
2007-01-11 15:22:08 +00:00
|
|
|
char* major;
|
|
|
|
char* minor;
|
|
|
|
|
|
|
|
dat_strerror(rc, (const char**)&major,
|
|
|
|
(const char**)&minor);
|
|
|
|
BTL_ERROR(("ERROR: %s %s %s\n", "dat_pz_create",
|
|
|
|
major, minor));
|
2006-03-21 00:12:55 +00:00
|
|
|
goto failure;
|
2006-02-10 21:49:15 +00:00
|
|
|
}
|
|
|
|
|
2006-01-25 02:21:34 +00:00
|
|
|
/* query to get address information */
|
2006-02-10 21:49:15 +00:00
|
|
|
rc = dat_ia_query(btl->udapl_ia, &btl->udapl_evd_async,
|
2007-05-15 17:47:00 +00:00
|
|
|
DAT_IA_ALL, &(btl->udapl_ia_attr), 0, NULL);
|
2006-01-25 02:21:34 +00:00
|
|
|
if(DAT_SUCCESS != rc) {
|
2007-01-11 15:22:08 +00:00
|
|
|
char* major;
|
|
|
|
char* minor;
|
|
|
|
|
|
|
|
dat_strerror(rc, (const char**)&major,
|
|
|
|
(const char**)&minor);
|
|
|
|
BTL_ERROR(("ERROR: %s %s %s\n", "dat_ia_query",
|
|
|
|
major, minor));
|
2006-03-21 00:12:55 +00:00
|
|
|
goto failure;
|
2006-01-25 02:21:34 +00:00
|
|
|
}
|
|
|
|
|
2007-05-15 17:47:00 +00:00
|
|
|
memcpy(&btl->udapl_addr.addr, (btl->udapl_ia_attr).ia_address_ptr,
|
|
|
|
sizeof(DAT_SOCK_ADDR));
|
|
|
|
|
|
|
|
/* check evd qlen against adapter max */
|
|
|
|
if (btl->udapl_dto_evd_qlen > (btl->udapl_ia_attr).max_evd_qlen) {
|
2007-12-13 15:32:26 +00:00
|
|
|
BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP, ("help-mpi-btl-udapl.txt",
|
2007-05-15 17:47:00 +00:00
|
|
|
"evd_qlen adapter max",
|
|
|
|
true,
|
|
|
|
"btl_udapl_dto_evd_qlen",
|
|
|
|
btl->udapl_dto_evd_qlen,
|
2007-12-13 15:32:26 +00:00
|
|
|
(btl->udapl_ia_attr).max_evd_qlen));
|
2007-05-15 17:47:00 +00:00
|
|
|
btl->udapl_dto_evd_qlen = btl->udapl_ia_attr.max_evd_qlen;
|
|
|
|
}
|
|
|
|
if (btl->udapl_conn_evd_qlen > (btl->udapl_ia_attr).max_evd_qlen) {
|
2007-12-13 15:32:26 +00:00
|
|
|
BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP, ("help-mpi-btl-udapl.txt",
|
2007-05-15 17:47:00 +00:00
|
|
|
"evd_qlen adapter max",
|
|
|
|
true,
|
|
|
|
"btl_udapl_conn_evd_qlen",
|
|
|
|
btl->udapl_conn_evd_qlen,
|
2007-12-13 15:32:26 +00:00
|
|
|
(btl->udapl_ia_attr).max_evd_qlen));
|
2007-05-15 17:47:00 +00:00
|
|
|
btl->udapl_conn_evd_qlen = btl->udapl_ia_attr.max_evd_qlen;
|
|
|
|
}
|
2006-01-25 02:21:34 +00:00
|
|
|
|
2006-01-16 21:54:50 +00:00
|
|
|
/* set up evd's */
|
|
|
|
rc = dat_evd_create(btl->udapl_ia,
|
2007-05-15 17:47:00 +00:00
|
|
|
btl->udapl_dto_evd_qlen, DAT_HANDLE_NULL,
|
|
|
|
DAT_EVD_DTO_FLAG | DAT_EVD_RMR_BIND_FLAG, &btl->udapl_evd_dto);
|
2006-01-16 21:54:50 +00:00
|
|
|
if(DAT_SUCCESS != rc) {
|
2007-01-11 15:22:08 +00:00
|
|
|
char* major;
|
|
|
|
char* minor;
|
|
|
|
|
|
|
|
dat_strerror(rc, (const char**)&major,
|
|
|
|
(const char**)&minor);
|
|
|
|
BTL_ERROR(("ERROR: %s %s %s\n", "dat_evd_create (dto)",
|
|
|
|
major, minor));
|
2006-03-21 00:12:55 +00:00
|
|
|
goto failure;
|
2006-01-16 21:54:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rc = dat_evd_create(btl->udapl_ia,
|
2007-05-15 17:47:00 +00:00
|
|
|
btl->udapl_conn_evd_qlen, DAT_HANDLE_NULL,
|
2006-02-10 21:49:15 +00:00
|
|
|
DAT_EVD_CR_FLAG | DAT_EVD_CONNECTION_FLAG, &btl->udapl_evd_conn);
|
2006-01-16 21:54:50 +00:00
|
|
|
if(DAT_SUCCESS != rc) {
|
2007-01-11 15:22:08 +00:00
|
|
|
char* major;
|
|
|
|
char* minor;
|
|
|
|
|
|
|
|
dat_strerror(rc, (const char**)&major,
|
|
|
|
(const char**)&minor);
|
|
|
|
BTL_ERROR(("ERROR: %s %s %s\n", "dat_evd_create (conn)",
|
|
|
|
major, minor));
|
2006-03-21 00:12:55 +00:00
|
|
|
goto failure;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create our public service point */
|
2006-07-28 13:58:21 +00:00
|
|
|
rc = dat_psp_create_any(btl->udapl_ia, &port, btl->udapl_evd_conn,
|
2007-01-11 15:22:08 +00:00
|
|
|
DAT_PSP_CONSUMER_FLAG, &btl->udapl_psp);
|
2006-07-28 13:58:21 +00:00
|
|
|
if(DAT_SUCCESS != rc) {
|
2007-01-11 15:22:08 +00:00
|
|
|
char* major;
|
|
|
|
char* minor;
|
|
|
|
|
|
|
|
dat_strerror(rc, (const char**)&major,
|
|
|
|
(const char**)&minor);
|
|
|
|
BTL_ERROR(("ERROR: %s %s %s\n", "dat_psp_create_any",
|
|
|
|
major, minor));
|
|
|
|
goto failure;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* establish endpoint parameters */
|
|
|
|
rc = mca_btl_udapl_endpoint_get_params(btl, &(btl->udapl_ep_param));
|
|
|
|
if(OMPI_SUCCESS != rc) {
|
|
|
|
/* by not erroring out here we can try to continue with
|
|
|
|
* the default endpoint parameter values
|
|
|
|
*/
|
2007-12-13 15:32:26 +00:00
|
|
|
BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP, ("help-mpi-btl-udapl.txt",
|
2007-01-11 15:22:08 +00:00
|
|
|
"use default endpoint params",
|
2007-12-13 15:32:26 +00:00
|
|
|
true));
|
2006-03-21 00:12:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Save the port with the address information */
|
2006-05-25 15:47:59 +00:00
|
|
|
/* TODO - since we're doing the hack below, do we need our own port? */
|
2006-03-21 00:12:55 +00:00
|
|
|
btl->udapl_addr.port = port;
|
|
|
|
|
2007-05-18 01:33:02 +00:00
|
|
|
/* Using dat_ep_query to obtain the remote port would be ideal but
|
|
|
|
* since the current udapl implementations don't seem to support
|
|
|
|
* this we store the port in udapl_addr and explictly exchange the
|
|
|
|
* information later.
|
2006-05-25 15:47:59 +00:00
|
|
|
*/
|
|
|
|
((struct sockaddr_in*)&btl->udapl_addr.addr)->sin_port = htons(port);
|
|
|
|
|
2006-02-10 21:49:15 +00:00
|
|
|
/* initialize the memory pool */
|
2006-12-17 12:26:41 +00:00
|
|
|
res.reg_data = btl;
|
|
|
|
res.sizeof_reg = sizeof(mca_btl_udapl_reg_t);
|
|
|
|
res.register_mem = udapl_reg_mr;
|
|
|
|
res.deregister_mem = udapl_dereg_mr;
|
2006-02-10 21:49:15 +00:00
|
|
|
btl->super.btl_mpool = mca_mpool_base_module_create(
|
|
|
|
mca_btl_udapl_component.udapl_mpool_name, &btl->super, &res);
|
2006-01-25 02:21:34 +00:00
|
|
|
|
2006-01-16 21:54:50 +00:00
|
|
|
/* initialize objects */
|
|
|
|
OBJ_CONSTRUCT(&btl->udapl_frag_eager, ompi_free_list_t);
|
|
|
|
OBJ_CONSTRUCT(&btl->udapl_frag_max, ompi_free_list_t);
|
|
|
|
OBJ_CONSTRUCT(&btl->udapl_frag_user, ompi_free_list_t);
|
2007-01-11 15:22:08 +00:00
|
|
|
OBJ_CONSTRUCT(&btl->udapl_frag_control, ompi_free_list_t);
|
2006-01-16 21:54:50 +00:00
|
|
|
OBJ_CONSTRUCT(&btl->udapl_lock, opal_mutex_t);
|
|
|
|
|
2007-05-09 19:41:25 +00:00
|
|
|
/* check buffer alignment against dat library */
|
|
|
|
if (mca_btl_udapl_component.udapl_buffer_alignment !=
|
|
|
|
DAT_OPTIMAL_ALIGNMENT) {
|
|
|
|
|
2007-12-13 15:32:26 +00:00
|
|
|
BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP, ("help-mpi-btl-udapl.txt",
|
2007-05-09 19:41:25 +00:00
|
|
|
"optimal buffer alignment mismatch",
|
|
|
|
true,
|
|
|
|
DAT_OPTIMAL_ALIGNMENT,
|
|
|
|
mca_btl_udapl_component.udapl_buffer_alignment,
|
2007-12-13 15:32:26 +00:00
|
|
|
DAT_OPTIMAL_ALIGNMENT));
|
2007-05-09 19:41:25 +00:00
|
|
|
}
|
|
|
|
|
2006-02-10 21:49:15 +00:00
|
|
|
/* initialize free lists */
|
2007-11-29 21:18:37 +00:00
|
|
|
ompi_free_list_init_ex_new(&btl->udapl_frag_eager,
|
2007-05-09 19:41:25 +00:00
|
|
|
sizeof(mca_btl_udapl_frag_eager_t) +
|
|
|
|
mca_btl_udapl_component.udapl_eager_frag_size,
|
|
|
|
mca_btl_udapl_component.udapl_buffer_alignment,
|
|
|
|
OBJ_CLASS(mca_btl_udapl_frag_eager_t),
|
2007-11-29 21:18:37 +00:00
|
|
|
mca_btl_udapl_component.udapl_eager_frag_size,
|
|
|
|
mca_btl_udapl_component.udapl_buffer_alignment,
|
2007-05-09 19:41:25 +00:00
|
|
|
mca_btl_udapl_component.udapl_free_list_num,
|
|
|
|
mca_btl_udapl_component.udapl_free_list_max,
|
|
|
|
mca_btl_udapl_component.udapl_free_list_inc,
|
This commit brings in two major things:
1. Galen's fine-grain control of queue pair resources in the openib
BTL.
1. Pasha's new implementation of asychronous HCA event handling.
Pasha's new implementation doesn't take much explanation, but the new
"multifrag" stuff does.
Note that "svn merge" was not used to bring this new code from the
/tmp/ib_multifrag branch -- something Bad happened in the periodic
trunk pulls on that branch making an actual merge back to the trunk
effectively impossible (i.e., lots and lots of arbitrary conflicts and
artifical changes). :-(
== Fine-grain control of queue pair resources ==
Galen's fine-grain control of queue pair resources to the OpenIB BTL
(thanks to Gleb for fixing broken code and providing additional
functionality, Pasha for finding broken code, and Jeff for doing all
the svn work and regression testing).
Prior to this commit, the OpenIB BTL created two queue pairs: one for
eager size fragments and one for max send size fragments. When the
use of the shared receive queue (SRQ) was specified (via "-mca
btl_openib_use_srq 1"), these QPs would use a shared receive queue for
receive buffers instead of the default per-peer (PP) receive queues
and buffers. One consequence of this design is that receive buffer
utilization (the size of the data received as a percentage of the
receive buffer used for the data) was quite poor for a number of
applications.
The new design allows multiple QPs to be specified at runtime. Each
QP can be setup to use PP or SRQ receive buffers as well as giving
fine-grained control over receive buffer size, number of receive
buffers to post, when to replenish the receive queue (low water mark)
and for SRQ QPs, the number of outstanding sends can also be
specified. The following is an example of the syntax to describe QPs
to the OpenIB BTL using the new MCA parameter btl_openib_receive_queues:
{{{
-mca btl_openib_receive_queues \
"P,128,16,4;S,1024,256,128,32;S,4096,256,128,32;S,65536,256,128,32"
}}}
Each QP description is delimited by ";" (semicolon) with individual
fields of the QP description delimited by "," (comma). The above
example therefore describes 4 QPs.
The first QP is:
P,128,16,4
Meaning: per-peer receive buffer QPs are indicated by a starting field
of "P"; the first QP (shown above) is therefore a per-peer based QP.
The second field indicates the size of the receive buffer in bytes
(128 bytes). The third field indicates the number of receive buffers
to allocate to the QP (16). The fourth field indicates the low
watermark for receive buffers at which time the BTL will repost
receive buffers to the QP (4).
The second QP is:
S,1024,256,128,32
Shared receive queue based QPs are indicated by a starting field of
"S"; the second QP (shown above) is therefore a shared receive queue
based QP. The second, third and fourth fields are the same as in the
per-peer based QP. The fifth field is the number of outstanding sends
that are allowed at a given time on the QP (32). This provides a
"good enough" mechanism of flow control for some regular communication
patterns.
QPs MUST be specified in ascending receive buffer size order. This
requirement may be removed prior to 1.3 release.
This commit was SVN r15474.
2007-07-18 01:15:59 +00:00
|
|
|
btl->super.btl_mpool,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2007-05-09 19:41:25 +00:00
|
|
|
|
2007-11-29 21:18:37 +00:00
|
|
|
ompi_free_list_init_ex_new(&btl->udapl_frag_max,
|
2007-05-09 19:41:25 +00:00
|
|
|
sizeof(mca_btl_udapl_frag_max_t) +
|
|
|
|
mca_btl_udapl_component.udapl_max_frag_size,
|
|
|
|
mca_btl_udapl_component.udapl_buffer_alignment,
|
|
|
|
OBJ_CLASS(mca_btl_udapl_frag_max_t),
|
2007-11-29 21:18:37 +00:00
|
|
|
mca_btl_udapl_component.udapl_max_frag_size,
|
|
|
|
mca_btl_udapl_component.udapl_buffer_alignment,
|
2007-05-09 19:41:25 +00:00
|
|
|
mca_btl_udapl_component.udapl_free_list_num,
|
|
|
|
mca_btl_udapl_component.udapl_free_list_max,
|
|
|
|
mca_btl_udapl_component.udapl_free_list_inc,
|
This commit brings in two major things:
1. Galen's fine-grain control of queue pair resources in the openib
BTL.
1. Pasha's new implementation of asychronous HCA event handling.
Pasha's new implementation doesn't take much explanation, but the new
"multifrag" stuff does.
Note that "svn merge" was not used to bring this new code from the
/tmp/ib_multifrag branch -- something Bad happened in the periodic
trunk pulls on that branch making an actual merge back to the trunk
effectively impossible (i.e., lots and lots of arbitrary conflicts and
artifical changes). :-(
== Fine-grain control of queue pair resources ==
Galen's fine-grain control of queue pair resources to the OpenIB BTL
(thanks to Gleb for fixing broken code and providing additional
functionality, Pasha for finding broken code, and Jeff for doing all
the svn work and regression testing).
Prior to this commit, the OpenIB BTL created two queue pairs: one for
eager size fragments and one for max send size fragments. When the
use of the shared receive queue (SRQ) was specified (via "-mca
btl_openib_use_srq 1"), these QPs would use a shared receive queue for
receive buffers instead of the default per-peer (PP) receive queues
and buffers. One consequence of this design is that receive buffer
utilization (the size of the data received as a percentage of the
receive buffer used for the data) was quite poor for a number of
applications.
The new design allows multiple QPs to be specified at runtime. Each
QP can be setup to use PP or SRQ receive buffers as well as giving
fine-grained control over receive buffer size, number of receive
buffers to post, when to replenish the receive queue (low water mark)
and for SRQ QPs, the number of outstanding sends can also be
specified. The following is an example of the syntax to describe QPs
to the OpenIB BTL using the new MCA parameter btl_openib_receive_queues:
{{{
-mca btl_openib_receive_queues \
"P,128,16,4;S,1024,256,128,32;S,4096,256,128,32;S,65536,256,128,32"
}}}
Each QP description is delimited by ";" (semicolon) with individual
fields of the QP description delimited by "," (comma). The above
example therefore describes 4 QPs.
The first QP is:
P,128,16,4
Meaning: per-peer receive buffer QPs are indicated by a starting field
of "P"; the first QP (shown above) is therefore a per-peer based QP.
The second field indicates the size of the receive buffer in bytes
(128 bytes). The third field indicates the number of receive buffers
to allocate to the QP (16). The fourth field indicates the low
watermark for receive buffers at which time the BTL will repost
receive buffers to the QP (4).
The second QP is:
S,1024,256,128,32
Shared receive queue based QPs are indicated by a starting field of
"S"; the second QP (shown above) is therefore a shared receive queue
based QP. The second, third and fourth fields are the same as in the
per-peer based QP. The fifth field is the number of outstanding sends
that are allowed at a given time on the QP (32). This provides a
"good enough" mechanism of flow control for some regular communication
patterns.
QPs MUST be specified in ascending receive buffer size order. This
requirement may be removed prior to 1.3 release.
This commit was SVN r15474.
2007-07-18 01:15:59 +00:00
|
|
|
btl->super.btl_mpool,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2007-05-09 19:41:25 +00:00
|
|
|
|
2007-11-29 21:18:37 +00:00
|
|
|
ompi_free_list_init_ex_new(&btl->udapl_frag_user,
|
2007-05-09 19:41:25 +00:00
|
|
|
sizeof(mca_btl_udapl_frag_user_t),
|
|
|
|
mca_btl_udapl_component.udapl_buffer_alignment,
|
|
|
|
OBJ_CLASS(mca_btl_udapl_frag_user_t),
|
2007-11-29 21:18:37 +00:00
|
|
|
0,0,
|
2007-05-09 19:41:25 +00:00
|
|
|
mca_btl_udapl_component.udapl_free_list_num,
|
|
|
|
mca_btl_udapl_component.udapl_free_list_max,
|
|
|
|
mca_btl_udapl_component.udapl_free_list_inc,
|
This commit brings in two major things:
1. Galen's fine-grain control of queue pair resources in the openib
BTL.
1. Pasha's new implementation of asychronous HCA event handling.
Pasha's new implementation doesn't take much explanation, but the new
"multifrag" stuff does.
Note that "svn merge" was not used to bring this new code from the
/tmp/ib_multifrag branch -- something Bad happened in the periodic
trunk pulls on that branch making an actual merge back to the trunk
effectively impossible (i.e., lots and lots of arbitrary conflicts and
artifical changes). :-(
== Fine-grain control of queue pair resources ==
Galen's fine-grain control of queue pair resources to the OpenIB BTL
(thanks to Gleb for fixing broken code and providing additional
functionality, Pasha for finding broken code, and Jeff for doing all
the svn work and regression testing).
Prior to this commit, the OpenIB BTL created two queue pairs: one for
eager size fragments and one for max send size fragments. When the
use of the shared receive queue (SRQ) was specified (via "-mca
btl_openib_use_srq 1"), these QPs would use a shared receive queue for
receive buffers instead of the default per-peer (PP) receive queues
and buffers. One consequence of this design is that receive buffer
utilization (the size of the data received as a percentage of the
receive buffer used for the data) was quite poor for a number of
applications.
The new design allows multiple QPs to be specified at runtime. Each
QP can be setup to use PP or SRQ receive buffers as well as giving
fine-grained control over receive buffer size, number of receive
buffers to post, when to replenish the receive queue (low water mark)
and for SRQ QPs, the number of outstanding sends can also be
specified. The following is an example of the syntax to describe QPs
to the OpenIB BTL using the new MCA parameter btl_openib_receive_queues:
{{{
-mca btl_openib_receive_queues \
"P,128,16,4;S,1024,256,128,32;S,4096,256,128,32;S,65536,256,128,32"
}}}
Each QP description is delimited by ";" (semicolon) with individual
fields of the QP description delimited by "," (comma). The above
example therefore describes 4 QPs.
The first QP is:
P,128,16,4
Meaning: per-peer receive buffer QPs are indicated by a starting field
of "P"; the first QP (shown above) is therefore a per-peer based QP.
The second field indicates the size of the receive buffer in bytes
(128 bytes). The third field indicates the number of receive buffers
to allocate to the QP (16). The fourth field indicates the low
watermark for receive buffers at which time the BTL will repost
receive buffers to the QP (4).
The second QP is:
S,1024,256,128,32
Shared receive queue based QPs are indicated by a starting field of
"S"; the second QP (shown above) is therefore a shared receive queue
based QP. The second, third and fourth fields are the same as in the
per-peer based QP. The fifth field is the number of outstanding sends
that are allowed at a given time on the QP (32). This provides a
"good enough" mechanism of flow control for some regular communication
patterns.
QPs MUST be specified in ascending receive buffer size order. This
requirement may be removed prior to 1.3 release.
This commit was SVN r15474.
2007-07-18 01:15:59 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2007-05-09 19:41:25 +00:00
|
|
|
|
2007-11-29 21:18:37 +00:00
|
|
|
ompi_free_list_init_ex_new(&btl->udapl_frag_control,
|
2007-05-09 19:41:25 +00:00
|
|
|
sizeof(mca_btl_udapl_frag_eager_t) +
|
|
|
|
mca_btl_udapl_component.udapl_eager_frag_size,
|
|
|
|
mca_btl_udapl_component.udapl_buffer_alignment,
|
2007-05-29 20:08:16 +00:00
|
|
|
OBJ_CLASS(mca_btl_udapl_frag_eager_t),
|
2007-11-29 21:18:37 +00:00
|
|
|
mca_btl_udapl_component.udapl_eager_frag_size,
|
|
|
|
mca_btl_udapl_component.udapl_buffer_alignment,
|
2007-05-09 19:41:25 +00:00
|
|
|
mca_btl_udapl_component.udapl_free_list_num,
|
|
|
|
-1,
|
|
|
|
mca_btl_udapl_component.udapl_free_list_inc,
|
This commit brings in two major things:
1. Galen's fine-grain control of queue pair resources in the openib
BTL.
1. Pasha's new implementation of asychronous HCA event handling.
Pasha's new implementation doesn't take much explanation, but the new
"multifrag" stuff does.
Note that "svn merge" was not used to bring this new code from the
/tmp/ib_multifrag branch -- something Bad happened in the periodic
trunk pulls on that branch making an actual merge back to the trunk
effectively impossible (i.e., lots and lots of arbitrary conflicts and
artifical changes). :-(
== Fine-grain control of queue pair resources ==
Galen's fine-grain control of queue pair resources to the OpenIB BTL
(thanks to Gleb for fixing broken code and providing additional
functionality, Pasha for finding broken code, and Jeff for doing all
the svn work and regression testing).
Prior to this commit, the OpenIB BTL created two queue pairs: one for
eager size fragments and one for max send size fragments. When the
use of the shared receive queue (SRQ) was specified (via "-mca
btl_openib_use_srq 1"), these QPs would use a shared receive queue for
receive buffers instead of the default per-peer (PP) receive queues
and buffers. One consequence of this design is that receive buffer
utilization (the size of the data received as a percentage of the
receive buffer used for the data) was quite poor for a number of
applications.
The new design allows multiple QPs to be specified at runtime. Each
QP can be setup to use PP or SRQ receive buffers as well as giving
fine-grained control over receive buffer size, number of receive
buffers to post, when to replenish the receive queue (low water mark)
and for SRQ QPs, the number of outstanding sends can also be
specified. The following is an example of the syntax to describe QPs
to the OpenIB BTL using the new MCA parameter btl_openib_receive_queues:
{{{
-mca btl_openib_receive_queues \
"P,128,16,4;S,1024,256,128,32;S,4096,256,128,32;S,65536,256,128,32"
}}}
Each QP description is delimited by ";" (semicolon) with individual
fields of the QP description delimited by "," (comma). The above
example therefore describes 4 QPs.
The first QP is:
P,128,16,4
Meaning: per-peer receive buffer QPs are indicated by a starting field
of "P"; the first QP (shown above) is therefore a per-peer based QP.
The second field indicates the size of the receive buffer in bytes
(128 bytes). The third field indicates the number of receive buffers
to allocate to the QP (16). The fourth field indicates the low
watermark for receive buffers at which time the BTL will repost
receive buffers to the QP (4).
The second QP is:
S,1024,256,128,32
Shared receive queue based QPs are indicated by a starting field of
"S"; the second QP (shown above) is therefore a shared receive queue
based QP. The second, third and fourth fields are the same as in the
per-peer based QP. The fifth field is the number of outstanding sends
that are allowed at a given time on the QP (32). This provides a
"good enough" mechanism of flow control for some regular communication
patterns.
QPs MUST be specified in ascending receive buffer size order. This
requirement may be removed prior to 1.3 release.
This commit was SVN r15474.
2007-07-18 01:15:59 +00:00
|
|
|
btl->super.btl_mpool,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2007-01-11 15:22:08 +00:00
|
|
|
|
|
|
|
/* initialize eager rdma buffer info */
|
2007-12-21 06:02:00 +00:00
|
|
|
btl->udapl_eager_rdma_endpoints = OBJ_NEW(opal_pointer_array_t);
|
|
|
|
opal_pointer_array_init(btl->udapl_eager_rdma_endpoints,
|
2007-01-11 15:22:08 +00:00
|
|
|
mca_btl_udapl_component.udapl_max_eager_rdma_peers,
|
|
|
|
mca_btl_udapl_component.udapl_max_eager_rdma_peers,
|
|
|
|
0);
|
|
|
|
btl->udapl_eager_rdma_endpoint_count = 0;
|
|
|
|
OBJ_CONSTRUCT(&btl->udapl_eager_rdma_lock, opal_mutex_t);
|
|
|
|
|
2007-04-25 17:46:25 +00:00
|
|
|
/* initialize miscellaneous variables */
|
|
|
|
btl->udapl_async_events = 0;
|
|
|
|
btl->udapl_connect_inprogress = 0;
|
2007-05-15 17:47:00 +00:00
|
|
|
btl->udapl_num_peers = 0;
|
2007-05-29 20:08:16 +00:00
|
|
|
|
2006-03-31 16:25:19 +00:00
|
|
|
/* TODO - Set up SRQ when it is supported */
|
2006-01-16 21:54:50 +00:00
|
|
|
return OMPI_SUCCESS;
|
2006-03-21 00:12:55 +00:00
|
|
|
|
|
|
|
failure:
|
|
|
|
dat_ia_close(btl->udapl_ia, DAT_CLOSE_ABRUPT_FLAG);
|
|
|
|
return OMPI_ERROR;
|
2006-01-16 21:54:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Cleanup/release module resources.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_udapl_finalize(struct mca_btl_base_module_t* base_btl)
|
|
|
|
{
|
|
|
|
mca_btl_udapl_module_t* udapl_btl = (mca_btl_udapl_module_t*) base_btl;
|
2007-01-11 22:25:13 +00:00
|
|
|
int32_t i;
|
|
|
|
|
2007-01-11 15:22:08 +00:00
|
|
|
/*
|
|
|
|
* Cleaning up the endpoints here because mca_btl_udapl_del_procs
|
|
|
|
* is never called by upper layers.
|
|
|
|
* Note: this is only looking at those endpoints which are available
|
|
|
|
* off of the btl module rdma list.
|
|
|
|
*/
|
2007-01-11 22:25:13 +00:00
|
|
|
for (i=0; i < udapl_btl->udapl_eager_rdma_endpoint_count; i++) {
|
2007-01-11 15:22:08 +00:00
|
|
|
mca_btl_udapl_endpoint_t* endpoint =
|
2007-12-21 06:02:00 +00:00
|
|
|
opal_pointer_array_get_item(udapl_btl->udapl_eager_rdma_endpoints,
|
2007-01-11 15:22:08 +00:00
|
|
|
i);
|
|
|
|
|
|
|
|
OBJ_DESTRUCT(endpoint);
|
|
|
|
}
|
|
|
|
|
2006-01-16 21:54:50 +00:00
|
|
|
/* release uDAPL resources */
|
|
|
|
dat_evd_free(udapl_btl->udapl_evd_dto);
|
|
|
|
dat_evd_free(udapl_btl->udapl_evd_conn);
|
2006-02-10 21:49:15 +00:00
|
|
|
dat_pz_free(udapl_btl->udapl_pz);
|
2006-01-16 21:54:50 +00:00
|
|
|
dat_ia_close(udapl_btl->udapl_ia, DAT_CLOSE_GRACEFUL_FLAG);
|
|
|
|
|
|
|
|
/* destroy objects */
|
|
|
|
OBJ_DESTRUCT(&udapl_btl->udapl_lock);
|
|
|
|
OBJ_DESTRUCT(&udapl_btl->udapl_frag_eager);
|
|
|
|
OBJ_DESTRUCT(&udapl_btl->udapl_frag_max);
|
|
|
|
OBJ_DESTRUCT(&udapl_btl->udapl_frag_user);
|
2007-01-11 15:22:08 +00:00
|
|
|
OBJ_DESTRUCT(&udapl_btl->udapl_frag_control);
|
|
|
|
OBJ_DESTRUCT(&udapl_btl->udapl_eager_rdma_lock);
|
|
|
|
|
2006-01-16 21:54:50 +00:00
|
|
|
free(udapl_btl);
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-15 17:47:00 +00:00
|
|
|
/*
|
|
|
|
* Adjust parameters that are dependent on the number of peers.
|
|
|
|
*
|
|
|
|
* @param udapl_btl (IN) BTL module
|
|
|
|
* @param nprocs (IN) number of processes handed into
|
|
|
|
* mca_btl_udapl_add_procs()
|
|
|
|
* @return OMPI_SUCCESS or error status on failure
|
|
|
|
*/
|
|
|
|
|
2007-05-17 23:37:47 +00:00
|
|
|
static int mca_btl_udapl_set_peer_parameters(
|
2007-05-15 17:47:00 +00:00
|
|
|
struct mca_btl_udapl_module_t* udapl_btl,
|
|
|
|
size_t nprocs)
|
|
|
|
{
|
|
|
|
int rc = OMPI_SUCCESS;
|
|
|
|
DAT_RETURN dat_rc = DAT_SUCCESS;
|
|
|
|
uint potential_udapl_timeout;
|
|
|
|
int first_time_sizing = (udapl_btl->udapl_num_peers == 0 ? 1 : 0);
|
2007-05-29 20:08:16 +00:00
|
|
|
DAT_EVD_PARAM evd_param;
|
|
|
|
|
2007-05-15 17:47:00 +00:00
|
|
|
/* nprocs includes self so subtract 1 */
|
|
|
|
udapl_btl->udapl_num_peers += nprocs - 1;
|
|
|
|
|
|
|
|
/* resize dto_evd_qlen if not already at its max */
|
|
|
|
if (udapl_btl->udapl_dto_evd_qlen !=
|
|
|
|
udapl_btl->udapl_ia_attr.max_evd_qlen) {
|
|
|
|
|
|
|
|
int potential_dto_evd_qlen;
|
|
|
|
int max_connection_dto_events;
|
|
|
|
int eager_connection_dto_events;
|
|
|
|
|
|
|
|
/* eager connection dto events already factored into
|
|
|
|
* max_recv/request_dtos but need to calculate max connection dtos;
|
|
|
|
* see mca_btl_udapl_get_params() for max_recv/request_dtos
|
|
|
|
*/
|
|
|
|
eager_connection_dto_events = udapl_btl->udapl_max_recv_dtos +
|
|
|
|
udapl_btl->udapl_max_request_dtos;
|
|
|
|
max_connection_dto_events = mca_btl_udapl_component.udapl_num_recvs +
|
|
|
|
mca_btl_udapl_component.udapl_num_sends +
|
|
|
|
(mca_btl_udapl_component.udapl_num_recvs /
|
|
|
|
mca_btl_udapl_component.udapl_sr_win) + 1;
|
|
|
|
potential_dto_evd_qlen = udapl_btl->udapl_num_peers *
|
|
|
|
(eager_connection_dto_events + max_connection_dto_events);
|
|
|
|
|
|
|
|
/* here we use what the library calculates as the
|
|
|
|
* potential_dto_evd_qlen unless the user has set
|
|
|
|
*/
|
|
|
|
if (first_time_sizing) {
|
|
|
|
if (udapl_btl->udapl_dto_evd_qlen < potential_dto_evd_qlen) {
|
|
|
|
if (MCA_BTL_UDAPL_DTO_EVD_QLEN_DEFAULT !=
|
|
|
|
udapl_btl->udapl_dto_evd_qlen) {
|
|
|
|
|
|
|
|
/* user modified so warn */
|
2007-12-13 15:32:26 +00:00
|
|
|
BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP,
|
|
|
|
("help-mpi-btl-udapl.txt",
|
2007-05-15 17:47:00 +00:00
|
|
|
"evd_qlen too low",
|
|
|
|
true,
|
|
|
|
"btl_udapl_dto_evd_qlen",
|
|
|
|
udapl_btl->udapl_dto_evd_qlen,
|
|
|
|
"btl_udapl_dto_evd_qlen",
|
2007-12-13 15:32:26 +00:00
|
|
|
potential_dto_evd_qlen));
|
2007-05-15 17:47:00 +00:00
|
|
|
} else {
|
|
|
|
udapl_btl->udapl_dto_evd_qlen = potential_dto_evd_qlen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* since this is not the first time attempting to resize the
|
|
|
|
* evd queue length just use the potential value; this may not
|
|
|
|
* be the best solution
|
|
|
|
*/
|
|
|
|
udapl_btl->udapl_dto_evd_qlen = potential_dto_evd_qlen;
|
|
|
|
}
|
|
|
|
|
|
|
|
udapl_btl->udapl_dto_evd_qlen = ((udapl_btl->udapl_dto_evd_qlen >
|
|
|
|
udapl_btl->udapl_ia_attr.max_evd_qlen) ?
|
|
|
|
udapl_btl->udapl_ia_attr.max_evd_qlen :
|
|
|
|
udapl_btl->udapl_dto_evd_qlen);
|
|
|
|
|
2007-05-29 20:08:16 +00:00
|
|
|
/* OFED stack does not return DAT_INVALID_STATE when
|
|
|
|
* the new qlen is less than current value so here we find
|
|
|
|
* current value and if greater than what we intend to set
|
|
|
|
* it to skip the resize.
|
|
|
|
*/
|
|
|
|
dat_rc = dat_evd_query(udapl_btl->udapl_evd_dto,
|
|
|
|
DAT_EVD_FIELD_EVD_QLEN, &evd_param);
|
2007-05-15 17:47:00 +00:00
|
|
|
if(DAT_SUCCESS != dat_rc) {
|
|
|
|
char* major;
|
|
|
|
char* minor;
|
|
|
|
|
|
|
|
dat_strerror(dat_rc, (const char**)&major,
|
|
|
|
(const char**)&minor);
|
2007-05-29 20:08:16 +00:00
|
|
|
BTL_ERROR(("ERROR: %s %s %s\n", "dat_evd_query",
|
|
|
|
major, minor));
|
|
|
|
}
|
2007-05-15 17:47:00 +00:00
|
|
|
|
2007-05-29 20:08:16 +00:00
|
|
|
if (udapl_btl->udapl_dto_evd_qlen > evd_param.evd_qlen) {
|
|
|
|
/* resize dto event dispatcher queue length */
|
|
|
|
dat_rc = dat_evd_resize(udapl_btl->udapl_evd_dto,
|
|
|
|
udapl_btl->udapl_dto_evd_qlen);
|
|
|
|
if(DAT_SUCCESS != dat_rc) {
|
|
|
|
char* major;
|
|
|
|
char* minor;
|
|
|
|
|
|
|
|
dat_strerror(dat_rc, (const char**)&major,
|
|
|
|
(const char**)&minor);
|
2007-05-15 17:47:00 +00:00
|
|
|
BTL_ERROR(("ERROR: %s %s %s\n", "dat_evd_resize",
|
|
|
|
major, minor));
|
|
|
|
rc = OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* resize connection evd qlen */
|
|
|
|
if (udapl_btl->udapl_conn_evd_qlen !=
|
|
|
|
udapl_btl->udapl_ia_attr.max_evd_qlen) {
|
|
|
|
|
|
|
|
int potential_conn_evd_qlen = 2 * udapl_btl->udapl_num_peers;
|
|
|
|
|
|
|
|
if (first_time_sizing) {
|
|
|
|
if (udapl_btl->udapl_conn_evd_qlen < potential_conn_evd_qlen) {
|
|
|
|
if (MCA_BTL_UDAPL_CONN_EVD_QLEN_DEFAULT !=
|
|
|
|
udapl_btl->udapl_conn_evd_qlen) {
|
|
|
|
|
|
|
|
/* user modified so warn */
|
2007-12-13 15:32:26 +00:00
|
|
|
BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP,
|
|
|
|
("help-mpi-btl-udapl.txt",
|
2007-05-15 17:47:00 +00:00
|
|
|
"evd_qlen too low",
|
|
|
|
true,
|
|
|
|
"btl_udapl_conn_evd_qlen",
|
|
|
|
udapl_btl->udapl_conn_evd_qlen,
|
|
|
|
"btl_udapl_conn_evd_qlen",
|
2007-12-13 15:32:26 +00:00
|
|
|
potential_conn_evd_qlen));
|
2007-05-15 17:47:00 +00:00
|
|
|
} else {
|
|
|
|
udapl_btl->udapl_conn_evd_qlen = potential_conn_evd_qlen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* since this is not the first time attempting to resize the
|
|
|
|
* evd queue length just use the potential value; this may not
|
|
|
|
* be the best solution
|
|
|
|
*/
|
|
|
|
udapl_btl->udapl_conn_evd_qlen = potential_conn_evd_qlen;
|
|
|
|
}
|
|
|
|
|
|
|
|
udapl_btl->udapl_conn_evd_qlen = ((udapl_btl->udapl_conn_evd_qlen >
|
|
|
|
udapl_btl->udapl_ia_attr.max_evd_qlen) ?
|
|
|
|
udapl_btl->udapl_ia_attr.max_evd_qlen :
|
|
|
|
udapl_btl->udapl_conn_evd_qlen);
|
|
|
|
|
2007-05-29 20:08:16 +00:00
|
|
|
/* OFED stack does not return DAT_INVALID_STATE when
|
|
|
|
* the new qlen is less than current value so here we find
|
|
|
|
* current value and if greater than what we intend to set
|
|
|
|
* it to skip the resize.
|
|
|
|
*/
|
|
|
|
dat_rc = dat_evd_query(udapl_btl->udapl_evd_conn,
|
|
|
|
DAT_EVD_FIELD_EVD_QLEN, &evd_param);
|
2007-05-15 17:47:00 +00:00
|
|
|
if(DAT_SUCCESS != dat_rc) {
|
|
|
|
char* major;
|
|
|
|
char* minor;
|
|
|
|
|
|
|
|
dat_strerror(dat_rc, (const char**)&major,
|
|
|
|
(const char**)&minor);
|
2007-05-29 20:08:16 +00:00
|
|
|
BTL_ERROR(("ERROR: %s %s %s\n", "dat_evd_query",
|
|
|
|
major, minor));
|
|
|
|
}
|
2007-05-15 17:47:00 +00:00
|
|
|
|
2007-05-29 20:08:16 +00:00
|
|
|
if (udapl_btl->udapl_conn_evd_qlen > evd_param.evd_qlen) {
|
|
|
|
/* resize conn evd queue length */
|
|
|
|
dat_rc = dat_evd_resize(udapl_btl->udapl_evd_conn,
|
|
|
|
udapl_btl->udapl_conn_evd_qlen);
|
|
|
|
if(DAT_SUCCESS != dat_rc) {
|
|
|
|
char* major;
|
|
|
|
char* minor;
|
|
|
|
|
|
|
|
dat_strerror(dat_rc, (const char**)&major,
|
|
|
|
(const char**)&minor);
|
2007-05-15 17:47:00 +00:00
|
|
|
BTL_ERROR(("ERROR: %s %s %s\n", "dat_evd_resize",
|
|
|
|
major, minor));
|
|
|
|
rc = OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* adjust connection timeout value, calculated in microseconds */
|
|
|
|
potential_udapl_timeout = MCA_BTL_UDAPL_CONN_TIMEOUT_INC *
|
|
|
|
udapl_btl->udapl_num_peers;
|
|
|
|
|
|
|
|
if (mca_btl_udapl_component.udapl_timeout <
|
|
|
|
potential_udapl_timeout) {
|
|
|
|
|
|
|
|
if (MCA_BTL_UDAPL_CONN_TIMEOUT_DEFAULT !=
|
|
|
|
mca_btl_udapl_component.udapl_timeout) {
|
|
|
|
|
|
|
|
/* user modified so warn */
|
2007-12-13 15:32:26 +00:00
|
|
|
BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP,
|
|
|
|
("help-mpi-btl-udapl.txt",
|
2007-05-15 17:47:00 +00:00
|
|
|
"connection timeout low",
|
|
|
|
true,
|
|
|
|
"btl_udapl_timeout",
|
|
|
|
mca_btl_udapl_component.udapl_timeout,
|
|
|
|
"btl_udapl_timeout",
|
2007-12-13 15:32:26 +00:00
|
|
|
potential_udapl_timeout));
|
2007-05-15 17:47:00 +00:00
|
|
|
} else {
|
|
|
|
mca_btl_udapl_component.udapl_timeout =
|
|
|
|
potential_udapl_timeout;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mca_btl_udapl_component.udapl_timeout =
|
|
|
|
((mca_btl_udapl_component.udapl_timeout >
|
|
|
|
MCA_BTL_UDAPL_CONN_TIMEOUT_MAX) ?
|
|
|
|
MCA_BTL_UDAPL_CONN_TIMEOUT_MAX :
|
|
|
|
mca_btl_udapl_component.udapl_timeout);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2006-03-31 16:25:19 +00:00
|
|
|
/*
|
2005-12-19 16:37:05 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_udapl_add_procs(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
size_t nprocs,
|
|
|
|
struct ompi_proc_t **ompi_procs,
|
|
|
|
struct mca_btl_base_endpoint_t** peers,
|
|
|
|
ompi_bitmap_t* reachable)
|
|
|
|
{
|
|
|
|
mca_btl_udapl_module_t* udapl_btl = (mca_btl_udapl_module_t*)btl;
|
|
|
|
int i, rc;
|
|
|
|
|
|
|
|
for(i = 0; i < (int) nprocs; i++) {
|
|
|
|
|
|
|
|
struct ompi_proc_t* ompi_proc = ompi_procs[i];
|
|
|
|
mca_btl_udapl_proc_t* udapl_proc;
|
|
|
|
mca_btl_base_endpoint_t* udapl_endpoint;
|
|
|
|
|
2006-01-12 04:05:02 +00:00
|
|
|
if(ompi_proc == ompi_proc_local())
|
|
|
|
continue;
|
|
|
|
|
2005-12-19 16:37:05 +00:00
|
|
|
if(NULL == (udapl_proc = mca_btl_udapl_proc_create(ompi_proc))) {
|
2006-01-12 04:05:02 +00:00
|
|
|
continue;
|
2005-12-19 16:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to make sure that the peer has at least as many interface
|
|
|
|
* addresses exported as we are trying to use. If not, then
|
2006-03-21 00:12:55 +00:00
|
|
|
* don't bind this BTL instance to the proc.
|
2005-12-19 16:37:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
OPAL_THREAD_LOCK(&udapl_proc->proc_lock);
|
|
|
|
|
2006-03-21 00:12:55 +00:00
|
|
|
/* The btl_proc datastructure is shared by all uDAPL BTL
|
2005-12-19 16:37:05 +00:00
|
|
|
* instances that are trying to reach this destination.
|
|
|
|
* Cache the peer instance on the btl_proc.
|
|
|
|
*/
|
|
|
|
udapl_endpoint = OBJ_NEW(mca_btl_udapl_endpoint_t);
|
|
|
|
if(NULL == udapl_endpoint) {
|
|
|
|
OPAL_THREAD_UNLOCK(&udapl_proc->proc_lock);
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
udapl_endpoint->endpoint_btl = udapl_btl;
|
|
|
|
rc = mca_btl_udapl_proc_insert(udapl_proc, udapl_endpoint);
|
|
|
|
if(rc != OMPI_SUCCESS) {
|
|
|
|
OBJ_RELEASE(udapl_endpoint);
|
|
|
|
OPAL_THREAD_UNLOCK(&udapl_proc->proc_lock);
|
|
|
|
continue;
|
|
|
|
}
|
2006-03-21 00:12:55 +00:00
|
|
|
|
2005-12-19 16:37:05 +00:00
|
|
|
ompi_bitmap_set_bit(reachable, i);
|
|
|
|
OPAL_THREAD_UNLOCK(&udapl_proc->proc_lock);
|
|
|
|
peers[i] = udapl_endpoint;
|
|
|
|
}
|
2006-03-21 00:12:55 +00:00
|
|
|
|
2007-05-15 17:47:00 +00:00
|
|
|
/* resize based on number of processes */
|
|
|
|
if (OMPI_SUCCESS !=
|
|
|
|
mca_btl_udapl_set_peer_parameters(udapl_btl, nprocs)) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
2005-12-19 16:37:05 +00:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-03-31 16:25:19 +00:00
|
|
|
|
2005-12-19 16:37:05 +00:00
|
|
|
int mca_btl_udapl_del_procs(struct mca_btl_base_module_t* btl,
|
|
|
|
size_t nprocs,
|
|
|
|
struct ompi_proc_t **procs,
|
|
|
|
struct mca_btl_base_endpoint_t ** peers)
|
|
|
|
{
|
|
|
|
/* TODO */
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register callback function to support send/recv semantics
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_udapl_register(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_tag_t tag,
|
|
|
|
mca_btl_base_module_recv_cb_fn_t cbfunc,
|
|
|
|
void* cbdata)
|
|
|
|
{
|
|
|
|
mca_btl_udapl_module_t* udapl_btl = (mca_btl_udapl_module_t*) btl;
|
|
|
|
udapl_btl->udapl_reg[tag].cbfunc = cbfunc;
|
|
|
|
udapl_btl->udapl_reg[tag].cbdata = cbdata;
|
2006-01-16 03:01:12 +00:00
|
|
|
|
2005-12-19 16:37:05 +00:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate a segment.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param size (IN) Request segment size.
|
|
|
|
*/
|
|
|
|
|
|
|
|
mca_btl_base_descriptor_t* mca_btl_udapl_alloc(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
2007-12-09 14:00:42 +00:00
|
|
|
struct mca_btl_base_endpoint_t* endpoint,
|
2007-05-24 19:51:26 +00:00
|
|
|
uint8_t order,
|
2007-12-09 14:08:01 +00:00
|
|
|
size_t size,
|
|
|
|
uint32_t flags)
|
2005-12-19 16:37:05 +00:00
|
|
|
{
|
|
|
|
mca_btl_udapl_module_t* udapl_btl = (mca_btl_udapl_module_t*) btl;
|
|
|
|
mca_btl_udapl_frag_t* frag;
|
|
|
|
int rc;
|
2007-01-11 15:22:08 +00:00
|
|
|
int pad = 0;
|
|
|
|
|
|
|
|
/* compute pad as needed */
|
|
|
|
MCA_BTL_UDAPL_FRAG_CALC_ALIGNMENT_PAD(pad,
|
|
|
|
(size + sizeof(mca_btl_udapl_footer_t)));
|
2006-01-16 03:01:12 +00:00
|
|
|
|
2007-01-11 15:22:08 +00:00
|
|
|
if((size + pad) <= btl->btl_eager_limit) {
|
2005-12-19 16:37:05 +00:00
|
|
|
MCA_BTL_UDAPL_FRAG_ALLOC_EAGER(udapl_btl, frag, rc);
|
2006-05-25 15:47:59 +00:00
|
|
|
} else if(size <= btl->btl_max_send_size) {
|
2005-12-19 16:37:05 +00:00
|
|
|
MCA_BTL_UDAPL_FRAG_ALLOC_MAX(udapl_btl, frag, rc);
|
2006-03-31 16:25:19 +00:00
|
|
|
} else {
|
|
|
|
return NULL;
|
2005-12-19 16:37:05 +00:00
|
|
|
}
|
2006-03-21 00:12:55 +00:00
|
|
|
|
2007-01-11 15:22:08 +00:00
|
|
|
frag->segment.seg_len = size;
|
|
|
|
|
|
|
|
/* Set up the LMR triplet from the frag segment.
|
|
|
|
* Note: The triplet.segment_len is set to what is required for
|
|
|
|
* actually sending the fragment, if later it is determined
|
|
|
|
* that rdma can be used to transfer the fragment the
|
|
|
|
* triplet.segment_len will have to change.
|
|
|
|
*/
|
2007-01-04 22:07:37 +00:00
|
|
|
frag->triplet.virtual_address = (DAT_VADDR)frag->segment.seg_addr.pval;
|
2006-03-31 16:25:19 +00:00
|
|
|
frag->triplet.segment_length =
|
2006-09-22 19:28:09 +00:00
|
|
|
frag->segment.seg_len + sizeof(mca_btl_udapl_footer_t);
|
2007-01-11 15:22:08 +00:00
|
|
|
assert(frag->triplet.lmr_context ==
|
|
|
|
frag->registration->lmr_triplet.lmr_context);
|
2006-03-23 16:21:08 +00:00
|
|
|
|
2006-03-21 00:12:55 +00:00
|
|
|
frag->btl = udapl_btl;
|
2006-01-12 04:05:02 +00:00
|
|
|
frag->base.des_src = &frag->segment;
|
|
|
|
frag->base.des_src_cnt = 1;
|
2006-04-19 22:20:22 +00:00
|
|
|
frag->base.des_dst = NULL;
|
|
|
|
frag->base.des_dst_cnt = 0;
|
|
|
|
frag->base.des_flags = 0;
|
2007-05-24 19:51:26 +00:00
|
|
|
frag->base.order = MCA_BTL_NO_ORDER;
|
2006-01-12 04:05:02 +00:00
|
|
|
return &frag->base;
|
2005-12-19 16:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a segment
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_udapl_free(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_descriptor_t* des)
|
|
|
|
{
|
2006-01-16 03:01:12 +00:00
|
|
|
mca_btl_udapl_frag_t* frag = (mca_btl_udapl_frag_t*)des;
|
|
|
|
|
2007-04-23 17:41:34 +00:00
|
|
|
if(0 == frag->size) {
|
|
|
|
if (NULL != frag->registration) {
|
|
|
|
btl->btl_mpool->mpool_deregister(btl->btl_mpool,
|
|
|
|
&(frag->registration->base));
|
|
|
|
frag->registration = NULL;
|
|
|
|
}
|
|
|
|
MCA_BTL_UDAPL_FRAG_RETURN_USER(btl, frag);
|
2006-01-12 04:05:02 +00:00
|
|
|
} else if(frag->size == mca_btl_udapl_component.udapl_eager_frag_size) {
|
2005-12-19 16:37:05 +00:00
|
|
|
MCA_BTL_UDAPL_FRAG_RETURN_EAGER(btl, frag);
|
2006-01-12 04:05:02 +00:00
|
|
|
} else if(frag->size == mca_btl_udapl_component.udapl_max_frag_size) {
|
|
|
|
MCA_BTL_UDAPL_FRAG_RETURN_MAX(btl, frag);
|
2007-01-11 15:22:08 +00:00
|
|
|
} else {
|
2007-12-13 15:32:26 +00:00
|
|
|
BTL_UDAPL_VERBOSE_OUTPUT(VERBOSE_DIAGNOSE,
|
|
|
|
("mca_btl_udapl_free: invalid descriptor\n"));
|
2005-12-19 16:37:05 +00:00
|
|
|
return OMPI_ERR_BAD_PARAM;
|
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pack data and return a descriptor that can be
|
|
|
|
* used for send/put.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param peer (IN) BTL peer addressing
|
|
|
|
*/
|
|
|
|
mca_btl_base_descriptor_t* mca_btl_udapl_prepare_src(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* endpoint,
|
|
|
|
struct mca_mpool_base_registration_t* registration,
|
|
|
|
struct ompi_convertor_t* convertor,
|
2007-05-24 19:51:26 +00:00
|
|
|
uint8_t order,
|
2005-12-19 16:37:05 +00:00
|
|
|
size_t reserve,
|
2007-12-09 14:08:01 +00:00
|
|
|
size_t* size,
|
|
|
|
uint32_t flags
|
2005-12-19 16:37:05 +00:00
|
|
|
)
|
|
|
|
{
|
2007-01-11 15:22:08 +00:00
|
|
|
mca_btl_udapl_frag_t* frag = NULL;
|
2005-12-19 16:37:05 +00:00
|
|
|
struct iovec iov;
|
|
|
|
uint32_t iov_count = 1;
|
|
|
|
size_t max_data = *size;
|
|
|
|
int rc;
|
2007-01-11 15:22:08 +00:00
|
|
|
int pad = 0;
|
2006-01-12 04:05:02 +00:00
|
|
|
|
2007-01-11 15:22:08 +00:00
|
|
|
/* compute pad as needed */
|
|
|
|
MCA_BTL_UDAPL_FRAG_CALC_ALIGNMENT_PAD(pad,
|
|
|
|
(max_data + reserve + sizeof(mca_btl_udapl_footer_t)));
|
2006-01-16 21:54:50 +00:00
|
|
|
|
2007-01-11 15:22:08 +00:00
|
|
|
if(ompi_convertor_need_buffers(convertor) == false && 0 == reserve) {
|
|
|
|
if(registration != NULL || max_data > btl->btl_max_send_size) {
|
2006-01-12 04:05:02 +00:00
|
|
|
|
2007-01-11 15:22:08 +00:00
|
|
|
MCA_BTL_UDAPL_FRAG_ALLOC_USER(btl, frag, rc);
|
|
|
|
if(NULL == frag){
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-04-19 22:20:22 +00:00
|
|
|
|
2007-01-11 15:22:08 +00:00
|
|
|
iov.iov_len = max_data;
|
|
|
|
iov.iov_base = NULL;
|
2006-01-12 04:05:02 +00:00
|
|
|
|
2007-01-11 15:22:08 +00:00
|
|
|
ompi_convertor_pack(convertor, &iov,
|
2006-10-26 23:11:26 +00:00
|
|
|
&iov_count, &max_data );
|
2006-01-16 21:54:50 +00:00
|
|
|
|
2007-01-11 15:22:08 +00:00
|
|
|
*size = max_data;
|
|
|
|
|
|
|
|
if(NULL == registration) {
|
|
|
|
rc = btl->btl_mpool->mpool_register(btl->btl_mpool, iov.iov_base,
|
|
|
|
max_data, 0,
|
|
|
|
®istration);
|
|
|
|
|
|
|
|
if(rc != OMPI_SUCCESS) {
|
|
|
|
MCA_BTL_UDAPL_FRAG_RETURN_USER(btl,frag);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
/* keep track of the registration we did */
|
|
|
|
frag->registration = (mca_btl_udapl_reg_t*)registration;
|
|
|
|
}
|
|
|
|
|
|
|
|
frag->segment.seg_len = max_data;
|
|
|
|
frag->segment.seg_addr.pval = iov.iov_base;
|
|
|
|
frag->triplet.segment_length = max_data;
|
|
|
|
frag->triplet.virtual_address = (DAT_VADDR)iov.iov_base;
|
|
|
|
frag->triplet.lmr_context =
|
|
|
|
((mca_btl_udapl_reg_t*)registration)->lmr_triplet.lmr_context;
|
|
|
|
|
|
|
|
/* initialize base descriptor */
|
|
|
|
frag->base.des_src = &frag->segment;
|
|
|
|
frag->base.des_src_cnt = 1;
|
|
|
|
frag->base.des_dst = NULL;
|
|
|
|
frag->base.des_dst_cnt = 0;
|
|
|
|
frag->base.des_flags = 0;
|
2007-05-24 19:51:26 +00:00
|
|
|
frag->base.order = MCA_BTL_NO_ORDER;
|
2007-01-11 15:22:08 +00:00
|
|
|
return &frag->base;
|
2006-01-12 04:05:02 +00:00
|
|
|
}
|
2007-01-11 15:22:08 +00:00
|
|
|
}
|
2006-01-12 04:05:02 +00:00
|
|
|
|
2007-01-11 15:22:08 +00:00
|
|
|
if(max_data + pad + reserve <= btl->btl_eager_limit) {
|
|
|
|
/* the data is small enough to fit in the eager frag and
|
|
|
|
* memory is not prepinned */
|
2005-12-19 16:37:05 +00:00
|
|
|
MCA_BTL_UDAPL_FRAG_ALLOC_EAGER(btl, frag, rc);
|
|
|
|
}
|
|
|
|
|
2007-01-11 15:22:08 +00:00
|
|
|
if(NULL == frag) {
|
|
|
|
/* the data doesn't fit into eager frag or eager frag is
|
|
|
|
* not available */
|
2005-12-19 16:37:05 +00:00
|
|
|
MCA_BTL_UDAPL_FRAG_ALLOC_MAX(btl, frag, rc);
|
|
|
|
if(NULL == frag) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2007-01-11 15:22:08 +00:00
|
|
|
if(max_data + reserve > btl->btl_max_send_size) {
|
2006-01-12 04:05:02 +00:00
|
|
|
max_data = btl->btl_max_send_size - reserve;
|
2005-12-19 16:37:05 +00:00
|
|
|
}
|
2007-01-11 15:22:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
iov.iov_len = max_data;
|
|
|
|
iov.iov_base = (char *) frag->segment.seg_addr.pval + reserve;
|
|
|
|
|
|
|
|
rc = ompi_convertor_pack(convertor,
|
|
|
|
&iov, &iov_count, &max_data );
|
|
|
|
if(rc < 0) {
|
|
|
|
MCA_BTL_UDAPL_FRAG_RETURN_MAX(btl, frag);
|
|
|
|
return NULL;
|
2005-12-19 16:37:05 +00:00
|
|
|
}
|
|
|
|
|
2007-01-11 15:22:08 +00:00
|
|
|
*size = max_data;
|
|
|
|
|
2006-09-22 19:28:09 +00:00
|
|
|
/* setup lengths and addresses to send out data */
|
|
|
|
frag->segment.seg_len = max_data + reserve;
|
|
|
|
frag->triplet.segment_length =
|
2007-01-11 15:22:08 +00:00
|
|
|
max_data + reserve + sizeof(mca_btl_udapl_footer_t);
|
2007-01-04 22:07:37 +00:00
|
|
|
frag->triplet.virtual_address = (DAT_VADDR)frag->segment.seg_addr.pval;
|
2006-09-22 19:28:09 +00:00
|
|
|
|
|
|
|
/* initialize base descriptor */
|
2005-12-19 16:37:05 +00:00
|
|
|
frag->base.des_src = &frag->segment;
|
|
|
|
frag->base.des_src_cnt = 1;
|
|
|
|
frag->base.des_dst = NULL;
|
|
|
|
frag->base.des_dst_cnt = 0;
|
|
|
|
frag->base.des_flags = 0;
|
2007-05-24 19:51:26 +00:00
|
|
|
frag->base.order = MCA_BTL_NO_ORDER;
|
2005-12-19 16:37:05 +00:00
|
|
|
return &frag->base;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare a descriptor for send/rdma using the supplied
|
2007-01-11 15:22:08 +00:00
|
|
|
* convertor. If the convertor references data that is contiguous,
|
2005-12-19 16:37:05 +00:00
|
|
|
* the descriptor may simply point to the user buffer. Otherwise,
|
|
|
|
* this routine is responsible for allocating buffer space and
|
|
|
|
* packing if required.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param endpoint (IN) BTL peer addressing
|
|
|
|
* @param convertor (IN) Data type convertor
|
|
|
|
* @param reserve (IN) Additional bytes requested by upper layer to precede user data
|
|
|
|
* @param size (IN/OUT) Number of bytes to prepare (IN), number of bytes actually prepared (OUT)
|
|
|
|
*/
|
|
|
|
mca_btl_base_descriptor_t* mca_btl_udapl_prepare_dst(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* endpoint,
|
|
|
|
struct mca_mpool_base_registration_t* registration,
|
|
|
|
struct ompi_convertor_t* convertor,
|
2007-05-24 19:51:26 +00:00
|
|
|
uint8_t order,
|
2005-12-19 16:37:05 +00:00
|
|
|
size_t reserve,
|
2007-12-09 14:08:01 +00:00
|
|
|
size_t* size,
|
|
|
|
uint32_t flags)
|
2005-12-19 16:37:05 +00:00
|
|
|
{
|
|
|
|
mca_btl_udapl_frag_t* frag;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
MCA_BTL_UDAPL_FRAG_ALLOC_USER(btl, frag, rc);
|
|
|
|
if(NULL == frag) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
frag->segment.seg_len = *size;
|
2007-03-30 22:02:45 +00:00
|
|
|
ompi_convertor_get_current_pointer( convertor, (void**)&(frag->segment.seg_addr.pval) );
|
2005-12-19 16:37:05 +00:00
|
|
|
|
2007-01-11 15:22:08 +00:00
|
|
|
if(NULL == registration) {
|
|
|
|
/* didn't get a memory registration passed in, so must
|
|
|
|
* register the region now
|
|
|
|
*/
|
|
|
|
rc = btl->btl_mpool->mpool_register(btl->btl_mpool,
|
2007-01-04 22:07:37 +00:00
|
|
|
frag->segment.seg_addr.pval,
|
2006-01-12 04:05:02 +00:00
|
|
|
frag->segment.seg_len,
|
|
|
|
0,
|
|
|
|
®istration);
|
2007-01-11 15:22:08 +00:00
|
|
|
if(OMPI_SUCCESS != rc || NULL == registration) {
|
2006-01-12 04:05:02 +00:00
|
|
|
MCA_BTL_UDAPL_FRAG_RETURN_USER(btl,frag);
|
|
|
|
return NULL;
|
|
|
|
}
|
2007-01-11 15:22:08 +00:00
|
|
|
frag->registration = (mca_btl_udapl_reg_t*)registration;
|
2006-01-12 04:05:02 +00:00
|
|
|
}
|
2007-01-11 15:22:08 +00:00
|
|
|
|
|
|
|
frag->base.des_src = NULL;
|
|
|
|
frag->base.des_src_cnt = 0;
|
|
|
|
frag->base.des_dst = &frag->segment;
|
|
|
|
frag->base.des_dst_cnt = 1;
|
|
|
|
frag->base.des_flags = 0;
|
|
|
|
|
|
|
|
frag->segment.seg_key.key32[0] =
|
|
|
|
((mca_btl_udapl_reg_t*)registration)->rmr_context;
|
|
|
|
|
2007-05-24 19:51:26 +00:00
|
|
|
frag->base.order = MCA_BTL_NO_ORDER;
|
|
|
|
|
2005-12-19 16:37:05 +00:00
|
|
|
return &frag->base;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initiate an asynchronous send.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param endpoint (IN) BTL addressing information
|
2007-01-11 15:22:08 +00:00
|
|
|
* @param descriptor (IN) Description of the data to be transferred
|
2005-12-19 16:37:05 +00:00
|
|
|
* @param tag (IN) The tag value used to notify the peer.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_udapl_send(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* endpoint,
|
2006-01-12 04:05:02 +00:00
|
|
|
struct mca_btl_base_descriptor_t* des,
|
2005-12-19 16:37:05 +00:00
|
|
|
mca_btl_base_tag_t tag)
|
|
|
|
|
|
|
|
{
|
2006-02-10 21:49:15 +00:00
|
|
|
mca_btl_udapl_frag_t* frag = (mca_btl_udapl_frag_t*)des;
|
|
|
|
|
|
|
|
frag->endpoint = endpoint;
|
2006-09-22 19:28:09 +00:00
|
|
|
frag->ftr = (mca_btl_udapl_footer_t *)
|
2007-01-11 15:22:08 +00:00
|
|
|
((char *)frag->segment.seg_addr.pval + frag->segment.seg_len);
|
2006-09-22 19:28:09 +00:00
|
|
|
frag->ftr->tag = tag;
|
2006-02-10 21:49:15 +00:00
|
|
|
frag->type = MCA_BTL_UDAPL_SEND;
|
|
|
|
|
2006-03-31 16:25:19 +00:00
|
|
|
/* TODO - will inlining this give worthwhile performance? */
|
2006-03-21 00:12:55 +00:00
|
|
|
return mca_btl_udapl_endpoint_send(endpoint, frag);
|
2005-12-19 16:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-12 04:05:02 +00:00
|
|
|
|
2005-12-19 16:37:05 +00:00
|
|
|
/**
|
|
|
|
* Initiate an asynchronous put.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param endpoint (IN) BTL addressing information
|
|
|
|
* @param descriptor (IN) Description of the data to be transferred
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_udapl_put(
|
|
|
|
mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_endpoint_t* endpoint,
|
2006-01-12 04:05:02 +00:00
|
|
|
mca_btl_base_descriptor_t* des)
|
2005-12-19 16:37:05 +00:00
|
|
|
{
|
2007-01-11 15:22:08 +00:00
|
|
|
DAT_RMR_TRIPLET remote_buffer;
|
|
|
|
DAT_DTO_COOKIE cookie;
|
|
|
|
int rc = OMPI_SUCCESS;
|
|
|
|
|
|
|
|
mca_btl_udapl_frag_t* frag = (mca_btl_udapl_frag_t*)des;
|
|
|
|
mca_btl_base_segment_t *dst_segment = des->des_dst;
|
|
|
|
|
|
|
|
frag->btl = (mca_btl_udapl_module_t *)btl;
|
|
|
|
frag->endpoint = endpoint;
|
|
|
|
frag->type = MCA_BTL_UDAPL_PUT;
|
|
|
|
|
|
|
|
if(OPAL_THREAD_ADD32(&endpoint->endpoint_sr_tokens[BTL_UDAPL_MAX_CONNECTION], -1) < 0) {
|
|
|
|
OPAL_THREAD_ADD32(&endpoint->endpoint_sr_tokens[BTL_UDAPL_MAX_CONNECTION], 1);
|
|
|
|
OPAL_THREAD_LOCK(&endpoint->endpoint_lock);
|
|
|
|
opal_list_append(&endpoint->endpoint_max_frags,
|
|
|
|
(opal_list_item_t*)frag);
|
|
|
|
OPAL_THREAD_UNLOCK(&endpoint->endpoint_lock);
|
|
|
|
opal_progress();
|
|
|
|
} else {
|
|
|
|
frag->triplet.segment_length = frag->segment.seg_len;
|
|
|
|
|
|
|
|
remote_buffer.rmr_context =
|
|
|
|
(DAT_RMR_CONTEXT)dst_segment->seg_key.key32[0];
|
|
|
|
remote_buffer.target_address =
|
2007-04-23 17:41:34 +00:00
|
|
|
(DAT_VADDR)dst_segment->seg_addr.lval;
|
2007-01-11 15:22:08 +00:00
|
|
|
remote_buffer.segment_length = dst_segment->seg_len;
|
|
|
|
|
|
|
|
cookie.as_ptr = frag;
|
|
|
|
|
|
|
|
OPAL_THREAD_LOCK(&endpoint->endpoint_lock);
|
|
|
|
rc = dat_ep_post_rdma_write(endpoint->endpoint_max,
|
|
|
|
1,
|
|
|
|
&frag->triplet,
|
|
|
|
cookie,
|
|
|
|
&remote_buffer,
|
|
|
|
DAT_COMPLETION_DEFAULT_FLAG);
|
|
|
|
OPAL_THREAD_UNLOCK(&endpoint->endpoint_lock);
|
|
|
|
if(DAT_SUCCESS != rc) {
|
|
|
|
char* major;
|
|
|
|
char* minor;
|
|
|
|
|
|
|
|
dat_strerror(rc, (const char**)&major,
|
|
|
|
(const char**)&minor);
|
|
|
|
BTL_ERROR(("ERROR: %s %s %s\n", "dat_ep_post_rdma_write",
|
|
|
|
major, minor));
|
|
|
|
rc = OMPI_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
2005-12-19 16:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-12 04:05:02 +00:00
|
|
|
|
2005-12-19 16:37:05 +00:00
|
|
|
/**
|
|
|
|
* Initiate an asynchronous get.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param endpoint (IN) BTL addressing information
|
|
|
|
* @param descriptor (IN) Description of the data to be transferred
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_udapl_get(
|
|
|
|
mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_endpoint_t* endpoint,
|
2006-01-12 04:05:02 +00:00
|
|
|
mca_btl_base_descriptor_t* des)
|
2005-12-19 16:37:05 +00:00
|
|
|
{
|
2007-12-13 15:32:26 +00:00
|
|
|
BTL_UDAPL_VERBOSE_OUTPUT(VERBOSE_DEVELOPER, ("udapl_get\n"));
|
2006-01-12 04:05:02 +00:00
|
|
|
return OMPI_ERR_NOT_IMPLEMENTED;
|
2005-12-19 16:37:05 +00:00
|
|
|
}
|
|
|
|
|
2007-03-16 23:11:45 +00:00
|
|
|
int mca_btl_udapl_ft_event(int state) {
|
|
|
|
if(OPAL_CRS_CHECKPOINT == state) {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
else if(OPAL_CRS_CONTINUE == state) {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
else if(OPAL_CRS_RESTART == state) {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
else if(OPAL_CRS_TERM == state ) {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|