2005-07-01 01:28:35 +04:00
|
|
|
/*
|
2007-03-17 02:11:45 +03:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +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.
|
2005-07-01 01:28:35 +04:00
|
|
|
* 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.
|
2007-01-25 01:25:40 +03:00
|
|
|
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
2007-02-15 21:03:20 +03:00
|
|
|
* Copyright (c) 2006-2007 Mellanox Technologies. All rights reserved.
|
2005-07-01 01:28:35 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
#include <string.h>
|
2005-07-13 04:17:08 +04:00
|
|
|
#include <inttypes.h>
|
2005-07-04 03:31:27 +04:00
|
|
|
#include "opal/util/output.h"
|
2005-07-04 05:36:20 +04:00
|
|
|
#include "opal/util/if.h"
|
2007-01-25 01:25:40 +03:00
|
|
|
#include "opal/util/show_help.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/pml/pml.h"
|
|
|
|
#include "ompi/mca/btl/btl.h"
|
|
|
|
#include "ompi/mca/btl/base/btl_base_error.h"
|
2005-07-01 01:28:35 +04:00
|
|
|
#include "btl_openib.h"
|
|
|
|
#include "btl_openib_frag.h"
|
|
|
|
#include "btl_openib_proc.h"
|
|
|
|
#include "btl_openib_endpoint.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/datatype/convertor.h"
|
|
|
|
#include "ompi/datatype/datatype.h"
|
|
|
|
#include "ompi/mca/mpool/base/base.h"
|
|
|
|
#include "ompi/mca/mpool/mpool.h"
|
2006-12-17 15:26:41 +03:00
|
|
|
#include "ompi/mca/mpool/rdma/mpool_rdma.h"
|
2007-05-09 01:47:21 +04:00
|
|
|
#include "ompi/runtime/params.h"
|
2007-01-25 01:25:40 +03:00
|
|
|
#include "orte/util/sys_info.h"
|
2005-07-15 19:13:19 +04:00
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
2005-10-02 22:58:57 +04:00
|
|
|
#include <math.h>
|
2007-01-04 01:35:41 +03:00
|
|
|
#include <inttypes.h>
|
2007-01-31 00:22:56 +03:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_RESOURCE_H
|
|
|
|
#include <sys/resource.h>
|
|
|
|
#endif
|
|
|
|
|
2007-01-04 01:35:41 +03:00
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
mca_btl_openib_module_t mca_btl_openib_module = {
|
|
|
|
{
|
|
|
|
&mca_btl_openib_component.super,
|
|
|
|
0, /* max size of first fragment */
|
|
|
|
0, /* min send fragment size */
|
|
|
|
0, /* max send fragment size */
|
|
|
|
0, /* min rdma fragment size */
|
|
|
|
0, /* max rdma fragment size */
|
|
|
|
0, /* exclusivity */
|
|
|
|
0, /* latency */
|
|
|
|
0, /* bandwidth */
|
2007-04-27 01:03:38 +04:00
|
|
|
0, /* TODO this should be PUT btl flags */
|
2005-07-01 01:28:35 +04:00
|
|
|
mca_btl_openib_add_procs,
|
|
|
|
mca_btl_openib_del_procs,
|
|
|
|
mca_btl_openib_register,
|
|
|
|
mca_btl_openib_finalize,
|
|
|
|
/* we need alloc free, pack */
|
|
|
|
mca_btl_openib_alloc,
|
|
|
|
mca_btl_openib_free,
|
|
|
|
mca_btl_openib_prepare_src,
|
|
|
|
mca_btl_openib_prepare_dst,
|
|
|
|
mca_btl_openib_send,
|
|
|
|
mca_btl_openib_put,
|
2006-03-17 20:39:41 +03:00
|
|
|
mca_btl_openib_get,
|
2006-08-18 02:02:01 +04:00
|
|
|
mca_btl_base_dump,
|
|
|
|
NULL, /* mpool */
|
2007-03-17 02:11:45 +03:00
|
|
|
mca_btl_openib_register_error_cb, /* error call back registration */
|
|
|
|
mca_btl_openib_ft_event
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2007-04-27 01:03:38 +04:00
|
|
|
/*
|
|
|
|
* Local functions
|
|
|
|
*/
|
|
|
|
static int mca_btl_openib_size_queues( struct mca_btl_openib_module_t* openib_btl, size_t nprocs);
|
|
|
|
static int mca_btl_openib_create_cq_srq(mca_btl_openib_module_t* openib_btl);
|
2007-05-09 01:47:21 +04:00
|
|
|
static int mca_btl_finalize_hca(struct mca_btl_openib_hca_t *hca);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
|
2007-01-25 01:25:40 +03:00
|
|
|
static void show_init_error(const char *file, int line,
|
|
|
|
const char *func, const char *dev)
|
|
|
|
{
|
|
|
|
if (ENOMEM == errno) {
|
2007-01-31 00:22:56 +03:00
|
|
|
int ret;
|
|
|
|
struct rlimit limit;
|
|
|
|
char *str_limit = NULL;
|
|
|
|
|
|
|
|
ret = getrlimit(RLIMIT_MEMLOCK, &limit);
|
|
|
|
if (0 != ret) {
|
|
|
|
asprintf(&str_limit, "Unknown");
|
|
|
|
} else if (limit.rlim_cur == RLIM_INFINITY) {
|
|
|
|
asprintf(&str_limit, "unlimited");
|
|
|
|
} else {
|
2007-02-01 22:07:04 +03:00
|
|
|
asprintf(&str_limit, "%ld", (long)limit.rlim_cur);
|
2007-01-31 00:22:56 +03:00
|
|
|
}
|
|
|
|
|
2007-01-25 01:25:40 +03:00
|
|
|
opal_show_help("help-mpi-btl-openib.txt", "init-fail-no-mem",
|
|
|
|
true, orte_system_info.nodename,
|
2007-01-31 00:22:56 +03:00
|
|
|
file, line, func, dev, str_limit);
|
|
|
|
|
|
|
|
if (NULL != str_limit) free(str_limit);
|
2007-01-25 01:25:40 +03:00
|
|
|
} else {
|
|
|
|
opal_show_help("help-mpi-btl-openib.txt", "init-fail-create-q",
|
|
|
|
true, orte_system_info.nodename,
|
|
|
|
file, line, func, strerror(errno), errno, dev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
/*
|
|
|
|
* add a proc to this btl module
|
|
|
|
* creates an endpoint that is setup on the
|
|
|
|
* first send to the endpoint
|
|
|
|
*/
|
2005-07-01 01:28:35 +04:00
|
|
|
int mca_btl_openib_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)
|
|
|
|
{
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_module_t* openib_btl = (mca_btl_openib_module_t*)btl;
|
2007-01-04 01:35:41 +03:00
|
|
|
int i,j, rc;
|
2007-01-13 01:42:20 +03:00
|
|
|
int rem_subnet_id_port_cnt;
|
|
|
|
int lcl_subnet_id_port_cnt = 0;
|
2007-01-08 20:20:09 +03:00
|
|
|
int btl_rank = 0;
|
2007-01-13 01:42:20 +03:00
|
|
|
|
|
|
|
for(j=0; j < mca_btl_openib_component.ib_num_btls; j++){
|
2007-05-09 01:47:21 +04:00
|
|
|
if(mca_btl_openib_component.openib_btls[j]->port_info.subnet_id
|
2007-01-13 01:42:20 +03:00
|
|
|
== openib_btl->port_info.subnet_id) {
|
|
|
|
lcl_subnet_id_port_cnt++;
|
|
|
|
}
|
2007-05-09 01:47:21 +04:00
|
|
|
if(openib_btl == mca_btl_openib_component.openib_btls[j]) {
|
2007-01-13 01:42:20 +03:00
|
|
|
btl_rank = j;
|
|
|
|
}
|
|
|
|
}
|
2005-07-01 01:28:35 +04:00
|
|
|
for(i = 0; i < (int) nprocs; i++) {
|
|
|
|
|
|
|
|
struct ompi_proc_t* ompi_proc = ompi_procs[i];
|
|
|
|
mca_btl_openib_proc_t* ib_proc;
|
2007-01-04 01:35:41 +03:00
|
|
|
mca_btl_base_endpoint_t* endpoint;
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
if(NULL == (ib_proc = mca_btl_openib_proc_create(ompi_proc))) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
2007-01-13 01:42:20 +03:00
|
|
|
rem_subnet_id_port_cnt = 0;
|
2007-01-04 01:35:41 +03:00
|
|
|
/* check if the remote proc has a reachable subnet first */
|
|
|
|
BTL_VERBOSE(("got %d port_infos \n", ib_proc->proc_port_count));
|
|
|
|
for(j = 0; j < (int) ib_proc->proc_port_count; j++){
|
|
|
|
BTL_VERBOSE(("got a subnet %016x\n",
|
2007-01-13 01:42:20 +03:00
|
|
|
ib_proc->proc_ports[j].subnet_id));
|
|
|
|
if(ib_proc->proc_ports[j].subnet_id ==
|
|
|
|
openib_btl->port_info.subnet_id) {
|
2007-01-04 01:35:41 +03:00
|
|
|
BTL_VERBOSE(("Got a matching subnet!\n"));
|
2007-01-13 01:42:20 +03:00
|
|
|
rem_subnet_id_port_cnt ++;
|
2007-01-04 01:35:41 +03:00
|
|
|
}
|
|
|
|
}
|
2007-04-27 01:03:38 +04:00
|
|
|
|
2007-01-13 01:42:20 +03:00
|
|
|
if(!rem_subnet_id_port_cnt ) {
|
2007-01-04 01:35:41 +03:00
|
|
|
/* no use trying to communicate with this endpointlater */
|
2007-01-13 01:42:20 +03:00
|
|
|
BTL_VERBOSE(("No matching subnet id was found, moving on.. \n"));
|
2007-01-04 01:35:41 +03:00
|
|
|
continue;
|
|
|
|
}
|
2007-04-27 01:03:38 +04:00
|
|
|
|
2007-01-04 01:35:41 +03:00
|
|
|
#if 0
|
2007-01-13 01:42:20 +03:00
|
|
|
num_endpoints = rem_subnet_id_port_cnt / lcl_subnet_id_port_cnt +
|
|
|
|
(btl_rank < (rem_subnet_id_port_cnt / lcl_subnet_id_port_cnt)) ? 1:0;
|
2007-01-04 01:35:41 +03:00
|
|
|
#endif
|
2007-04-27 01:03:38 +04:00
|
|
|
|
2007-01-13 01:42:20 +03:00
|
|
|
if(rem_subnet_id_port_cnt < lcl_subnet_id_port_cnt &&
|
|
|
|
btl_rank >= rem_subnet_id_port_cnt ) {
|
|
|
|
BTL_VERBOSE(("Not enough remote ports on this subnet id, moving on.. \n"));
|
2007-01-04 01:35:41 +03:00
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&ib_proc->proc_lock);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2007-04-27 01:03:38 +04:00
|
|
|
/* The btl_proc datastructure is shared by all IB BTL
|
2005-07-01 01:28:35 +04:00
|
|
|
* instances that are trying to reach this destination.
|
|
|
|
* Cache the peer instance on the btl_proc.
|
|
|
|
*/
|
2007-01-04 01:35:41 +03:00
|
|
|
endpoint = OBJ_NEW(mca_btl_openib_endpoint_t);
|
|
|
|
if(NULL == endpoint) {
|
2005-08-16 17:22:08 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&ib_proc->proc_lock);
|
2005-07-01 01:28:35 +04:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
2007-01-04 01:35:41 +03:00
|
|
|
|
|
|
|
endpoint->endpoint_btl = openib_btl;
|
2007-01-24 01:40:59 +03:00
|
|
|
endpoint->use_eager_rdma = openib_btl->hca->use_eager_rdma &
|
|
|
|
mca_btl_openib_component.use_eager_rdma;
|
2007-01-13 01:42:20 +03:00
|
|
|
endpoint->subnet_id = openib_btl->port_info.subnet_id;
|
2007-01-04 01:35:41 +03:00
|
|
|
rc = mca_btl_openib_proc_insert(ib_proc, endpoint);
|
2005-07-01 01:28:35 +04:00
|
|
|
if(rc != OMPI_SUCCESS) {
|
2007-01-04 01:35:41 +03:00
|
|
|
OBJ_RELEASE(endpoint);
|
2005-08-14 23:03:09 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&ib_proc->proc_lock);
|
2005-07-01 01:28:35 +04:00
|
|
|
continue;
|
|
|
|
}
|
2007-01-04 01:35:41 +03:00
|
|
|
|
|
|
|
orte_pointer_array_add((orte_std_cntr_t*)&endpoint->index,
|
|
|
|
openib_btl->endpoints, (void*)endpoint);
|
2005-07-01 01:28:35 +04:00
|
|
|
ompi_bitmap_set_bit(reachable, i);
|
2005-08-14 23:03:09 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&ib_proc->proc_lock);
|
2007-01-04 01:35:41 +03:00
|
|
|
|
|
|
|
peers[i] = endpoint;
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
2006-07-31 21:24:39 +04:00
|
|
|
|
|
|
|
return mca_btl_openib_size_queues(openib_btl, nprocs);
|
2007-01-04 01:35:41 +03:00
|
|
|
|
2006-07-31 21:24:39 +04:00
|
|
|
}
|
2006-07-30 04:58:40 +04:00
|
|
|
|
2007-04-27 01:03:38 +04:00
|
|
|
static int mca_btl_openib_size_queues( struct mca_btl_openib_module_t* openib_btl, size_t nprocs)
|
2006-07-31 21:24:39 +04:00
|
|
|
{
|
|
|
|
int min_cq_size;
|
2006-08-01 00:54:54 +04:00
|
|
|
int first_time = (0 == openib_btl->num_peers);
|
2006-07-31 21:24:39 +04:00
|
|
|
int rc;
|
|
|
|
openib_btl->num_peers += nprocs;
|
|
|
|
if(mca_btl_openib_component.use_srq) {
|
|
|
|
openib_btl->rd_num = mca_btl_openib_component.rd_num + log2(nprocs) * mca_btl_openib_component.srq_rd_per_peer;
|
|
|
|
if(openib_btl->rd_num > mca_btl_openib_component.srq_rd_max)
|
|
|
|
openib_btl->rd_num = mca_btl_openib_component.srq_rd_max;
|
|
|
|
openib_btl->rd_low = openib_btl->rd_num - 1;
|
|
|
|
min_cq_size = openib_btl->rd_num * 2 * openib_btl->num_peers;
|
|
|
|
if(!first_time) {
|
|
|
|
struct ibv_srq_attr srq_attr;
|
|
|
|
srq_attr.max_wr = openib_btl->rd_num;
|
2006-09-07 17:05:41 +04:00
|
|
|
rc = ibv_modify_srq(openib_btl->srq[BTL_OPENIB_HP_QP],
|
|
|
|
&srq_attr, IBV_SRQ_MAX_WR);
|
2006-07-31 21:24:39 +04:00
|
|
|
if(rc) {
|
|
|
|
BTL_ERROR(("cannot resize high priority shared receive queue, error: %d", rc));
|
|
|
|
return OMPI_ERROR;
|
2006-07-30 04:58:40 +04:00
|
|
|
}
|
2006-09-07 17:05:41 +04:00
|
|
|
rc = ibv_modify_srq(openib_btl->srq[BTL_OPENIB_LP_QP],
|
|
|
|
&srq_attr, IBV_SRQ_MAX_WR);
|
2006-07-31 21:24:39 +04:00
|
|
|
if(rc) {
|
|
|
|
BTL_ERROR(("cannot resize low priority shared receive queue, error: %d", rc));
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
2005-10-02 22:58:57 +04:00
|
|
|
}
|
2006-07-31 21:24:39 +04:00
|
|
|
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
min_cq_size = ( mca_btl_openib_component.rd_num > (int32_t) mca_btl_openib_component.eager_rdma_num ?
|
|
|
|
mca_btl_openib_component.rd_num : (int32_t) mca_btl_openib_component.eager_rdma_num ) *
|
|
|
|
2 * openib_btl->num_peers;
|
|
|
|
|
|
|
|
}
|
2006-07-30 04:58:40 +04:00
|
|
|
|
|
|
|
|
2006-07-31 21:24:39 +04:00
|
|
|
if(min_cq_size > (int32_t) mca_btl_openib_component.ib_cq_size) {
|
|
|
|
mca_btl_openib_component.ib_cq_size = min_cq_size > openib_btl->hca->ib_dev_attr.max_cq ?
|
|
|
|
openib_btl->hca->ib_dev_attr.max_cq : min_cq_size;
|
2006-08-02 22:37:41 +04:00
|
|
|
#if OMPI_MCA_BTL_OPENIB_HAVE_RESIZE_CQ
|
2006-07-31 21:24:39 +04:00
|
|
|
if(!first_time) {
|
2006-09-12 13:17:59 +04:00
|
|
|
rc = ibv_resize_cq(openib_btl->ib_cq[BTL_OPENIB_LP_QP], mca_btl_openib_component.ib_cq_size);
|
2006-07-31 21:24:39 +04:00
|
|
|
if(rc) {
|
|
|
|
BTL_ERROR(("cannot resize low priority completion queue, error: %d", rc));
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
2006-09-12 13:17:59 +04:00
|
|
|
rc = ibv_resize_cq(openib_btl->ib_cq[BTL_OPENIB_HP_QP],
|
|
|
|
mca_btl_openib_component.ib_cq_size);
|
2006-07-31 21:24:39 +04:00
|
|
|
if(rc) {
|
|
|
|
BTL_ERROR(("cannot resize high priority completion queue, error: %d", rc));
|
|
|
|
return OMPI_ERROR;
|
2006-07-30 04:58:40 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2006-07-31 21:24:39 +04:00
|
|
|
}
|
|
|
|
if(first_time) {
|
|
|
|
/* never been here before, setup cq and srq */
|
|
|
|
mca_btl_openib_component.ib_cq_size = (int) mca_btl_openib_component.ib_cq_size >
|
|
|
|
openib_btl->hca->ib_dev_attr.max_cq ?
|
|
|
|
openib_btl->hca->ib_dev_attr.max_cq :
|
|
|
|
(int) mca_btl_openib_component.ib_cq_size;
|
|
|
|
return mca_btl_openib_create_cq_srq(openib_btl);
|
|
|
|
}
|
2005-07-01 01:28:35 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2005-07-20 19:17:18 +04:00
|
|
|
/*
|
|
|
|
* delete the proc as reachable from this btl module
|
|
|
|
*/
|
2005-07-01 01:28:35 +04:00
|
|
|
int mca_btl_openib_del_procs(struct mca_btl_base_module_t* btl,
|
|
|
|
size_t nprocs,
|
|
|
|
struct ompi_proc_t **procs,
|
|
|
|
struct mca_btl_base_endpoint_t ** peers)
|
|
|
|
{
|
2007-05-09 01:47:21 +04:00
|
|
|
int i,ep_index;
|
|
|
|
mca_btl_openib_module_t* openib_btl = (mca_btl_openib_module_t*) btl;
|
|
|
|
for (i=0 ; i < (int) nprocs ; i++) {
|
|
|
|
mca_btl_base_endpoint_t* del_endpoint = peers[i];
|
|
|
|
for(ep_index=0;
|
|
|
|
ep_index < orte_pointer_array_get_size(openib_btl->endpoints);
|
|
|
|
ep_index++) {
|
|
|
|
mca_btl_openib_endpoint_t* endpoint =
|
|
|
|
orte_pointer_array_get_item(openib_btl->endpoints,ep_index);
|
|
|
|
if(!endpoint) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (endpoint == del_endpoint) {
|
|
|
|
orte_pointer_array_set_item(openib_btl->endpoints,ep_index,NULL);
|
|
|
|
OBJ_RELEASE(endpoint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-07-01 01:28:35 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2005-07-20 01:04:22 +04:00
|
|
|
/*
|
|
|
|
*Register callback function to support send/recv semantics
|
|
|
|
*/
|
2005-07-01 01:28:35 +04:00
|
|
|
int mca_btl_openib_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)
|
|
|
|
{
|
2005-07-20 21:43:31 +04:00
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_module_t* openib_btl = (mca_btl_openib_module_t*) btl;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
|
2005-10-03 20:35:12 +04:00
|
|
|
OPAL_THREAD_LOCK(&openib_btl->ib_lock);
|
2005-07-12 17:38:54 +04:00
|
|
|
openib_btl->ib_reg[tag].cbfunc = cbfunc;
|
|
|
|
openib_btl->ib_reg[tag].cbdata = cbdata;
|
2005-10-03 20:35:12 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&openib_btl->ib_lock);
|
2005-07-01 01:28:35 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-08-17 00:21:38 +04:00
|
|
|
/*
|
|
|
|
*Register callback function for error handling..
|
|
|
|
*/
|
|
|
|
int mca_btl_openib_register_error_cb(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_module_error_cb_fn_t cbfunc)
|
|
|
|
{
|
|
|
|
|
|
|
|
mca_btl_openib_module_t* openib_btl = (mca_btl_openib_module_t*) btl;
|
|
|
|
openib_btl->error_cb = cbfunc; /* stash for later */
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
/**
|
|
|
|
* Allocate a segment.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param size (IN) Request segment size.
|
2005-07-20 19:17:18 +04:00
|
|
|
*
|
|
|
|
* When allocating a segment we pull a pre-alllocated segment
|
|
|
|
* from one of two free lists, an eager list and a max list
|
2005-07-01 01:28:35 +04:00
|
|
|
*/
|
|
|
|
mca_btl_base_descriptor_t* mca_btl_openib_alloc(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
size_t size)
|
|
|
|
{
|
2006-07-20 18:44:35 +04:00
|
|
|
mca_btl_openib_frag_t* frag = NULL;
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_module_t* openib_btl;
|
2005-07-01 01:28:35 +04:00
|
|
|
int rc;
|
2005-07-12 17:38:54 +04:00
|
|
|
openib_btl = (mca_btl_openib_module_t*) btl;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
if(size <= mca_btl_openib_component.eager_limit){
|
2006-07-20 18:44:35 +04:00
|
|
|
MCA_BTL_IB_FRAG_ALLOC_EAGER(btl, frag, rc);
|
2006-02-22 20:37:59 +03:00
|
|
|
} else if(size <= mca_btl_openib_component.max_send_size) {
|
2005-07-01 01:28:35 +04:00
|
|
|
MCA_BTL_IB_FRAG_ALLOC_MAX(btl, frag, rc);
|
|
|
|
}
|
|
|
|
|
2006-07-20 18:44:35 +04:00
|
|
|
if(NULL == frag)
|
|
|
|
return NULL;
|
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
frag->segment.seg_len = size <= openib_btl->super.btl_eager_limit ? size : openib_btl->super.btl_eager_limit;
|
2005-07-01 01:28:35 +04:00
|
|
|
frag->base.des_flags = 0;
|
|
|
|
|
|
|
|
return (mca_btl_base_descriptor_t*)frag;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-07-20 01:04:22 +04:00
|
|
|
* Return a segment
|
2005-07-01 01:28:35 +04:00
|
|
|
*
|
2005-07-20 19:17:18 +04:00
|
|
|
* Return the segment to the appropriate
|
|
|
|
* preallocated segment list
|
2005-07-01 01:28:35 +04:00
|
|
|
*/
|
|
|
|
int mca_btl_openib_free(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_descriptor_t* des)
|
|
|
|
{
|
|
|
|
mca_btl_openib_frag_t* frag = (mca_btl_openib_frag_t*)des;
|
|
|
|
|
2007-02-28 16:43:38 +03:00
|
|
|
if(((MCA_BTL_OPENIB_SEND_FRAG_FRAG == frag->type) ||
|
|
|
|
(MCA_BTL_OPENIB_RECV_FRAG_FRAG == frag->type))
|
|
|
|
&& frag->registration != NULL) {
|
2006-12-17 15:26:41 +03:00
|
|
|
btl->btl_mpool->mpool_deregister(btl->btl_mpool,
|
|
|
|
(mca_mpool_base_registration_t*)
|
|
|
|
frag->registration);
|
|
|
|
frag->registration = NULL;
|
2006-06-01 06:32:18 +04:00
|
|
|
}
|
|
|
|
MCA_BTL_IB_FRAG_RETURN(((mca_btl_openib_module_t*) btl), frag);
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2005-07-20 19:17:18 +04:00
|
|
|
* register user buffer or pack
|
|
|
|
* data into pre-registered buffer and return a
|
|
|
|
* descriptor that can be
|
2005-07-01 01:28:35 +04:00
|
|
|
* used for send/put.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param peer (IN) BTL peer addressing
|
2005-07-20 19:17:18 +04:00
|
|
|
*
|
|
|
|
* prepare source's behavior depends on the following:
|
|
|
|
* Has a valid memory registration been passed to prepare_src?
|
2007-04-27 01:03:38 +04:00
|
|
|
* if so we attempt to use the pre-registered user-buffer, if the memory registration
|
|
|
|
* is too small (only a portion of the user buffer) then we must reregister the user buffer
|
2005-07-20 19:17:18 +04:00
|
|
|
* Has the user requested the memory to be left pinned?
|
|
|
|
* if so we insert the memory registration into a memory tree for later lookup, we
|
|
|
|
* may also remove a previous registration if a MRU (most recently used) list of
|
2007-04-27 01:03:38 +04:00
|
|
|
* registrations is full, this prevents resources from being exhausted.
|
2005-07-20 19:17:18 +04:00
|
|
|
* Is the requested size larger than the btl's max send size?
|
2007-04-27 01:03:38 +04:00
|
|
|
* if so and we aren't asked to leave the registration pinned, then we register the memory if
|
2005-07-20 19:17:18 +04:00
|
|
|
* the users buffer is contiguous
|
|
|
|
* Otherwise we choose from two free lists of pre-registered memory in which to pack the data into.
|
|
|
|
*
|
2005-07-01 01:28:35 +04:00
|
|
|
*/
|
|
|
|
mca_btl_base_descriptor_t* mca_btl_openib_prepare_src(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* endpoint,
|
|
|
|
mca_mpool_base_registration_t* registration,
|
|
|
|
struct ompi_convertor_t* convertor,
|
|
|
|
size_t reserve,
|
|
|
|
size_t* size
|
|
|
|
)
|
|
|
|
{
|
2006-12-17 15:26:41 +03:00
|
|
|
mca_btl_openib_module_t *openib_btl;
|
|
|
|
mca_btl_openib_frag_t *frag = NULL;
|
|
|
|
mca_btl_openib_reg_t *openib_reg;
|
|
|
|
struct iovec iov;
|
|
|
|
uint32_t iov_count = 1;
|
|
|
|
size_t max_data = *size;
|
|
|
|
int rc;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2006-12-17 15:26:41 +03:00
|
|
|
openib_btl = (mca_btl_openib_module_t*)btl;
|
2005-07-20 19:17:18 +04:00
|
|
|
|
2006-12-17 15:26:41 +03:00
|
|
|
if(ompi_convertor_need_buffers(convertor) == false && 0 == reserve) {
|
|
|
|
if(registration != NULL || max_data > btl->btl_max_send_size) {
|
2007-02-28 16:43:38 +03:00
|
|
|
MCA_BTL_IB_FRAG_ALLOC_SEND_FRAG(btl, frag, rc);
|
2006-12-17 15:26:41 +03:00
|
|
|
if(NULL == frag) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-07-20 19:17:18 +04:00
|
|
|
|
2006-12-17 15:26:41 +03:00
|
|
|
iov.iov_len = max_data;
|
|
|
|
iov.iov_base = NULL;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2006-12-17 15:26:41 +03:00
|
|
|
ompi_convertor_pack(convertor, &iov, &iov_count, &max_data);
|
2005-07-20 19:17:18 +04:00
|
|
|
|
2006-12-17 15:26:41 +03:00
|
|
|
*size = max_data;
|
|
|
|
|
|
|
|
if(NULL == registration) {
|
|
|
|
rc = btl->btl_mpool->mpool_register(btl->btl_mpool,
|
|
|
|
iov.iov_base, max_data, 0, ®istration);
|
|
|
|
if(OMPI_SUCCESS != rc || NULL == registration) {
|
|
|
|
MCA_BTL_IB_FRAG_RETURN(openib_btl, frag);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
/* keep track of the registration we did */
|
|
|
|
frag->registration = (mca_btl_openib_reg_t*)registration;
|
|
|
|
}
|
|
|
|
openib_reg = (mca_btl_openib_reg_t*)registration;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2006-12-17 15:26:41 +03:00
|
|
|
frag->base.des_flags = 0;
|
|
|
|
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;
|
|
|
|
|
|
|
|
frag->sg_entry.length = max_data;
|
|
|
|
frag->sg_entry.lkey = openib_reg->mr->lkey;
|
|
|
|
frag->sg_entry.addr = (unsigned long)iov.iov_base;
|
|
|
|
|
|
|
|
frag->segment.seg_len = max_data;
|
2007-01-05 01:07:37 +03:00
|
|
|
frag->segment.seg_addr.pval = iov.iov_base;
|
2006-12-17 15:26:41 +03:00
|
|
|
frag->segment.seg_key.key32[0] = (uint32_t)frag->sg_entry.lkey;
|
|
|
|
|
|
|
|
BTL_VERBOSE(("frag->sg_entry.lkey = %lu .addr = %llu "
|
|
|
|
"frag->segment.seg_key.key32[0] = %lu",
|
|
|
|
frag->sg_entry.lkey, frag->sg_entry.addr,
|
|
|
|
frag->segment.seg_key.key32[0]));
|
|
|
|
|
|
|
|
return &frag->base;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(max_data + reserve <= btl->btl_eager_limit) {
|
|
|
|
/* the data is small enough to fit in the eager frag and
|
|
|
|
* memory is not prepinned */
|
|
|
|
MCA_BTL_IB_FRAG_ALLOC_EAGER(btl, frag, rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(NULL == frag) {
|
2007-04-27 01:03:38 +04:00
|
|
|
/* the data doesn't fit into eager frag or eager frag is
|
2006-12-17 15:26:41 +03:00
|
|
|
* not available */
|
|
|
|
MCA_BTL_IB_FRAG_ALLOC_MAX(btl, frag, rc);
|
|
|
|
if(NULL == frag) {
|
2005-12-22 19:05:28 +03:00
|
|
|
return NULL;
|
|
|
|
}
|
2006-12-17 15:26:41 +03:00
|
|
|
if(max_data + reserve > btl->btl_max_send_size) {
|
|
|
|
max_data = btl->btl_max_send_size - reserve;
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
2006-12-17 15:26:41 +03:00
|
|
|
}
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2006-12-17 15:26:41 +03:00
|
|
|
iov.iov_len = max_data;
|
2007-01-05 01:07:37 +03:00
|
|
|
iov.iov_base = (unsigned char*)frag->segment.seg_addr.pval + reserve;
|
2006-12-17 15:26:41 +03:00
|
|
|
rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data);
|
|
|
|
if(rc < 0) {
|
|
|
|
MCA_BTL_IB_FRAG_RETURN(openib_btl, frag);
|
|
|
|
return NULL;
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
2006-12-17 15:26:41 +03:00
|
|
|
*size = max_data;
|
|
|
|
frag->segment.seg_len = max_data + reserve;
|
|
|
|
frag->segment.seg_key.key32[0] = (uint32_t)frag->sg_entry.lkey;
|
|
|
|
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;
|
|
|
|
|
|
|
|
return &frag->base;
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-07-20 21:43:31 +04:00
|
|
|
* Prepare the dst buffer
|
2005-07-01 01:28:35 +04:00
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param peer (IN) BTL peer addressing
|
2005-07-20 19:17:18 +04:00
|
|
|
* prepare dest's behavior depends on the following:
|
|
|
|
* Has a valid memory registration been passed to prepare_src?
|
2007-04-27 01:03:38 +04:00
|
|
|
* if so we attempt to use the pre-registered user-buffer, if the memory registration
|
2005-07-20 19:17:18 +04:00
|
|
|
* is to small (only a portion of the user buffer) then we must reregister the user buffer
|
|
|
|
* Has the user requested the memory to be left pinned?
|
|
|
|
* if so we insert the memory registration into a memory tree for later lookup, we
|
|
|
|
* may also remove a previous registration if a MRU (most recently used) list of
|
2007-04-27 01:03:38 +04:00
|
|
|
* registrations is full, this prevents resources from being exhausted.
|
2005-07-01 01:28:35 +04:00
|
|
|
*/
|
|
|
|
mca_btl_base_descriptor_t* mca_btl_openib_prepare_dst(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* endpoint,
|
2006-12-17 15:26:41 +03:00
|
|
|
mca_mpool_base_registration_t* registration,
|
2005-07-01 01:28:35 +04:00
|
|
|
struct ompi_convertor_t* convertor,
|
|
|
|
size_t reserve,
|
|
|
|
size_t* size)
|
|
|
|
{
|
2006-12-17 15:26:41 +03:00
|
|
|
mca_btl_openib_module_t *openib_btl;
|
|
|
|
mca_btl_openib_frag_t *frag;
|
|
|
|
mca_btl_openib_reg_t *openib_reg;
|
|
|
|
int rc;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2006-12-17 15:26:41 +03:00
|
|
|
openib_btl = (mca_btl_openib_module_t*)btl;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2007-02-28 16:43:38 +03:00
|
|
|
MCA_BTL_IB_FRAG_ALLOC_RECV_FRAG(btl, frag, rc);
|
2006-12-17 15:26:41 +03:00
|
|
|
if(NULL == frag) {
|
|
|
|
return NULL;
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
|
|
|
|
2007-03-31 02:02:45 +04:00
|
|
|
ompi_convertor_get_current_pointer( convertor, (void**)&(frag->segment.seg_addr.pval) );
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2006-12-17 15:26:41 +03:00
|
|
|
if(NULL == registration){
|
|
|
|
/* we didn't get a memory registration passed in, so we have to
|
|
|
|
* register the region ourselves
|
2005-07-20 21:43:31 +04:00
|
|
|
*/
|
2005-12-22 19:05:28 +03:00
|
|
|
rc = btl->btl_mpool->mpool_register(btl->btl_mpool,
|
2007-01-05 01:07:37 +03:00
|
|
|
frag->segment.seg_addr.pval, *size, 0, ®istration);
|
2006-12-17 15:26:41 +03:00
|
|
|
if(OMPI_SUCCESS != rc || NULL == registration) {
|
2006-06-01 06:32:18 +04:00
|
|
|
MCA_BTL_IB_FRAG_RETURN(openib_btl, frag);
|
2005-12-22 19:05:28 +03:00
|
|
|
return NULL;
|
|
|
|
}
|
2006-12-17 15:26:41 +03:00
|
|
|
/* keep track of the registration we did */
|
|
|
|
frag->registration = (mca_btl_openib_reg_t*)registration;
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
2006-12-17 15:26:41 +03:00
|
|
|
openib_reg = (mca_btl_openib_reg_t*)registration;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2006-12-17 15:26:41 +03:00
|
|
|
frag->sg_entry.length = *size;
|
|
|
|
frag->sg_entry.lkey = openib_reg->mr->lkey;
|
2007-01-05 01:07:37 +03:00
|
|
|
frag->sg_entry.addr = (unsigned long) frag->segment.seg_addr.pval;
|
2006-12-17 15:26:41 +03:00
|
|
|
|
|
|
|
frag->segment.seg_len = *size;
|
|
|
|
frag->segment.seg_key.key32[0] = openib_reg->mr->rkey;
|
|
|
|
|
|
|
|
frag->base.des_dst = &frag->segment;
|
|
|
|
frag->base.des_dst_cnt = 1;
|
|
|
|
frag->base.des_src = NULL;
|
|
|
|
frag->base.des_src_cnt = 0;
|
|
|
|
frag->base.des_flags = 0;
|
|
|
|
|
|
|
|
BTL_VERBOSE(("frag->sg_entry.lkey = %lu .addr = %llu "
|
|
|
|
"frag->segment.seg_key.key32[0] = %lu",
|
|
|
|
frag->sg_entry.lkey, frag->sg_entry.addr,
|
|
|
|
frag->segment.seg_key.key32[0]));
|
|
|
|
|
|
|
|
return &frag->base;
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
|
|
|
|
2007-05-09 01:47:21 +04:00
|
|
|
static int mca_btl_finalize_hca(struct mca_btl_openib_hca_t *hca)
|
|
|
|
{
|
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS == 1
|
|
|
|
if(hca->progress) {
|
|
|
|
hca->progress = false;
|
|
|
|
if (pthread_cancel(hca->thread.t_handle)) {
|
|
|
|
BTL_ERROR(("Failed to cancel OpenIB progress thread"));
|
|
|
|
}
|
|
|
|
opal_thread_join(&hca->thread, NULL);
|
|
|
|
}
|
|
|
|
if (ibv_destroy_comp_channel(hca->ib_channel)) {
|
|
|
|
BTL_VERBOSE(("Failed to close comp_channel"));
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_POSIX_THREADS
|
|
|
|
if (pthread_cancel(hca->async_thread)) {
|
|
|
|
BTL_ERROR(("Failed to cancel OpenIB async thread"));
|
|
|
|
}
|
|
|
|
pthread_join(hca->async_thread, NULL);
|
|
|
|
#endif
|
|
|
|
if (OMPI_SUCCESS != mca_mpool_base_module_destroy(hca->mpool)) {
|
|
|
|
BTL_VERBOSE(("Failed to release mpool"));
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
if (ibv_dealloc_pd(hca->ib_pd)) {
|
|
|
|
BTL_VERBOSE(("Failed to release PD"));
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
if (ibv_close_device(hca->ib_dev_context)) {
|
|
|
|
if (ompi_mpi_leave_pinned || ompi_mpi_leave_pinned_pipeline) {
|
|
|
|
BTL_VERBOSE(("Warrning! Failed to close HCA"));
|
|
|
|
} else {
|
|
|
|
BTL_ERROR(("Error! Failed to close HCA"));
|
|
|
|
}
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
OBJ_DESTRUCT(&hca->hca_lock);
|
|
|
|
free(hca);
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
int mca_btl_openib_finalize(struct mca_btl_base_module_t* btl)
|
|
|
|
{
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_module_t* openib_btl;
|
2007-05-09 01:47:21 +04:00
|
|
|
mca_btl_openib_endpoint_t* endpoint;
|
|
|
|
int ep_index, rdma_index, i;
|
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
openib_btl = (mca_btl_openib_module_t*) btl;
|
2005-07-20 19:17:18 +04:00
|
|
|
|
2007-05-09 01:47:21 +04:00
|
|
|
/* Remove the btl from component list */
|
|
|
|
if ( mca_btl_openib_component.ib_num_btls > 1 ) {
|
|
|
|
for(i = 0; i < mca_btl_openib_component.ib_num_btls; i++){
|
|
|
|
if (mca_btl_openib_component.openib_btls[i] == openib_btl){
|
|
|
|
mca_btl_openib_component.openib_btls[i] =
|
|
|
|
mca_btl_openib_component.openib_btls[mca_btl_openib_component.ib_num_btls-1];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mca_btl_openib_component.ib_num_btls--;
|
|
|
|
|
|
|
|
/* Release eager RDMAs */
|
|
|
|
for(rdma_index=0;
|
|
|
|
rdma_index < orte_pointer_array_get_size(openib_btl->eager_rdma_buffers);
|
|
|
|
rdma_index++) {
|
|
|
|
endpoint=orte_pointer_array_get_item(openib_btl->eager_rdma_buffers,rdma_index);
|
|
|
|
if(!endpoint) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
OBJ_RELEASE(endpoint);
|
|
|
|
}
|
|
|
|
/* Release all QPs */
|
|
|
|
for(ep_index=0;
|
|
|
|
ep_index < orte_pointer_array_get_size(openib_btl->endpoints);
|
|
|
|
ep_index++) {
|
|
|
|
endpoint=orte_pointer_array_get_item(openib_btl->endpoints,ep_index);
|
|
|
|
if(!endpoint) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
OBJ_RELEASE(endpoint);
|
|
|
|
}
|
|
|
|
/* Release SRQ */
|
|
|
|
if(mca_btl_openib_component.use_srq) {
|
|
|
|
if (ibv_destroy_srq(openib_btl->srq[BTL_OPENIB_HP_QP])) {
|
|
|
|
BTL_VERBOSE(("Failed to close HP SRQ"));
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
if (ibv_destroy_srq(openib_btl->srq[BTL_OPENIB_LP_QP])) {
|
|
|
|
BTL_VERBOSE(("Failed to close LP SRQ"));
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Release CQs */
|
|
|
|
if (ibv_destroy_cq(openib_btl->ib_cq[BTL_OPENIB_HP_QP])) {
|
|
|
|
BTL_VERBOSE(("Failed to close HP CQ %p",openib_btl->ib_cq[BTL_OPENIB_HP_QP]));
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
if (ibv_destroy_cq(openib_btl->ib_cq[BTL_OPENIB_LP_QP])) {
|
|
|
|
BTL_VERBOSE(("Failed to close LP CQ"));
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
/* Release pending lists */
|
|
|
|
MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS(openib_btl,
|
|
|
|
&openib_btl->pending_frags[BTL_OPENIB_HP_QP]);
|
|
|
|
OBJ_DESTRUCT(&openib_btl->pending_frags[BTL_OPENIB_HP_QP]);
|
|
|
|
MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS(openib_btl,
|
|
|
|
&openib_btl->pending_frags[BTL_OPENIB_LP_QP]);
|
|
|
|
OBJ_DESTRUCT(&openib_btl->pending_frags[BTL_OPENIB_LP_QP]);
|
|
|
|
/* Destroy free lists */
|
|
|
|
OBJ_DESTRUCT(&openib_btl->send_free[BTL_OPENIB_HP_QP]);
|
|
|
|
OBJ_DESTRUCT(&openib_btl->send_free[BTL_OPENIB_LP_QP]);
|
|
|
|
OBJ_DESTRUCT(&openib_btl->send_free_frag);
|
|
|
|
OBJ_DESTRUCT(&openib_btl->send_free_control);
|
|
|
|
OBJ_DESTRUCT(&openib_btl->recv_free[BTL_OPENIB_HP_QP]);
|
|
|
|
OBJ_DESTRUCT(&openib_btl->recv_free[BTL_OPENIB_LP_QP]);
|
|
|
|
if (!(--openib_btl->hca->btls)) {
|
|
|
|
/* All btls for the HCA were closed
|
|
|
|
* Now we can close the HCA
|
|
|
|
*/
|
|
|
|
if (OMPI_SUCCESS != mca_btl_finalize_hca(openib_btl->hca)) {
|
|
|
|
BTL_VERBOSE(("Failed to close HCA"));
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OBJ_DESTRUCT(&openib_btl->ib_lock);
|
|
|
|
free(openib_btl);
|
|
|
|
|
|
|
|
BTL_VERBOSE(("Success to close BTL resources"));
|
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
#if 0
|
2005-07-12 17:38:54 +04:00
|
|
|
if(openib_btl->send_free_eager.fl_num_allocated !=
|
|
|
|
openib_btl->send_free_eager.super.opal_list_length){
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output(0, "btl ib send_free_eager frags: %d allocated %d returned \n",
|
2005-07-12 17:38:54 +04:00
|
|
|
openib_btl->send_free_eager.fl_num_allocated,
|
|
|
|
openib_btl->send_free_eager.super.opal_list_length);
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
2005-07-12 17:38:54 +04:00
|
|
|
if(openib_btl->send_free_max.fl_num_allocated !=
|
|
|
|
openib_btl->send_free_max.super.opal_list_length){
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output(0, "btl ib send_free_max frags: %d allocated %d returned \n",
|
2005-07-12 17:38:54 +04:00
|
|
|
openib_btl->send_free_max.fl_num_allocated,
|
|
|
|
openib_btl->send_free_max.super.opal_list_length);
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
2005-07-12 17:38:54 +04:00
|
|
|
if(openib_btl->send_free_frag.fl_num_allocated !=
|
|
|
|
openib_btl->send_free_frag.super.opal_list_length){
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output(0, "btl ib send_free_frag frags: %d allocated %d returned \n",
|
2005-07-12 17:38:54 +04:00
|
|
|
openib_btl->send_free_frag.fl_num_allocated,
|
|
|
|
openib_btl->send_free_frag.super.opal_list_length);
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
if(openib_btl->recv_free_eager.fl_num_allocated !=
|
|
|
|
openib_btl->recv_free_eager.super.opal_list_length){
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output(0, "btl ib recv_free_eager frags: %d allocated %d returned \n",
|
2005-07-12 17:38:54 +04:00
|
|
|
openib_btl->recv_free_eager.fl_num_allocated,
|
|
|
|
openib_btl->recv_free_eager.super.opal_list_length);
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
if(openib_btl->recv_free_max.fl_num_allocated !=
|
|
|
|
openib_btl->recv_free_max.super.opal_list_length){
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output(0, "btl ib recv_free_max frags: %d allocated %d returned \n",
|
2005-07-12 17:38:54 +04:00
|
|
|
openib_btl->recv_free_max.fl_num_allocated,
|
|
|
|
openib_btl->recv_free_max.super.opal_list_length);
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
2005-07-20 19:17:18 +04:00
|
|
|
#endif
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2005-07-20 19:17:18 +04:00
|
|
|
* Initiate a send.
|
2005-07-01 01:28:35 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_openib_send(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* endpoint,
|
|
|
|
struct mca_btl_base_descriptor_t* descriptor,
|
|
|
|
mca_btl_base_tag_t tag)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mca_btl_openib_frag_t* frag = (mca_btl_openib_frag_t*)descriptor;
|
|
|
|
frag->endpoint = endpoint;
|
2005-11-17 08:45:33 +03:00
|
|
|
frag->hdr->tag = tag;
|
2006-01-13 02:42:44 +03:00
|
|
|
frag->wr_desc.sr_desc.opcode = IBV_WR_SEND;
|
2005-11-10 23:15:02 +03:00
|
|
|
return mca_btl_openib_endpoint_send(endpoint, frag);
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2005-08-18 21:08:27 +04:00
|
|
|
* RDMA WRITE local buffer to remote buffer address.
|
2005-07-01 01:28:35 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_openib_put( mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_endpoint_t* endpoint,
|
|
|
|
mca_btl_base_descriptor_t* descriptor)
|
|
|
|
{
|
2007-04-27 01:03:38 +04:00
|
|
|
int rc = OMPI_SUCCESS;
|
2005-07-12 17:38:54 +04:00
|
|
|
struct ibv_send_wr* bad_wr;
|
2005-07-01 01:28:35 +04:00
|
|
|
mca_btl_openib_frag_t* frag = (mca_btl_openib_frag_t*) descriptor;
|
2005-10-02 22:58:57 +04:00
|
|
|
mca_btl_openib_module_t* openib_btl = (mca_btl_openib_module_t*) btl;
|
2006-01-13 02:42:44 +03:00
|
|
|
|
|
|
|
/* setup for queued requests */
|
2005-07-01 01:28:35 +04:00
|
|
|
frag->endpoint = endpoint;
|
2005-07-20 19:17:18 +04:00
|
|
|
frag->wr_desc.sr_desc.opcode = IBV_WR_RDMA_WRITE;
|
2005-11-10 23:15:02 +03:00
|
|
|
|
2006-01-13 02:42:44 +03:00
|
|
|
/* check for a send wqe */
|
2006-09-05 20:00:18 +04:00
|
|
|
if (OPAL_THREAD_ADD32(&endpoint->sd_wqe[BTL_OPENIB_LP_QP],-1) < 0) {
|
2005-11-10 23:15:02 +03:00
|
|
|
|
2006-09-05 20:00:18 +04:00
|
|
|
OPAL_THREAD_ADD32(&endpoint->sd_wqe[BTL_OPENIB_LP_QP],1);
|
2006-03-26 17:24:10 +04:00
|
|
|
OPAL_THREAD_LOCK(&endpoint->endpoint_lock);
|
2006-09-28 15:41:45 +04:00
|
|
|
opal_list_append(&endpoint->pending_put_frags, (opal_list_item_t *)frag);
|
2006-03-26 17:24:10 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&endpoint->endpoint_lock);
|
2007-04-27 01:03:38 +04:00
|
|
|
return rc;
|
2005-11-10 23:15:02 +03:00
|
|
|
|
2006-01-13 02:42:44 +03:00
|
|
|
/* post descriptor */
|
|
|
|
} else {
|
2005-10-21 06:21:45 +04:00
|
|
|
|
|
|
|
frag->wr_desc.sr_desc.send_flags = IBV_SEND_SIGNALED;
|
2007-01-07 04:48:57 +03:00
|
|
|
frag->wr_desc.sr_desc.wr.rdma.remote_addr = frag->base.des_dst->seg_addr.lval;
|
2005-10-21 06:21:45 +04:00
|
|
|
frag->wr_desc.sr_desc.wr.rdma.rkey = frag->base.des_dst->seg_key.key32[0];
|
2007-01-05 01:07:37 +03:00
|
|
|
frag->sg_entry.addr = (unsigned long) frag->base.des_src->seg_addr.pval;
|
2005-10-21 06:21:45 +04:00
|
|
|
frag->sg_entry.length = frag->base.des_src->seg_len;
|
|
|
|
|
2006-09-07 17:05:41 +04:00
|
|
|
if(ibv_post_send(endpoint->lcl_qp[BTL_OPENIB_LP_QP],
|
2005-10-21 06:21:45 +04:00
|
|
|
&frag->wr_desc.sr_desc,
|
|
|
|
&bad_wr)){
|
2005-11-10 23:15:02 +03:00
|
|
|
rc = OMPI_ERROR;
|
|
|
|
}
|
2005-08-18 21:08:27 +04:00
|
|
|
|
2005-10-21 06:21:45 +04:00
|
|
|
if(mca_btl_openib_component.use_srq) {
|
2006-09-07 17:05:41 +04:00
|
|
|
mca_btl_openib_post_srr(openib_btl, 1, BTL_OPENIB_HP_QP);
|
|
|
|
mca_btl_openib_post_srr(openib_btl, 1, BTL_OPENIB_LP_QP);
|
2005-10-21 06:21:45 +04:00
|
|
|
} else {
|
2006-09-07 17:05:41 +04:00
|
|
|
btl_openib_endpoint_post_rr(endpoint, 1, BTL_OPENIB_HP_QP);
|
|
|
|
btl_openib_endpoint_post_rr(endpoint, 1, BTL_OPENIB_LP_QP);
|
2005-10-21 06:21:45 +04:00
|
|
|
}
|
|
|
|
}
|
2005-11-10 23:15:02 +03:00
|
|
|
return rc;
|
2005-08-18 21:08:27 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* RDMA READ remote buffer to local buffer address.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_openib_get( mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_endpoint_t* endpoint,
|
|
|
|
mca_btl_base_descriptor_t* descriptor)
|
|
|
|
{
|
2005-11-10 23:15:02 +03:00
|
|
|
int rc;
|
2005-08-18 21:08:27 +04:00
|
|
|
struct ibv_send_wr* bad_wr;
|
|
|
|
mca_btl_openib_frag_t* frag = (mca_btl_openib_frag_t*) descriptor;
|
2005-10-02 22:58:57 +04:00
|
|
|
mca_btl_openib_module_t* openib_btl = (mca_btl_openib_module_t*) btl;
|
2005-08-18 21:08:27 +04:00
|
|
|
frag->endpoint = endpoint;
|
|
|
|
frag->wr_desc.sr_desc.opcode = IBV_WR_RDMA_READ;
|
2005-11-10 23:15:02 +03:00
|
|
|
|
2006-01-13 02:42:44 +03:00
|
|
|
/* check for a send wqe */
|
2006-09-05 20:00:18 +04:00
|
|
|
if (OPAL_THREAD_ADD32(&endpoint->sd_wqe[BTL_OPENIB_LP_QP],-1) < 0) {
|
2005-11-10 23:15:02 +03:00
|
|
|
|
2006-09-05 20:00:18 +04:00
|
|
|
OPAL_THREAD_ADD32(&endpoint->sd_wqe[BTL_OPENIB_LP_QP],1);
|
2006-07-06 11:51:23 +04:00
|
|
|
OPAL_THREAD_LOCK(&endpoint->endpoint_lock);
|
2006-09-28 15:41:45 +04:00
|
|
|
opal_list_append(&endpoint->pending_get_frags, (opal_list_item_t*)frag);
|
2006-07-06 11:51:23 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&endpoint->endpoint_lock);
|
2006-01-13 02:42:44 +03:00
|
|
|
return OMPI_SUCCESS;
|
2005-11-10 23:15:02 +03:00
|
|
|
|
2006-01-13 02:42:44 +03:00
|
|
|
/* check for a get token */
|
2005-11-10 23:15:02 +03:00
|
|
|
} else if(OPAL_THREAD_ADD32(&endpoint->get_tokens,-1) < 0) {
|
2006-01-13 02:42:44 +03:00
|
|
|
|
2006-09-05 20:00:18 +04:00
|
|
|
OPAL_THREAD_ADD32(&endpoint->sd_wqe[BTL_OPENIB_LP_QP],1);
|
2006-01-13 02:42:44 +03:00
|
|
|
OPAL_THREAD_ADD32(&endpoint->get_tokens,1);
|
2005-11-10 23:15:02 +03:00
|
|
|
OPAL_THREAD_LOCK(&endpoint->endpoint_lock);
|
2006-09-28 15:41:45 +04:00
|
|
|
opal_list_append(&endpoint->pending_get_frags, (opal_list_item_t*)frag);
|
2005-11-10 23:15:02 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&endpoint->endpoint_lock);
|
2006-01-13 02:42:44 +03:00
|
|
|
return OMPI_SUCCESS;
|
2005-11-10 23:15:02 +03:00
|
|
|
|
2005-10-21 06:21:45 +04:00
|
|
|
} else {
|
2005-07-20 19:17:18 +04:00
|
|
|
|
2005-10-21 06:21:45 +04:00
|
|
|
frag->wr_desc.sr_desc.send_flags = IBV_SEND_SIGNALED;
|
2007-01-07 04:48:57 +03:00
|
|
|
frag->wr_desc.sr_desc.wr.rdma.remote_addr = frag->base.des_src->seg_addr.lval;
|
2005-10-21 06:21:45 +04:00
|
|
|
frag->wr_desc.sr_desc.wr.rdma.rkey = frag->base.des_src->seg_key.key32[0];
|
2007-01-05 01:07:37 +03:00
|
|
|
frag->sg_entry.addr = (unsigned long) frag->base.des_dst->seg_addr.pval;
|
2005-10-21 06:21:45 +04:00
|
|
|
frag->sg_entry.length = frag->base.des_dst->seg_len;
|
|
|
|
|
2006-09-07 17:05:41 +04:00
|
|
|
if(ibv_post_send(endpoint->lcl_qp[BTL_OPENIB_LP_QP],
|
2005-10-21 06:21:45 +04:00
|
|
|
&frag->wr_desc.sr_desc,
|
|
|
|
&bad_wr)){
|
2006-01-13 02:42:44 +03:00
|
|
|
BTL_ERROR(("error posting send request errno (%d) says %s", errno, strerror(errno)));
|
2005-11-10 23:15:02 +03:00
|
|
|
rc = ORTE_ERROR;
|
|
|
|
} else {
|
|
|
|
rc = ORTE_SUCCESS;
|
|
|
|
}
|
2005-10-02 22:58:57 +04:00
|
|
|
|
2005-10-21 06:21:45 +04:00
|
|
|
if(mca_btl_openib_component.use_srq) {
|
2006-09-07 17:05:41 +04:00
|
|
|
mca_btl_openib_post_srr(openib_btl, 1, BTL_OPENIB_HP_QP);
|
|
|
|
mca_btl_openib_post_srr(openib_btl, 1, BTL_OPENIB_LP_QP);
|
2005-10-21 06:21:45 +04:00
|
|
|
} else {
|
2006-09-07 17:05:41 +04:00
|
|
|
btl_openib_endpoint_post_rr(endpoint, 1, BTL_OPENIB_HP_QP);
|
|
|
|
btl_openib_endpoint_post_rr(endpoint, 1, BTL_OPENIB_LP_QP);
|
2005-10-21 06:21:45 +04:00
|
|
|
}
|
|
|
|
}
|
2005-11-10 23:15:02 +03:00
|
|
|
return rc;
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
|
|
|
|
2005-07-20 21:43:31 +04:00
|
|
|
/*
|
2006-07-30 04:58:40 +04:00
|
|
|
* create both the high and low priority completion queues
|
|
|
|
* and the shared receive queue (if requested)
|
2005-07-20 21:43:31 +04:00
|
|
|
*/
|
2006-07-30 04:58:40 +04:00
|
|
|
int mca_btl_openib_create_cq_srq(mca_btl_openib_module_t *openib_btl)
|
2005-07-01 01:28:35 +04:00
|
|
|
{
|
|
|
|
/* Allocate Protection Domain */
|
2005-07-20 01:04:22 +04:00
|
|
|
openib_btl->poll_cq = false;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2007-01-25 01:25:40 +03:00
|
|
|
if (mca_btl_openib_component.use_srq) {
|
2005-10-02 22:58:57 +04:00
|
|
|
|
|
|
|
struct ibv_srq_init_attr attr;
|
2005-11-11 02:29:54 +03:00
|
|
|
attr.attr.max_wr = mca_btl_openib_component.srq_rd_max;
|
2005-10-02 22:58:57 +04:00
|
|
|
attr.attr.max_sge = mca_btl_openib_component.ib_sg_list_size;
|
2005-07-20 19:17:18 +04:00
|
|
|
|
2006-09-07 17:05:41 +04:00
|
|
|
openib_btl->srd_posted[BTL_OPENIB_HP_QP] = 0;
|
|
|
|
openib_btl->srd_posted[BTL_OPENIB_LP_QP] = 0;
|
2005-10-02 22:58:57 +04:00
|
|
|
|
2006-09-07 17:05:41 +04:00
|
|
|
openib_btl->srq[BTL_OPENIB_HP_QP] =
|
|
|
|
ibv_create_srq(openib_btl->hca->ib_pd, &attr);
|
2007-01-25 01:25:40 +03:00
|
|
|
if (NULL == openib_btl->srq[BTL_OPENIB_HP_QP]) {
|
|
|
|
show_init_error(__FILE__, __LINE__, "ibv_create_srq",
|
|
|
|
ibv_get_device_name(openib_btl->hca->ib_dev));
|
2005-10-02 22:58:57 +04:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
2006-09-07 17:05:41 +04:00
|
|
|
openib_btl->srq[BTL_OPENIB_LP_QP] =
|
|
|
|
ibv_create_srq(openib_btl->hca->ib_pd, &attr);
|
2007-01-25 01:25:40 +03:00
|
|
|
if (NULL == openib_btl->srq[BTL_OPENIB_LP_QP]) {
|
|
|
|
show_init_error(__FILE__, __LINE__, "ibv_create_srq",
|
|
|
|
ibv_get_device_name(openib_btl->hca->ib_dev));
|
2005-10-02 22:58:57 +04:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
2005-11-17 08:45:33 +03:00
|
|
|
|
2006-07-31 21:24:39 +04:00
|
|
|
|
2005-10-02 22:58:57 +04:00
|
|
|
} else {
|
2006-09-07 17:05:41 +04:00
|
|
|
openib_btl->srq[BTL_OPENIB_HP_QP] = NULL;
|
|
|
|
openib_btl->srq[BTL_OPENIB_LP_QP] = NULL;
|
2005-10-02 22:58:57 +04:00
|
|
|
}
|
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
/* Create the low and high priority queue pairs */
|
2006-11-02 19:15:21 +03:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS == 1
|
|
|
|
#if OMPI_MCA_BTL_OPENIB_IBV_CREATE_CQ_ARGS == 3
|
|
|
|
openib_btl->ib_cq[BTL_OPENIB_LP_QP] =
|
|
|
|
ibv_create_cq(openib_btl->hca->ib_dev_context,
|
|
|
|
mca_btl_openib_component.ib_cq_size, openib_btl->hca->ib_channel);
|
|
|
|
#else
|
|
|
|
openib_btl->ib_cq[BTL_OPENIB_LP_QP] =
|
|
|
|
ibv_create_cq(openib_btl->hca->ib_dev_context,
|
|
|
|
mca_btl_openib_component.ib_cq_size, openib_btl, openib_btl->hca->ib_channel, 0);
|
|
|
|
#endif
|
|
|
|
#else /* OMPI_ENABLE_PROGRESS_THREADS DISABLED */
|
2005-09-29 17:35:57 +04:00
|
|
|
#if OMPI_MCA_BTL_OPENIB_IBV_CREATE_CQ_ARGS == 3
|
2006-09-12 13:17:59 +04:00
|
|
|
openib_btl->ib_cq[BTL_OPENIB_LP_QP] =
|
2006-06-28 11:23:08 +04:00
|
|
|
ibv_create_cq(openib_btl->hca->ib_dev_context,
|
|
|
|
mca_btl_openib_component.ib_cq_size, NULL);
|
2005-09-29 17:35:57 +04:00
|
|
|
#else
|
2006-09-12 13:17:59 +04:00
|
|
|
openib_btl->ib_cq[BTL_OPENIB_LP_QP] =
|
2006-06-28 11:23:08 +04:00
|
|
|
ibv_create_cq(openib_btl->hca->ib_dev_context,
|
|
|
|
mca_btl_openib_component.ib_cq_size, NULL, NULL, 0);
|
2005-09-29 17:35:57 +04:00
|
|
|
#endif
|
2006-11-02 19:15:21 +03:00
|
|
|
#endif /* OMPI_ENABLE_PROGRESS_THREADS */
|
2005-07-13 04:17:08 +04:00
|
|
|
|
2007-01-25 01:25:40 +03:00
|
|
|
if (NULL == openib_btl->ib_cq[BTL_OPENIB_LP_QP]) {
|
2007-01-25 01:31:13 +03:00
|
|
|
show_init_error(__FILE__, __LINE__, "ibv_create_cq",
|
2007-01-25 01:25:40 +03:00
|
|
|
ibv_get_device_name(openib_btl->hca->ib_dev));
|
2005-07-13 04:17:08 +04:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
2006-11-02 19:15:21 +03:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS == 1
|
|
|
|
if(ibv_req_notify_cq(openib_btl->ib_cq[BTL_OPENIB_LP_QP], 0)) {
|
2007-01-25 01:25:40 +03:00
|
|
|
show_init_error(__FILE__, __LINE__, "ibv_req_notify_cq",
|
|
|
|
ibv_get_device_name(openib_btl->hca->ib_dev));
|
2006-11-02 19:15:21 +03:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if OMPI_MCA_BTL_OPENIB_IBV_CREATE_CQ_ARGS == 3
|
|
|
|
openib_btl->ib_cq[BTL_OPENIB_HP_QP] =
|
|
|
|
ibv_create_cq(openib_btl->hca->ib_dev_context,
|
|
|
|
mca_btl_openib_component.ib_cq_size, openib_btl->hca->ib_channel);
|
|
|
|
#else
|
|
|
|
openib_btl->ib_cq[BTL_OPENIB_HP_QP] =
|
|
|
|
ibv_create_cq(openib_btl->hca->ib_dev_context,
|
|
|
|
mca_btl_openib_component.ib_cq_size, openib_btl, openib_btl->hca->ib_channel, 0);
|
|
|
|
#endif
|
|
|
|
#else /* OMPI_ENABLE_PROGRESS_THREADS DISABLED */
|
2005-09-29 17:35:57 +04:00
|
|
|
#if OMPI_MCA_BTL_OPENIB_IBV_CREATE_CQ_ARGS == 3
|
2006-09-12 13:17:59 +04:00
|
|
|
openib_btl->ib_cq[BTL_OPENIB_HP_QP] =
|
2006-06-28 11:23:08 +04:00
|
|
|
ibv_create_cq(openib_btl->hca->ib_dev_context,
|
|
|
|
mca_btl_openib_component.ib_cq_size, NULL);
|
2005-09-29 17:35:57 +04:00
|
|
|
#else
|
2006-09-12 13:17:59 +04:00
|
|
|
openib_btl->ib_cq[BTL_OPENIB_HP_QP] =
|
2006-06-28 11:23:08 +04:00
|
|
|
ibv_create_cq(openib_btl->hca->ib_dev_context,
|
|
|
|
mca_btl_openib_component.ib_cq_size, NULL, NULL, 0);
|
2005-09-29 17:35:57 +04:00
|
|
|
#endif
|
2006-11-02 19:15:21 +03:00
|
|
|
#endif /* OMPI_ENABLE_PROGRESS_THREADS */
|
2005-09-29 17:35:57 +04:00
|
|
|
|
2006-09-12 13:17:59 +04:00
|
|
|
if(NULL == openib_btl->ib_cq[BTL_OPENIB_HP_QP]) {
|
2007-01-25 01:25:40 +03:00
|
|
|
show_init_error(__FILE__, __LINE__, "ibv_create_cq",
|
|
|
|
ibv_get_device_name(openib_btl->hca->ib_dev));
|
2005-07-01 01:28:35 +04:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
2006-11-02 19:15:21 +03:00
|
|
|
|
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS == 1
|
|
|
|
if(ibv_req_notify_cq(openib_btl->ib_cq[BTL_OPENIB_HP_QP], 0)) {
|
2007-01-25 01:25:40 +03:00
|
|
|
show_init_error(__FILE__, __LINE__, "ibv_req_notify_cq",
|
|
|
|
ibv_get_device_name(openib_btl->hca->ib_dev));
|
2006-11-02 19:15:21 +03:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
OPAL_THREAD_LOCK(&openib_btl->hca->hca_lock);
|
|
|
|
if (!openib_btl->hca->progress){
|
2006-11-06 15:34:56 +03:00
|
|
|
int rc;
|
2006-11-02 19:15:21 +03:00
|
|
|
openib_btl->hca->progress = true;
|
|
|
|
if(OPAL_SUCCESS != (rc = opal_thread_start(&openib_btl->hca->thread))) {
|
|
|
|
BTL_ERROR(("Unable to create progress thread, retval=%d", rc));
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OPAL_THREAD_UNLOCK(&openib_btl->hca->hca_lock);
|
|
|
|
#endif
|
2005-07-12 17:38:54 +04:00
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2007-03-17 02:11:45 +03:00
|
|
|
|
|
|
|
int mca_btl_openib_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;
|
|
|
|
}
|