1
1

Remove trailing whitespaces. No code changes in this commit.

This commit was SVN r17167.
Этот коммит содержится в:
Gleb Natapov 2008-01-21 12:11:18 +00:00
родитель 31390c0074
Коммит c9a1b06771
19 изменённых файлов: 625 добавлений и 625 удалений

Просмотреть файл

@ -32,20 +32,20 @@
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/btl_base_error.h"
#include "btl_openib.h"
#include "btl_openib_frag.h"
#include "btl_openib_frag.h"
#include "btl_openib_proc.h"
#include "btl_openib_endpoint.h"
#include "btl_openib_xrc.h"
#include "ompi/datatype/convertor.h"
#include "ompi/datatype/datatype.h"
#include "ompi/datatype/convertor.h"
#include "ompi/datatype/datatype.h"
#include "ompi/datatype/dt_arch.h"
#include "ompi/mca/mpool/base/base.h"
#include "ompi/mca/mpool/mpool.h"
#include "ompi/mca/mpool/base/base.h"
#include "ompi/mca/mpool/mpool.h"
#include "ompi/mca/mpool/rdma/mpool_rdma.h"
#include "ompi/runtime/params.h"
#include "orte/util/sys_info.h"
#include <errno.h>
#include <string.h>
#include <errno.h>
#include <string.h>
#include <math.h>
#include <inttypes.h>
#ifdef HAVE_SYS_TYPES_H
@ -73,11 +73,11 @@ mca_btl_openib_module_t mca_btl_openib_module = {
0, /* TODO this should be PUT btl flags */
mca_btl_openib_add_procs,
mca_btl_openib_del_procs,
NULL,
NULL,
mca_btl_openib_finalize,
/* we need alloc free, pack */
mca_btl_openib_alloc,
mca_btl_openib_free,
/* 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,
@ -90,8 +90,8 @@ mca_btl_openib_module_t mca_btl_openib_module = {
}
};
static void show_init_error(const char *file, int line,
const char *func, const char *dev)
static void show_init_error(const char *file, int line,
const char *func, const char *dev)
{
if (ENOMEM == errno) {
int ret;
@ -108,13 +108,13 @@ static void show_init_error(const char *file, int line,
}
opal_show_help("help-mpi-btl-openib.txt", "init-fail-no-mem",
true, orte_system_info.nodename,
true, orte_system_info.nodename,
file, line, func, dev, str_limit);
if (NULL != str_limit) free(str_limit);
} else {
opal_show_help("help-mpi-btl-openib.txt", "init-fail-create-q",
true, orte_system_info.nodename,
true, orte_system_info.nodename,
file, line, func, strerror(errno), errno, dev);
}
}
@ -126,7 +126,7 @@ static inline struct ibv_cq *ibv_create_cq_compat(struct ibv_context *context,
#if OMPI_IBV_CREATE_CQ_ARGS == 3
return ibv_create_cq(context, cqe, channel);
#else
return ibv_create_cq(context, cqe, cq_context, channel, comp_vector);
return ibv_create_cq(context, cqe, cq_context, channel, comp_vector);
#endif
}
@ -134,8 +134,8 @@ static int adjust_cq(mca_btl_openib_hca_t *hca, const int cq)
{
uint32_t cq_size = hca->cq_size[cq];
/* make sure we don't exceed the maximum CQ size and that we
* don't size the queue smaller than otherwise requested
/* make sure we don't exceed the maximum CQ size and that we
* don't size the queue smaller than otherwise requested
*/
if(cq_size < mca_btl_openib_component.ib_cq_size[cq])
cq_size = mca_btl_openib_component.ib_cq_size[cq];
@ -151,7 +151,7 @@ static int adjust_cq(mca_btl_openib_hca_t *hca, const int cq)
NULL, NULL,
#endif
0);
if (NULL == hca->ib_cq[cq]) {
show_init_error(__FILE__, __LINE__, "ibv_create_cq",
ibv_get_device_name(hca->ib_dev));
@ -181,7 +181,7 @@ static int adjust_cq(mca_btl_openib_hca_t *hca, const int cq)
else if (cq_size > mca_btl_openib_component.ib_cq_size[cq]){
int rc;
rc = ibv_resize_cq(hca->ib_cq[cq], cq_size);
/* For ConnectX the resize CQ is not implemented and verbs returns -ENOSYS
/* For ConnectX the resize CQ is not implemented and verbs returns -ENOSYS
* but should return ENOSYS. So it is reason for abs */
if(rc && ENOSYS != abs(rc)) {
BTL_ERROR(("cannot resize completion queue, error: %d", rc));
@ -193,20 +193,20 @@ static int adjust_cq(mca_btl_openib_hca_t *hca, const int cq)
return OMPI_SUCCESS;
}
/*
* create both the high and low priority completion queues
/*
* create both the high and low priority completion queues
* and the shared receive queue (if requested)
*/
*/
static int create_srq(mca_btl_openib_module_t *openib_btl)
{
int qp;
/* create the SRQ's */
for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
struct ibv_srq_init_attr attr;
for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
struct ibv_srq_init_attr attr;
if(!BTL_OPENIB_QP_TYPE_PP(qp)) {
attr.attr.max_wr = mca_btl_openib_component.qp_infos[qp].rd_num +
if(!BTL_OPENIB_QP_TYPE_PP(qp)) {
attr.attr.max_wr = mca_btl_openib_component.qp_infos[qp].rd_num +
mca_btl_openib_component.qp_infos[qp].u.srq_qp.sd_max;
attr.attr.max_sge = mca_btl_openib_component.ib_sg_list_size;
openib_btl->qps[qp].u.srq_qp.rd_posted = 0;
@ -222,25 +222,25 @@ static int create_srq(mca_btl_openib_module_t *openib_btl)
openib_btl->qps[qp].u.srq_qp.srq =
ibv_create_srq(openib_btl->hca->ib_pd, &attr);
}
if (NULL == openib_btl->qps[qp].u.srq_qp.srq) {
if (NULL == openib_btl->qps[qp].u.srq_qp.srq) {
show_init_error(__FILE__, __LINE__, "ibv_create_srq",
ibv_get_device_name(openib_btl->hca->ib_dev));
return OMPI_ERROR;
return OMPI_ERROR;
}
}
}
return OMPI_SUCCESS;
}
static int mca_btl_openib_size_queues(struct mca_btl_openib_module_t* openib_btl, size_t nprocs)
static int mca_btl_openib_size_queues(struct mca_btl_openib_module_t* openib_btl, size_t nprocs)
{
uint32_t send_cqes, recv_cqes;
int rc = OMPI_SUCCESS, qp;
mca_btl_openib_hca_t *hca = openib_btl->hca;
/* figure out reasonable sizes for completion queues */
for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
if(BTL_OPENIB_QP_TYPE_SRQ(qp)) {
send_cqes = mca_btl_openib_component.qp_infos[qp].u.srq_qp.sd_max;
recv_cqes = mca_btl_openib_component.qp_infos[qp].rd_num;
@ -252,7 +252,7 @@ static int mca_btl_openib_size_queues(struct mca_btl_openib_module_t* openib_btl
openib_btl->hca->cq_size[qp_cq_prio(qp)] += recv_cqes;
openib_btl->hca->cq_size[BTL_OPENIB_LP_CQ] += send_cqes;
}
rc = adjust_cq(hca, BTL_OPENIB_HP_CQ);
if (OMPI_SUCCESS != rc)
goto out;
@ -262,23 +262,23 @@ static int mca_btl_openib_size_queues(struct mca_btl_openib_module_t* openib_btl
goto out;
if(0 == openib_btl->num_peers)
rc = create_srq(openib_btl);
rc = create_srq(openib_btl);
out:
openib_btl->num_peers += nprocs;
return rc;
}
/*
* add a proc to this btl module
/*
* add a proc to this btl module
* creates an endpoint that is setup on the
* first send to the endpoint
*/
*/
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,
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_openib_module_t* openib_btl = (mca_btl_openib_module_t*)btl;
@ -287,11 +287,11 @@ int mca_btl_openib_add_procs(
int lcl_subnet_id_port_cnt = 0;
int btl_rank = 0;
mca_btl_base_endpoint_t* endpoint;
for(j=0; j < mca_btl_openib_component.ib_num_btls; j++){
for(j=0; j < mca_btl_openib_component.ib_num_btls; j++){
if(mca_btl_openib_component.openib_btls[j]->port_info.subnet_id
== openib_btl->port_info.subnet_id) {
if(openib_btl == mca_btl_openib_component.openib_btls[j]) {
== openib_btl->port_info.subnet_id) {
if(openib_btl == mca_btl_openib_component.openib_btls[j]) {
btl_rank = lcl_subnet_id_port_cnt;
}
lcl_subnet_id_port_cnt++;
@ -313,7 +313,7 @@ int mca_btl_openib_add_procs(
struct ompi_proc_t* ompi_proc = ompi_procs[i];
mca_btl_openib_proc_t* ib_proc;
bool cpc_error = 0;
if(NULL == (ib_proc = mca_btl_openib_proc_create(ompi_proc))) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
@ -353,20 +353,20 @@ int mca_btl_openib_add_procs(
}
#if 0
num_endpoints = rem_subnet_id_port_cnt / lcl_subnet_id_port_cnt +
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;
#endif
#endif
if(rem_subnet_id_port_cnt < lcl_subnet_id_port_cnt &&
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"));
continue;
}
OPAL_THREAD_LOCK(&ib_proc->proc_lock);
/* The btl_proc datastructure is shared by all IB BTL
* instances that are trying to reach this destination.
* instances that are trying to reach this destination.
* Cache the peer instance on the btl_proc.
*/
endpoint = OBJ_NEW(mca_btl_openib_endpoint_t);
@ -375,7 +375,7 @@ int mca_btl_openib_add_procs(
OPAL_THREAD_UNLOCK(&ib_proc->proc_lock);
return OMPI_ERR_OUT_OF_RESOURCE;
}
#if HAVE_XRC
if (MCA_BTL_XRC_ENABLED) {
int rem_port_cnt = 0;
@ -407,7 +407,7 @@ int mca_btl_openib_add_procs(
OPAL_THREAD_UNLOCK(&ib_proc->proc_lock);
continue;
}
endpoint->index = opal_pointer_array_add(openib_btl->hca->endpoints, (void*)endpoint);
if( 0 > endpoint->index ) {
OBJ_RELEASE(endpoint);
@ -416,38 +416,38 @@ int mca_btl_openib_add_procs(
}
ompi_bitmap_set_bit(reachable, i);
OPAL_THREAD_UNLOCK(&ib_proc->proc_lock);
peers[i] = endpoint;
}
return mca_btl_openib_size_queues(openib_btl, nprocs);
}
/*
* delete the proc as reachable from this btl module
/*
* delete the proc as reachable from this btl module
*/
int mca_btl_openib_del_procs(struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
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)
{
int i,ep_index;
mca_btl_openib_module_t* openib_btl = (mca_btl_openib_module_t*) btl;
mca_btl_openib_endpoint_t* endpoint;
for (i=0 ; i < (int) nprocs ; i++) {
mca_btl_base_endpoint_t* del_endpoint = peers[i];
for(ep_index=0;
ep_index < opal_pointer_array_get_size(openib_btl->hca->endpoints);
ep_index++) {
endpoint =
endpoint =
opal_pointer_array_get_item(openib_btl->hca->endpoints,
ep_index);
if(!endpoint || endpoint->endpoint_btl != openib_btl) {
continue;
}
if (endpoint == del_endpoint) {
BTL_VERBOSE(("in del_procs %d, setting another endpoint to null\n",
BTL_VERBOSE(("in del_procs %d, setting another endpoint to null\n",
ep_index));
opal_pointer_array_set_item(openib_btl->hca->endpoints,
ep_index, NULL);
@ -460,15 +460,15 @@ int mca_btl_openib_del_procs(struct mca_btl_base_module_t* btl,
return OMPI_SUCCESS;
}
/*
/*
*Register callback function for error handling..
*/
*/
int mca_btl_openib_register_error_cb(
struct mca_btl_base_module_t* btl,
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;
mca_btl_openib_module_t* openib_btl = (mca_btl_openib_module_t*) btl;
openib_btl->error_cb = cbfunc; /* stash for later */
return OMPI_SUCCESS;
}
@ -541,9 +541,9 @@ static mca_btl_openib_send_frag_t *check_coalescing(opal_list_t *frag_list,
*
* @param btl (IN) BTL module
* @param size (IN) Request segment size.
* @param size (IN) Size of segment to allocate
*
* When allocating a segment we pull a pre-alllocated segment
* @param size (IN) Size of segment to allocate
*
* When allocating a segment we pull a pre-alllocated segment
* from one of two free lists, an eager list and a max list
*/
mca_btl_base_descriptor_t* mca_btl_openib_alloc(
@ -603,7 +603,7 @@ mca_btl_base_descriptor_t* mca_btl_openib_alloc(
BTL_OPENIB_HEADER_COALESCED_HTON(*clsc_hdr);
sfrag->coalesced_length = sizeof(mca_btl_openib_control_header_t) +
sizeof(mca_btl_openib_header_coalesced_t);
to_com_frag(sfrag)->sg_entry.addr = (uint64_t)(uintptr_t)sfrag->hdr;
to_com_frag(sfrag)->sg_entry.addr = (uint64_t)(uintptr_t)sfrag->hdr;
}
cfrag->hdr = (mca_btl_openib_header_coalesced_t*)
@ -623,15 +623,15 @@ mca_btl_base_descriptor_t* mca_btl_openib_alloc(
return &to_base_frag(cfrag)->base;
}
/**
* Return a segment
*
* Return the segment to the appropriate
* preallocated segment list
*/
/**
* Return a segment
*
* Return the segment to the appropriate
* preallocated segment list
*/
int mca_btl_openib_free(
struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* des)
struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* des)
{
/* is this fragment pointing at user memory? */
if(MCA_BTL_OPENIB_FRAG_SEND_USER == openib_frag_type(des) ||
@ -644,7 +644,7 @@ int mca_btl_openib_free(
frag->registration = NULL;
}
}
/* reset those field on free so we will not have to do it on alloc */
to_base_frag(des)->base.des_flags = 0;
switch(openib_frag_type(des)) {
@ -671,37 +671,37 @@ int mca_btl_openib_free(
break;
}
MCA_BTL_IB_FRAG_RETURN(des);
return OMPI_SUCCESS;
return OMPI_SUCCESS;
}
/**
* register user buffer or pack
* data into pre-registered buffer and return a
* register user buffer or pack
* data into pre-registered buffer and return a
* descriptor that can be
* used for send/put.
*
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*
* prepare source's behavior depends on the following:
* Has a valid memory registration been passed to prepare_src?
* 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
* 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
*
* prepare source's behavior depends on the following:
* Has a valid memory registration been passed to prepare_src?
* 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
* 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
* registrations is full, this prevents resources from being exhausted.
* Is the requested size larger than the btl's max send size?
* if so and we aren't asked to leave the registration pinned, then we register the memory if
* the users buffer is contiguous
* Otherwise we choose from two free lists of pre-registered memory in which to pack the data into.
*
* Is the requested size larger than the btl's max send size?
* if so and we aren't asked to leave the registration pinned, then we register the memory if
* the users buffer is contiguous
* Otherwise we choose from two free lists of pre-registered memory in which to pack the data into.
*
*/
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,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
uint8_t order,
size_t reserve,
@ -725,12 +725,12 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_src(
if(NULL == frag) {
return NULL;
}
iov.iov_len = max_data;
iov.iov_base = NULL;
ompi_convertor_pack(convertor, &iov, &iov_count, &max_data);
*size = max_data;
if(NULL == registration) {
@ -755,9 +755,9 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_src(
to_base_frag(frag)->segment.seg_addr.pval = iov.iov_base;
to_base_frag(frag)->segment.seg_key.key32[0] =
(uint32_t)frag->sg_entry.lkey;
assert(MCA_BTL_NO_ORDER == order);
BTL_VERBOSE(("frag->sg_entry.lkey = %lu .addr = %llu "
"frag->segment.seg_key.key32[0] = %lu",
frag->sg_entry.lkey, frag->sg_entry.addr,
@ -766,13 +766,13 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_src(
return &to_base_frag(frag)->base;
}
}
assert(MCA_BTL_NO_ORDER == order);
assert(MCA_BTL_NO_ORDER == order);
if(max_data + reserve > btl->btl_max_send_size) {
max_data = btl->btl_max_send_size - reserve;
}
frag = (mca_btl_openib_com_frag_t*)(reserve ?
mca_btl_openib_alloc(btl, endpoint, order, max_data + reserve,
flags) :
@ -785,7 +785,7 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_src(
iov.iov_base = (unsigned char*)to_base_frag(frag)->segment.seg_addr.pval +
reserve;
rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data);
*size = max_data;
/* not all upper layer users set this */
@ -799,13 +799,13 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_src(
*
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
* prepare dest's behavior depends on the following:
* Has a valid memory registration been passed to prepare_src?
* if so we attempt to use the pre-registered user-buffer, if the memory registration
* 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
* prepare dest's behavior depends on the following:
* Has a valid memory registration been passed to prepare_src?
* if so we attempt to use the pre-registered user-buffer, if the memory registration
* 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
* registrations is full, this prevents resources from being exhausted.
*/
mca_btl_base_descriptor_t* mca_btl_openib_prepare_dst(
@ -830,13 +830,13 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_dst(
if(NULL == frag) {
return NULL;
}
ompi_convertor_get_current_pointer(convertor, &buffer);
if(NULL == registration){
/* we didn't get a memory registration passed in, so we have to
* register the region ourselves
*/
*/
rc = btl->btl_mpool->mpool_register(btl->btl_mpool, buffer, *size, 0,
&registration);
if(OMPI_SUCCESS != rc || NULL == registration) {
@ -941,12 +941,12 @@ static int mca_btl_finalize_hca(struct mca_btl_openib_hca_t *hca)
int mca_btl_openib_finalize(struct mca_btl_base_module_t* btl)
{
mca_btl_openib_module_t* openib_btl;
mca_btl_openib_module_t* openib_btl;
mca_btl_openib_endpoint_t* endpoint;
int ep_index, i;
int qp, rc = OMPI_SUCCESS;
openib_btl = (mca_btl_openib_module_t*) btl;
openib_btl = (mca_btl_openib_module_t*) btl;
/* Remove the btl from component list */
if ( mca_btl_openib_component.ib_num_btls > 1 ) {
@ -982,7 +982,7 @@ int mca_btl_openib_finalize(struct mca_btl_base_module_t* btl)
OBJ_RELEASE(endpoint);
}
/* Release SRQ resources */
for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
if(!BTL_OPENIB_QP_TYPE_PP(qp)) {
MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS(
&openib_btl->qps[qp].u.srq_qp.pending_frags[0]);
@ -1001,7 +1001,7 @@ int mca_btl_openib_finalize(struct mca_btl_base_module_t* btl)
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"));
rc = OMPI_ERROR;
@ -1029,7 +1029,7 @@ int mca_btl_openib_finalize(struct mca_btl_base_module_t* btl)
}
#endif
OBJ_DESTRUCT(&openib_btl->ib_lock);
OBJ_DESTRUCT(&openib_btl->ib_lock);
free(openib_btl);
BTL_VERBOSE(("Success in closing BTL resources"));
@ -1038,21 +1038,21 @@ int mca_btl_openib_finalize(struct mca_btl_base_module_t* btl)
}
/*
* Initiate a send.
* Initiate a send.
*/
int mca_btl_openib_send(
int mca_btl_openib_send(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* ep,
struct mca_btl_base_descriptor_t* des,
mca_btl_base_tag_t tag)
{
mca_btl_openib_send_frag_t *frag;
assert(openib_frag_type(des) == MCA_BTL_OPENIB_FRAG_SEND ||
openib_frag_type(des) == MCA_BTL_OPENIB_FRAG_COALESCED);
if(openib_frag_type(des) == MCA_BTL_OPENIB_FRAG_COALESCED) {
to_coalesced_frag(des)->hdr->tag = tag;
to_coalesced_frag(des)->hdr->size = des->des_src->seg_len;
@ -1061,7 +1061,7 @@ int mca_btl_openib_send(
frag = to_coalesced_frag(des)->send_frag;
} else {
frag = to_send_frag(des);
to_com_frag(des)->endpoint = ep;
to_com_frag(des)->endpoint = ep;
frag->hdr->tag = tag;
}
@ -1076,8 +1076,8 @@ int mca_btl_openib_put( mca_btl_base_module_t* btl,
mca_btl_base_endpoint_t* ep,
mca_btl_base_descriptor_t* descriptor)
{
struct ibv_send_wr* bad_wr;
mca_btl_openib_out_frag_t* frag = to_out_frag(descriptor);
struct ibv_send_wr* bad_wr;
mca_btl_openib_out_frag_t* frag = to_out_frag(descriptor);
int qp = descriptor->order;
uint64_t rem_addr = descriptor->des_dst->seg_addr.lval;
uint32_t rkey = descriptor->des_dst->seg_key.key32[0];
@ -1119,23 +1119,23 @@ int mca_btl_openib_put( mca_btl_base_module_t* btl,
frag->sr_desc.wr.rdma.rkey = rkey;
to_com_frag(frag)->sg_entry.addr =
(uint64_t)(uintptr_t)descriptor->des_src->seg_addr.pval;
to_com_frag(frag)->sg_entry.length = descriptor->des_src->seg_len;
(uint64_t)(uintptr_t)descriptor->des_src->seg_addr.pval;
to_com_frag(frag)->sg_entry.length = descriptor->des_src->seg_len;
to_com_frag(frag)->endpoint = ep;
#if HAVE_XRC
if (MCA_BTL_XRC_ENABLED && BTL_OPENIB_QP_TYPE_XRC(qp))
frag->sr_desc.xrc_remote_srq_num=ep->rem_info.rem_srqs[qp].rem_srq_num;
#endif
descriptor->order = qp;
/* Setting opcode on a frag constructor isn't enough since prepare_src
* may return send_frag instead of put_frag */
* may return send_frag instead of put_frag */
frag->sr_desc.opcode = IBV_WR_RDMA_WRITE;
frag->sr_desc.send_flags = ib_send_flags(descriptor->des_src->seg_len, ep);
if(ibv_post_send(ep->qps[qp].qp->lcl_qp, &frag->sr_desc, &bad_wr))
return OMPI_ERROR;
return OMPI_SUCCESS;
return OMPI_SUCCESS;
}
/*
@ -1146,8 +1146,8 @@ int mca_btl_openib_get(mca_btl_base_module_t* btl,
mca_btl_base_endpoint_t* ep,
mca_btl_base_descriptor_t* descriptor)
{
struct ibv_send_wr* bad_wr;
mca_btl_openib_get_frag_t* frag = to_get_frag(descriptor);
struct ibv_send_wr* bad_wr;
mca_btl_openib_get_frag_t* frag = to_get_frag(descriptor);
int qp = descriptor->order;
uint64_t rem_addr = descriptor->des_src->seg_addr.lval;
uint32_t rkey = descriptor->des_src->seg_key.key32[0];
@ -1186,22 +1186,22 @@ int mca_btl_openib_get(mca_btl_base_module_t* btl,
OPAL_THREAD_UNLOCK(&ep->endpoint_lock);
return OMPI_SUCCESS;
}
#if OMPI_ENABLE_HETEROGENEOUS_SUPPORT
if((ep->endpoint_proc->proc_ompi->proc_arch & OMPI_ARCH_ISBIGENDIAN)
!= (ompi_proc_local()->proc_arch & OMPI_ARCH_ISBIGENDIAN)) {
rem_addr = opal_swap_bytes8(rem_addr);
rkey = opal_swap_bytes4(rkey);
rem_addr = opal_swap_bytes8(rem_addr);
rkey = opal_swap_bytes4(rkey);
}
#endif
frag->sr_desc.wr.rdma.remote_addr = rem_addr;
frag->sr_desc.wr.rdma.remote_addr = rem_addr;
frag->sr_desc.wr.rdma.rkey = rkey;
to_com_frag(frag)->sg_entry.addr =
(uint64_t)(uintptr_t)descriptor->des_dst->seg_addr.pval;
to_com_frag(frag)->sg_entry.length = descriptor->des_dst->seg_len;
(uint64_t)(uintptr_t)descriptor->des_dst->seg_addr.pval;
to_com_frag(frag)->sg_entry.length = descriptor->des_dst->seg_len;
to_com_frag(frag)->endpoint = ep;
#if HAVE_XRC
if (MCA_BTL_XRC_ENABLED && BTL_OPENIB_QP_TYPE_XRC(qp))
frag->sr_desc.xrc_remote_srq_num=ep->rem_info.rem_srqs[qp].rem_srq_num;
@ -1210,7 +1210,7 @@ int mca_btl_openib_get(mca_btl_base_module_t* btl,
if(ibv_post_send(ep->qps[qp].qp->lcl_qp, &frag->sr_desc, &bad_wr))
return OMPI_ERROR;
return OMPI_SUCCESS;
return OMPI_SUCCESS;
}
int mca_btl_openib_ft_event(int state) {

Просмотреть файл

@ -6,19 +6,19 @@
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
* Copyright (c) 2004-2007 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.
* Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2007 Mellanox Technologies. All rights reserved.
* Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
* reserved.
* reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*
* @file
@ -40,11 +40,11 @@
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
#include "opal/util/output.h"
#include "ompi/mca/mpool/mpool.h"
#include "ompi/mca/btl/base/btl_base_error.h"
#include "ompi/mca/mpool/mpool.h"
#include "ompi/mca/btl/base/btl_base_error.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"
#include "ompi/mca/btl/base/base.h"
#include "connect/connect.h"
@ -60,7 +60,7 @@ BEGIN_C_DECLS
* Infiniband (IB) BTL component.
*/
typedef enum {
typedef enum {
MCA_BTL_OPENIB_PP_QP,
MCA_BTL_OPENIB_SRQ_QP,
MCA_BTL_OPENIB_XRC_QP
@ -82,10 +82,10 @@ struct mca_btl_openib_qp_info_t {
int32_t rd_low;
ompi_free_list_t send_free; /**< free lists of send buffer descriptors */
ompi_free_list_t recv_free; /**< free lists of receive buffer descriptors */
union {
union {
mca_btl_openib_pp_qp_info_t pp_qp;
mca_btl_openib_srq_qp_info_t srq_qp;
} u;
} u;
}; typedef struct mca_btl_openib_qp_info_t mca_btl_openib_qp_info_t;
#define BTL_OPENIB_QP_TYPE(Q) (mca_btl_openib_component.qp_infos[(Q)].type)
@ -97,11 +97,11 @@ struct mca_btl_openib_qp_info_t {
(BTL_OPENIB_QP_TYPE(Q) == MCA_BTL_OPENIB_XRC_QP)
struct mca_btl_openib_component_t {
mca_btl_base_component_1_0_1_t super; /**< base BTL component */
mca_btl_base_component_1_0_1_t super; /**< base BTL component */
int ib_max_btls;
/**< maximum number of hcas available to the IB component */
int ib_num_btls;
/**< number of hcas available to the IB component */
@ -132,37 +132,37 @@ struct mca_btl_openib_component_t {
opal_mutex_t ib_lock;
/**< lock for accessing module state */
char* ib_mpool_name;
/**< name of ib memory pool */
char* ib_mpool_name;
/**< name of ib memory pool */
uint8_t num_pp_qps; /**< number of pp qp's */
uint8_t num_srq_qps; /**< number of srq qp's */
uint8_t num_xrc_qps; /**< number of xrc qp's */
uint8_t num_qps; /**< total number of qp's */
opal_hash_table_t ib_addr_table; /**< used only for xrc.hash-table that
keeps table of all lids/subnets */
mca_btl_openib_qp_info_t* qp_infos;
size_t eager_limit; /**< Eager send limit of first fragment, in Bytes */
size_t max_send_size; /**< Maximum send size, in Bytes */
uint32_t reg_mru_len; /**< Length of the registration cache most recently used list */
uint32_t use_srq; /**< Use the Shared Receive Queue (SRQ mode) */
uint32_t ib_cq_size[2]; /**< Max outstanding CQE on the CQ */
uint32_t ib_sg_list_size; /**< Max scatter/gather descriptor entries on the WQ */
uint32_t use_srq; /**< Use the Shared Receive Queue (SRQ mode) */
uint32_t ib_cq_size[2]; /**< Max outstanding CQE on the CQ */
uint32_t ib_sg_list_size; /**< Max scatter/gather descriptor entries on the WQ */
uint32_t ib_pkey_ix; /**< InfiniBand pkey index */
uint32_t ib_pkey_val;
uint32_t ib_psn;
uint32_t ib_qp_ous_rd_atom;
uint32_t ib_mtu;
uint32_t ib_min_rnr_timer;
uint32_t ib_timeout;
uint32_t ib_retry_count;
uint32_t ib_rnr_retry;
uint32_t ib_max_rdma_dst_ops;
uint32_t ib_service_level;
uint32_t ib_psn;
uint32_t ib_qp_ous_rd_atom;
uint32_t ib_mtu;
uint32_t ib_min_rnr_timer;
uint32_t ib_timeout;
uint32_t ib_retry_count;
uint32_t ib_rnr_retry;
uint32_t ib_max_rdma_dst_ops;
uint32_t ib_service_level;
uint32_t use_eager_rdma;
int32_t eager_rdma_threshold; /**< After this number of msg, use RDMA for short messages, always */
int32_t eager_rdma_num;
@ -174,7 +174,7 @@ struct mca_btl_openib_component_t {
int32_t fatal_counter; /**< Counts number on fatal events that we got on all hcas */
int async_pipe[2]; /**< Pipe for comunication with async event thread */
pthread_t async_thread; /**< Async thread that will handle fatal errors */
uint32_t use_async_event_thread; /**< Use the async event handler */
uint32_t use_async_event_thread; /**< Use the async event handler */
#endif
char *if_include;
char **if_include_list;
@ -220,12 +220,12 @@ struct mca_btl_openib_component_t {
OMPI_MODULE_DECLSPEC extern mca_btl_openib_component_t mca_btl_openib_component;
typedef mca_btl_base_recv_reg_t mca_btl_openib_recv_reg_t;
typedef mca_btl_base_recv_reg_t mca_btl_openib_recv_reg_t;
struct mca_btl_openib_port_info {
uint32_t mtu;
#if OMPI_ENABLE_HETEROGENEOUS_SUPPORT
uint8_t padding[4];
#if OMPI_ENABLE_HETEROGENEOUS_SUPPORT
uint8_t padding[4];
#endif
uint64_t subnet_id;
#if HAVE_XRC
@ -271,7 +271,7 @@ typedef struct mca_btl_openib_hca_t {
opal_thread_t thread; /* Progress thread */
volatile bool progress; /* Progress status */
#endif
opal_mutex_t hca_lock; /* hca level lock */
opal_mutex_t hca_lock; /* hca level lock */
struct ibv_context *ib_dev_context;
struct ibv_device_attr ib_dev_attr;
struct ibv_pd *ib_pd;
@ -308,10 +308,10 @@ struct mca_btl_openib_module_pp_qp_t {
}; typedef struct mca_btl_openib_module_pp_qp_t mca_btl_openib_module_pp_qp_t;
struct mca_btl_openib_module_srq_qp_t {
struct ibv_srq *srq;
int32_t rd_posted;
int32_t sd_credits; /* the max number of outstanding sends on a QP when using SRQ */
/* i.e. the number of frags that can be outstanding (down counter) */
struct ibv_srq *srq;
int32_t rd_posted;
int32_t sd_credits; /* the max number of outstanding sends on a QP when using SRQ */
/* i.e. the number of frags that can be outstanding (down counter) */
opal_list_t pending_frags[2]; /**< list of high/low prio frags */
}; typedef struct mca_btl_openib_module_srq_qp_t mca_btl_openib_module_srq_qp_t;
@ -327,26 +327,26 @@ struct mca_btl_openib_module_qp_t {
*/
struct mca_btl_openib_module_t {
mca_btl_base_module_t super; /**< base BTL interface */
bool btl_inited;
mca_btl_openib_port_info_t port_info; /* contains only the subnet id right now */
bool btl_inited;
mca_btl_openib_port_info_t port_info; /* contains only the subnet id right now */
mca_btl_openib_hca_t *hca;
uint8_t port_num; /**< ID of the PORT */
uint8_t port_num; /**< ID of the PORT */
uint16_t pkey_index;
struct ibv_port_attr ib_port_attr;
struct ibv_port_attr ib_port_attr;
uint16_t lid; /**< lid that is actually used (for LMC) */
uint8_t src_path_bits; /**< offset from base lid (for LMC) */
int32_t num_peers;
opal_mutex_t ib_lock; /**< module level lock */
size_t ib_inline_max; /**< max size of inline send*/
opal_mutex_t ib_lock; /**< module level lock */
size_t ib_inline_max; /**< max size of inline send*/
size_t eager_rdma_frag_size; /**< length of eager frag */
volatile int32_t eager_rdma_channels; /**< number of open RDMA channels */
mca_btl_base_module_error_cb_fn_t error_cb; /**< error handler */
mca_btl_openib_module_qp_t * qps;
};
typedef struct mca_btl_openib_module_t mca_btl_openib_module_t;
@ -375,11 +375,11 @@ int mca_btl_openib_register_error_cb(
struct mca_btl_base_module_t* btl,
mca_btl_base_module_error_cb_fn_t cbfunc
);
/**
* Cleanup any resources held by the BTL.
*
*
* @param btl BTL instance.
* @return OMPI_SUCCESS or error status on failure.
*/
@ -391,14 +391,14 @@ extern int mca_btl_openib_finalize(
/**
* PML->BTL notification of change in the process list.
*
*
* @param btl (IN) BTL module
* @param nprocs (IN) Number of processes
* @param procs (IN) Set of processes
* @param peers (OUT) Set of (optional) peer addressing info.
* @param reachable (IN/OUT) Set of processes that are reachable via this BTL.
* @return OMPI_SUCCESS or error status on failure.
*
*
*/
extern int mca_btl_openib_add_procs(
@ -438,7 +438,7 @@ extern int mca_btl_openib_del_procs(
extern int mca_btl_openib_send(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* btl_peer,
struct mca_btl_base_descriptor_t* descriptor,
struct mca_btl_base_descriptor_t* descriptor,
mca_btl_base_tag_t tag
);
@ -467,7 +467,7 @@ extern int mca_btl_openib_get(
struct mca_btl_base_endpoint_t* btl_peer,
struct mca_btl_base_descriptor_t* descriptor
);
/**
* Allocate a descriptor.
@ -480,8 +480,8 @@ extern mca_btl_base_descriptor_t* mca_btl_openib_alloc(
struct mca_btl_base_endpoint_t* endpoint,
uint8_t order,
size_t size,
uint32_t flags);
uint32_t flags);
/**
* Return a segment allocated by this BTL.
@ -490,9 +490,9 @@ extern mca_btl_base_descriptor_t* mca_btl_openib_alloc(
* @param descriptor (IN) Allocated descriptor.
*/
extern int mca_btl_openib_free(
struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* des);
struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* des);
/**
* Pack data and return a descriptor that can be
@ -504,7 +504,7 @@ extern int mca_btl_openib_free(
mca_btl_base_descriptor_t* mca_btl_openib_prepare_src(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* peer,
mca_mpool_base_registration_t* registration,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
uint8_t order,
size_t reserve,
@ -518,15 +518,15 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_src(
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
extern mca_btl_base_descriptor_t* mca_btl_openib_prepare_dst(
struct mca_btl_base_module_t* btl,
extern mca_btl_base_descriptor_t* mca_btl_openib_prepare_dst(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* peer,
mca_mpool_base_registration_t* registration,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
uint8_t order,
size_t reserve,
size_t* size,
uint32_t flags);
uint32_t flags);
extern void mca_btl_openib_frag_progress_pending_put_get(
struct mca_btl_base_endpoint_t*, const int);
@ -545,7 +545,7 @@ extern int mca_btl_openib_ft_event(int state);
/**
* Post to Shared Receive Queue with certain priority
* Post to Shared Receive Queue with certain priority
*
* @param openib_btl (IN) BTL module
* @param additional (IN) Additional Bytes to reserve

Просмотреть файл

@ -3,9 +3,9 @@
* Copyright (c) 2007 Cisco, Inc. All rights reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -13,11 +13,11 @@
#include "ompi_config.h"
#if OMPI_HAVE_THREADS
#include <infiniband/verbs.h>
#include <infiniband/verbs.h>
#include <fcntl.h>
#include <sys/poll.h>
#include <unistd.h>
#include <errno.h>
#include <errno.h>
#include "opal/util/output.h"
#include "opal/util/show_help.h"
@ -32,7 +32,7 @@ struct mca_btl_openib_async_poll {
int active_poll_size;
int poll_size;
struct pollfd *async_pollfd;
};
};
typedef struct mca_btl_openib_async_poll mca_btl_openib_async_poll;
static int return_status = OMPI_ERROR;
@ -137,9 +137,9 @@ static int btl_openib_async_commandh(struct mca_btl_openib_async_poll *hcas_poll
, __FILE__, __LINE__));
return OMPI_ERROR;
}
memcpy (async_pollfd_tmp,hcas_poll->async_pollfd,
memcpy (async_pollfd_tmp,hcas_poll->async_pollfd,
sizeof(struct pollfd) * (hcas_poll->active_poll_size));
free(hcas_poll->async_pollfd);
free(hcas_poll->async_pollfd);
hcas_poll->async_pollfd = async_pollfd_tmp;
}
hcas_poll->async_pollfd[hcas_poll->active_poll_size].fd = fd;
@ -153,7 +153,7 @@ static int btl_openib_async_commandh(struct mca_btl_openib_async_poll *hcas_poll
BTL_VERBOSE(("Removing HCA [%d] from async event poll [%d]"
,fd,hcas_poll->active_poll_size));
if (hcas_poll->active_poll_size > 1) {
for (j=0; (j < hcas_poll->active_poll_size || !fd_found); j++) {
for (j=0; (j < hcas_poll->active_poll_size || !fd_found); j++) {
if (hcas_poll->async_pollfd[j].fd == fd) {
hcas_poll->async_pollfd[j].fd =
hcas_poll->async_pollfd[hcas_poll->active_poll_size-1].fd;
@ -197,7 +197,7 @@ static int btl_openib_async_hcah(struct mca_btl_openib_async_poll *hcas_poll, in
if (NULL != hca) {
if (ibv_get_async_event((struct ibv_context *)hca->ib_dev_context,&event) < 0) {
if (EWOULDBLOCK == errno) {
/* No event found ?
/* No event found ?
* It was handled by somebody other */
return OMPI_SUCCESS;
} else {
@ -241,7 +241,7 @@ static int btl_openib_async_hcah(struct mca_btl_openib_async_poll *hcas_poll, in
event.event_type);
}
ibv_ack_async_event(&event);
} else {
} else {
/* the hca == NULL , we failed to locate the HCA
* this failure should not never happed */
BTL_ERROR(("Failed to find HCA with FD %d."
@ -253,7 +253,7 @@ static int btl_openib_async_hcah(struct mca_btl_openib_async_poll *hcas_poll, in
}
/* This Async event thread is handling all async event of
* all btls/hcas in openib component
* all btls/hcas in openib component
*/
void* btl_openib_async_thread(void * async)
{
@ -282,28 +282,28 @@ void* btl_openib_async_thread(void * async)
case 0:
/* no events */
break;
case POLLIN:
case POLLIN:
/* Processing our event */
if (0 == i) {
if (0 == i) {
/* 0 poll we use for comunication with main thread */
if (OMPI_SUCCESS != btl_openib_async_commandh(&hcas_poll)) {
free(hcas_poll.async_pollfd);
BTL_ERROR(("Failed to process async thread process."
BTL_ERROR(("Failed to process async thread process."
"Fatal error, stoping asyn event thread"));
pthread_exit(&return_status);
}
} else {
} else {
/* We get hca event */
if (btl_openib_async_hcah(&hcas_poll, i)) {
free(hcas_poll.async_pollfd);
BTL_ERROR(("Failed to process async thread process."
BTL_ERROR(("Failed to process async thread process."
"Fatal error, stoping asyn event thread"));
pthread_exit(&return_status);
}
}
}
break;
default:
/* Get event other than POLLIN
default:
/* Get event other than POLLIN
* this case should not never happend */
BTL_ERROR(("Got unexpected event %d."
"Fatal error, stoping asyn event thread"

Просмотреть файл

@ -1,9 +1,9 @@
/*
* Copyright (c) 2007 Mellanox Technologies. All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*
* @file

Просмотреть файл

@ -6,27 +6,27 @@
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* 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.
* Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2007 Mellanox Technologies. All rights reserved.
* Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
* reserved.
* reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
#include "ompi_config.h"
#include <infiniband/verbs.h>
#include <errno.h>
#include <string.h> /* for strerror()*/
#include <infiniband/verbs.h>
#include <errno.h>
#include <string.h> /* for strerror()*/
#include "ompi/constants.h"
#include "opal/event/event.h"
@ -46,16 +46,16 @@
#include "ompi/proc/proc.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/mpool/base/base.h"
#include "ompi/mca/mpool/base/base.h"
#include "ompi/mca/mpool/rdma/mpool_rdma.h"
#include "ompi/mca/btl/base/base.h"
#include "ompi/datatype/convertor.h"
#include "ompi/mca/mpool/mpool.h"
#include "ompi/datatype/convertor.h"
#include "ompi/mca/mpool/mpool.h"
#include "ompi/runtime/ompi_module_exchange.h"
#include "btl_openib.h"
#include "btl_openib_frag.h"
#include "btl_openib_endpoint.h"
#include "btl_openib_endpoint.h"
#include "btl_openib_eager_rdma.h"
#include "btl_openib_proc.h"
#include "btl_openib_ini.h"
@ -100,7 +100,7 @@ mca_btl_openib_component_t mca_btl_openib_component = {
MCA_BASE_METADATA_PARAM_NONE
},
btl_openib_component_init,
btl_openib_component_init,
btl_openib_component_progress,
}
};
@ -119,7 +119,7 @@ int btl_openib_component_open(void)
OBJ_CONSTRUCT(&mca_btl_openib_component.hcas, opal_pointer_array_t);
mca_btl_openib_component.hcas_count = 0;
/* initialize objects */
/* initialize objects */
OBJ_CONSTRUCT(&mca_btl_openib_component.ib_procs, opal_list_t);
/* register IB component parameters */
@ -180,7 +180,7 @@ static int btl_openib_modex_send(void)
if (NULL == message) {
BTL_ERROR(("Failed malloc: %s:%d\n", __FILE__, __LINE__));
return OMPI_ERR_OUT_OF_RESOURCE;
}
}
/* Pack the number of ports */
size = mca_btl_openib_component.ib_num_btls;
@ -209,13 +209,13 @@ static int btl_openib_modex_send(void)
offset += sizeof(size);
/* Pack the string */
memcpy(offset,
mca_btl_openib_component.openib_btls[i]->port_info.cpclist,
memcpy(offset,
mca_btl_openib_component.openib_btls[i]->port_info.cpclist,
size_save);
offset += size_save;
}
rc = ompi_modex_send(&mca_btl_openib_component.super.btl_version,
rc = ompi_modex_send(&mca_btl_openib_component.super.btl_version,
message, msg_size);
free(message);
@ -240,30 +240,30 @@ static void btl_openib_control(mca_btl_base_module_t* btl,
(mca_btl_openib_header_coalesced_t*)(ctl_hdr + 1);
mca_btl_active_message_callback_t* reg;
size_t len = des->des_dst->seg_len - sizeof(*ctl_hdr);
switch (ctl_hdr->type) {
case MCA_BTL_OPENIB_CONTROL_CREDITS:
assert(0); /* Credit message is handled elsewhere */
break;
case MCA_BTL_OPENIB_CONTROL_RDMA:
rdma_hdr = (mca_btl_openib_eager_rdma_header_t*)ctl_hdr;
BTL_VERBOSE(("prior to NTOH received rkey %lu, rdma_start.lval %llu, pval %p, ival %u\n",
rdma_hdr->rkey,
BTL_VERBOSE(("prior to NTOH received rkey %lu, rdma_start.lval %llu, pval %p, ival %u\n",
rdma_hdr->rkey,
(unsigned long) rdma_hdr->rdma_start.lval,
rdma_hdr->rdma_start.pval,
rdma_hdr->rdma_start.ival
));
if(ep->nbo) {
BTL_OPENIB_EAGER_RDMA_CONTROL_HEADER_NTOH(*rdma_hdr);
}
BTL_VERBOSE(("received rkey %lu, rdma_start.lval %llu, pval %p,"
" ival %u\n", rdma_hdr->rkey,
(unsigned long) rdma_hdr->rdma_start.lval,
rdma_hdr->rdma_start.pval, rdma_hdr->rdma_start.ival));
if (ep->eager_rdma_remote.base.pval) {
BTL_ERROR(("Got RDMA connect twice!"));
return;
@ -379,7 +379,7 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_hca_t *hca,
ibv_query_gid(hca->ib_dev_context, port_num, 0, &gid);
subnet_id = ntoh64(gid.global.subnet_prefix);
BTL_VERBOSE(("my subnet_id is %016x\n", subnet_id));
if(mca_btl_openib_component.ib_num_btls > 0 &&
IB_DEFAULT_GID_PREFIX == subnet_id &&
mca_btl_openib_component.warn_default_gid_prefix) {
@ -389,7 +389,7 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_hca_t *hca,
lmc = (1 << ib_port_attr->lmc);
if (0 != mca_btl_openib_component.max_lmc &&
if (0 != mca_btl_openib_component.max_lmc &&
mca_btl_openib_component.max_lmc < lmc) {
lmc = mca_btl_openib_component.max_lmc;
}
@ -477,19 +477,19 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_hca_t *hca,
forumula is 80% of the reported speed (to get the
true link speed) times the number of links. */
switch (ib_port_attr->active_speed) {
case 1:
case 1:
/* 2.5Gbps * 0.8, in megabits */
openib_btl->super.btl_bandwidth = 2000;
break;
case 2:
case 2:
/* 5.0Gbps * 0.8, in megabits */
openib_btl->super.btl_bandwidth = 4000;
break;
case 4:
case 4:
/* 10.0Gbps * 0.8, in megabits */
openib_btl->super.btl_bandwidth = 8000;
break;
default:
default:
/* Who knows? */
return OMPI_ERR_VALUE_OUT_OF_BOUNDS;
}
@ -555,7 +555,7 @@ static void hca_construct(mca_btl_openib_hca_t *hca)
#endif
hca->qps = (mca_btl_openib_hca_qp_t*)calloc(mca_btl_openib_component.num_qps,
sizeof(mca_btl_openib_hca_qp_t));
OBJ_CONSTRUCT(&hca->hca_lock, opal_mutex_t);
OBJ_CONSTRUCT(&hca->hca_lock, opal_mutex_t);
for(i = 0; i < mca_btl_openib_component.num_qps; i++) {
OBJ_CONSTRUCT(&hca->qps[i].send_free, ompi_free_list_t);
OBJ_CONSTRUCT(&hca->qps[i].recv_free, ompi_free_list_t);
@ -574,7 +574,7 @@ static void hca_destruct(mca_btl_openib_hca_t *hca)
OBJ_RELEASE(hca->eager_rdma_buffers[i]);
free(hca->eager_rdma_buffers);
}
OBJ_DESTRUCT(&hca->hca_lock);
OBJ_DESTRUCT(&hca->hca_lock);
for(i = 0; i < mca_btl_openib_component.num_qps; i++) {
OBJ_DESTRUCT(&hca->qps[i].send_free);
OBJ_DESTRUCT(&hca->qps[i].recv_free);
@ -604,7 +604,7 @@ static int prepare_hca_for_use(mca_btl_openib_hca_t *hca)
&hca->ib_dev_context->async_fd, sizeof(int))<0){
BTL_ERROR(("Failed to write to pipe [%d]",errno));
return OMPI_ERROR;
}
}
}
#if OMPI_ENABLE_PROGRESS_THREADS == 1
/* Prepare data for thread, but not starting it */
@ -632,12 +632,12 @@ static int prepare_hca_for_use(mca_btl_openib_hca_t *hca)
init_data = malloc(sizeof(mca_btl_openib_frag_init_data_t));
length = sizeof(mca_btl_openib_header_t) +
sizeof(mca_btl_openib_footer_t) +
sizeof(mca_btl_openib_footer_t) +
sizeof(mca_btl_openib_eager_rdma_header_t);
init_data->order = MCA_BTL_NO_ORDER;
init_data->list = &hca->send_free_control;
if(OMPI_SUCCESS != ompi_free_list_init_ex_new(
&hca->send_free_control,
sizeof(mca_btl_openib_send_control_frag_t), CACHE_LINE_SIZE,
@ -646,20 +646,20 @@ static int prepare_hca_for_use(mca_btl_openib_hca_t *hca)
mca_btl_openib_component.ib_free_list_num, -1,
mca_btl_openib_component.ib_free_list_inc,
hca->mpool, mca_btl_openib_frag_init,
init_data)) {
init_data)) {
return OMPI_ERROR;
}
/* setup all the qps */
for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
/* setup all the qps */
for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
init_data = malloc(sizeof(mca_btl_openib_frag_init_data_t));
/* Initialize pool of send fragments */
/* Initialize pool of send fragments */
length = sizeof(mca_btl_openib_header_t) +
sizeof(mca_btl_openib_header_coalesced_t) +
sizeof(mca_btl_openib_control_header_t) +
sizeof(mca_btl_openib_footer_t) +
mca_btl_openib_component.qp_infos[qp].size;
init_data->order = qp;
init_data->list = &hca->qps[qp].send_free;
@ -671,20 +671,20 @@ static int prepare_hca_for_use(mca_btl_openib_hca_t *hca)
mca_btl_openib_component.ib_free_list_max,
mca_btl_openib_component.ib_free_list_inc,
hca->mpool, mca_btl_openib_frag_init,
init_data)) {
init_data)) {
return OMPI_ERROR;
}
init_data = malloc(sizeof(mca_btl_openib_frag_init_data_t));
length = sizeof(mca_btl_openib_header_t) +
sizeof(mca_btl_openib_header_coalesced_t) +
sizeof(mca_btl_openib_control_header_t) +
sizeof(mca_btl_openib_footer_t) +
mca_btl_openib_component.qp_infos[qp].size;
init_data->order = qp;
init_data->list = &hca->qps[qp].recv_free;
if(OMPI_SUCCESS != ompi_free_list_init_ex_new(init_data->list,
sizeof(mca_btl_openib_recv_frag_t), CACHE_LINE_SIZE,
OBJ_CLASS(mca_btl_openib_recv_frag_t),
@ -693,7 +693,7 @@ static int prepare_hca_for_use(mca_btl_openib_hca_t *hca)
mca_btl_openib_component.ib_free_list_max,
mca_btl_openib_component.ib_free_list_inc,
hca->mpool, mca_btl_openib_frag_init,
init_data)) {
init_data)) {
return OMPI_ERROR;
}
}
@ -726,7 +726,7 @@ get_port_list(mca_btl_openib_hca_t *hca, int *allowed_ports)
ports */
i = 0;
while (mca_btl_openib_component.if_include_list[i]) {
if (0 == strcmp(dev_name,
if (0 == strcmp(dev_name,
mca_btl_openib_component.if_include_list[i])) {
num_ports = hca->ib_dev_attr.phys_port_cnt;
goto done;
@ -736,9 +736,9 @@ get_port_list(mca_btl_openib_hca_t *hca, int *allowed_ports)
/* Include only requested ports on the HCA */
for (i = 1; i <= hca->ib_dev_attr.phys_port_cnt; ++i) {
sprintf(name,"%s:%d",dev_name,i);
for (j = 0;
for (j = 0;
NULL != mca_btl_openib_component.if_include_list[j]; ++j) {
if (0 == strcmp(name,
if (0 == strcmp(name,
mca_btl_openib_component.if_include_list[j])) {
allowed_ports[num_ports++] = i;
break;
@ -750,7 +750,7 @@ get_port_list(mca_btl_openib_hca_t *hca, int *allowed_ports)
all ports */
i = 0;
while (mca_btl_openib_component.if_exclude_list[i]) {
if (0 == strcmp(dev_name,
if (0 == strcmp(dev_name,
mca_btl_openib_component.if_exclude_list[i])) {
num_ports = 0;
goto done;
@ -760,9 +760,9 @@ get_port_list(mca_btl_openib_hca_t *hca, int *allowed_ports)
/* Exclude the specified ports on this HCA */
for (i = 1; i <= hca->ib_dev_attr.phys_port_cnt; ++i) {
sprintf(name,"%s:%d",dev_name,i);
for (j = 0;
for (j = 0;
NULL != mca_btl_openib_component.if_exclude_list[j]; ++j) {
if (0 == strcmp(name,
if (0 == strcmp(name,
mca_btl_openib_component.if_exclude_list[j])) {
/* If found, set a sentinel value */
j = -1;
@ -843,25 +843,25 @@ static int init_one_hca(opal_list_t *btl_list, struct ibv_device* ib_dev)
int ret = -1, port_cnt;
ompi_btl_openib_ini_values_t values, default_values;
int *allowed_ports = NULL;
hca = OBJ_NEW(mca_btl_openib_hca_t);
if(NULL == hca){
BTL_ERROR(("Failed malloc: %s:%d\n", __FILE__, __LINE__));
return OMPI_ERR_OUT_OF_RESOURCE;
}
hca->ib_dev = ib_dev;
hca->ib_dev_context = ibv_open_device(ib_dev);
if(NULL == hca->ib_dev_context){
if(NULL == hca->ib_dev_context){
BTL_ERROR(("error obtaining device context for %s errno says %s\n",
ibv_get_device_name(ib_dev), strerror(errno)));
ibv_get_device_name(ib_dev), strerror(errno)));
goto error;
}
if(ibv_query_device(hca->ib_dev_context, &hca->ib_dev_attr)){
}
if(ibv_query_device(hca->ib_dev_context, &hca->ib_dev_attr)){
BTL_ERROR(("error obtaining device attributes for %s errno says %s\n",
ibv_get_device_name(ib_dev), strerror(errno)));
ibv_get_device_name(ib_dev), strerror(errno)));
goto error;
}
/* If mca_btl_if_include/exclude were specified, get usable ports */
@ -976,7 +976,7 @@ static int init_one_hca(opal_list_t *btl_list, struct ibv_device* ib_dev)
ibv_get_device_name(ib_dev), strerror(errno)));
goto error;
}
#if OMPI_ENABLE_PROGRESS_THREADS == 1
hca->ib_channel = ibv_create_comp_channel(hca->ib_dev_context);
if (NULL == hca->ib_channel) {
@ -987,7 +987,7 @@ static int init_one_hca(opal_list_t *btl_list, struct ibv_device* ib_dev)
}
#endif
ret = OMPI_SUCCESS;
ret = OMPI_SUCCESS;
/* Note ports are 1 based (i >= 1) */
for(k = 0; k < port_cnt; k++){
@ -997,7 +997,7 @@ static int init_one_hca(opal_list_t *btl_list, struct ibv_device* ib_dev)
BTL_ERROR(("error getting port attributes for device %s "
"port number %d errno says %s",
ibv_get_device_name(ib_dev), i, strerror(errno)));
break;
break;
}
if(IBV_PORT_ACTIVE == ib_port_attr.state){
@ -1017,7 +1017,7 @@ static int init_one_hca(opal_list_t *btl_list, struct ibv_device* ib_dev)
}
}
if (OMPI_SUCCESS != ret) {
/* Out of bounds error indicates that we hit max btl number
/* Out of bounds error indicates that we hit max btl number
* don't propagate the error to the caller */
if(OMPI_ERR_VALUE_OUT_OF_BOUNDS == ret)
ret = OMPI_SUCCESS;
@ -1061,27 +1061,27 @@ static int finish_btl_init(mca_btl_openib_module_t *openib_btl)
/* Initialize module state */
OBJ_CONSTRUCT(&openib_btl->ib_lock, opal_mutex_t);
/* setup the qp structure */
openib_btl->qps = (mca_btl_openib_module_qp_t*)
calloc(mca_btl_openib_component.num_qps,
sizeof(mca_btl_openib_module_qp_t));
/* setup all the qps */
for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
if(!BTL_OPENIB_QP_TYPE_PP(qp)) {
/* setup all the qps */
for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
if(!BTL_OPENIB_QP_TYPE_PP(qp)) {
OBJ_CONSTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[0],
opal_list_t);
OBJ_CONSTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[1],
opal_list_t);
openib_btl->qps[qp].u.srq_qp.sd_credits =
openib_btl->qps[qp].u.srq_qp.sd_credits =
mca_btl_openib_component.qp_infos[qp].u.srq_qp.sd_max;
}
}
/* initialize the memory pool using the hca */
/* initialize the memory pool using the hca */
openib_btl->super.btl_mpool = openib_btl->hca->mpool;
openib_btl->eager_rdma_channels = 0;
openib_btl->eager_rdma_frag_size = OPAL_ALIGN(
@ -1103,28 +1103,28 @@ static int finish_btl_init(mca_btl_openib_module_t *openib_btl)
* (3) register BTL parameters with the MCA
*/
static mca_btl_base_module_t**
btl_openib_component_init(int *num_btl_modules,
static mca_btl_base_module_t**
btl_openib_component_init(int *num_btl_modules,
bool enable_progress_threads,
bool enable_mpi_threads)
{
struct ibv_device **ib_devs;
struct ibv_device **ib_devs;
mca_btl_base_module_t** btls;
int i, ret, num_devs, length;
opal_list_t btl_list;
mca_btl_openib_module_t * openib_btl;
mca_btl_base_selected_module_t* ib_selected;
opal_list_item_t* item;
opal_list_t btl_list;
mca_btl_openib_module_t * openib_btl;
mca_btl_base_selected_module_t* ib_selected;
opal_list_item_t* item;
#if !defined(HAVE_IBV_GET_DEVICE_LIST)
struct dlist *dev_list;
struct ibv_device* ib_dev;
struct dlist *dev_list;
struct ibv_device* ib_dev;
#endif
unsigned short seedv[3];
mca_btl_openib_frag_init_data_t *init_data;
/* initialization */
*num_btl_modules = 0;
num_devs = 0;
num_devs = 0;
seedv[0] = orte_process_info.my_name->vpid;
seedv[1] = opal_sys_timer_get_cycles();
@ -1146,10 +1146,10 @@ btl_openib_component_init(int *num_btl_modules,
OBJ_CONSTRUCT(&mca_btl_openib_component.recv_user_free, ompi_free_list_t);
init_data = malloc(sizeof(mca_btl_openib_frag_init_data_t));
init_data->order = mca_btl_openib_component.rdma_qp;
init_data->list = &mca_btl_openib_component.send_user_free;
if(OMPI_SUCCESS != ompi_free_list_init_ex_new(
&mca_btl_openib_component.send_user_free,
sizeof(mca_btl_openib_put_frag_t), 2,
@ -1158,15 +1158,15 @@ btl_openib_component_init(int *num_btl_modules,
mca_btl_openib_component.ib_free_list_num,
mca_btl_openib_component.ib_free_list_max,
mca_btl_openib_component.ib_free_list_inc,
NULL, mca_btl_openib_frag_init, init_data)) {
NULL, mca_btl_openib_frag_init, init_data)) {
goto no_btls;
}
init_data = malloc(sizeof(mca_btl_openib_frag_init_data_t));
init_data->order = mca_btl_openib_component.rdma_qp;
init_data->list = &mca_btl_openib_component.recv_user_free;
if(OMPI_SUCCESS != ompi_free_list_init_ex_new(
&mca_btl_openib_component.recv_user_free,
sizeof(mca_btl_openib_get_frag_t), 2,
@ -1175,7 +1175,7 @@ btl_openib_component_init(int *num_btl_modules,
mca_btl_openib_component.ib_free_list_num,
mca_btl_openib_component.ib_free_list_max,
mca_btl_openib_component.ib_free_list_inc,
NULL, mca_btl_openib_frag_init, init_data)) {
NULL, mca_btl_openib_frag_init, init_data)) {
goto no_btls;
}
@ -1207,14 +1207,14 @@ btl_openib_component_init(int *num_btl_modules,
"ibv_fork_init fail", true,
orte_system_info.nodename);
goto no_btls;
}
}
}
}
#endif
/* Parse the include and exclude lists, checking for errors */
mca_btl_openib_component.if_include_list =
mca_btl_openib_component.if_exclude_list =
mca_btl_openib_component.if_exclude_list =
mca_btl_openib_component.if_list = NULL;
if (NULL != mca_btl_openib_component.if_include &&
NULL != mca_btl_openib_component.if_exclude) {
@ -1224,59 +1224,59 @@ btl_openib_component_init(int *num_btl_modules,
mca_btl_openib_component.if_exclude, NULL);
goto no_btls;
} else if (NULL != mca_btl_openib_component.if_include) {
mca_btl_openib_component.if_include_list =
mca_btl_openib_component.if_include_list =
opal_argv_split(mca_btl_openib_component.if_include, ',');
mca_btl_openib_component.if_list =
mca_btl_openib_component.if_list =
opal_argv_copy(mca_btl_openib_component.if_include_list);
} else if (NULL != mca_btl_openib_component.if_exclude) {
mca_btl_openib_component.if_exclude_list =
mca_btl_openib_component.if_exclude_list =
opal_argv_split(mca_btl_openib_component.if_exclude, ',');
mca_btl_openib_component.if_list =
mca_btl_openib_component.if_list =
opal_argv_copy(mca_btl_openib_component.if_exclude_list);
}
#ifdef HAVE_IBV_GET_DEVICE_LIST
ib_devs = ibv_get_device_list(&num_devs);
#else
#else
/* Determine the number of hca's available on the host */
dev_list = ibv_get_devices();
dev_list = ibv_get_devices();
if (NULL == dev_list) {
mca_btl_base_error_no_nics("OpenIB", "HCA");
mca_btl_openib_component.ib_num_btls = 0;
btl_openib_modex_send();
return NULL;
}
dlist_start(dev_list);
dlist_start(dev_list);
dlist_for_each_data(dev_list, ib_dev, struct ibv_device)
num_devs++;
num_devs++;
#endif
if(0 == num_devs) {
if(0 == num_devs) {
mca_btl_base_error_no_nics("OpenIB", "HCA");
btl_openib_modex_send();
return NULL;
return NULL;
}
#if !defined(HAVE_IBV_GET_DEVICE_LIST)
/* Allocate space for the ib devices */
/* Allocate space for the ib devices */
ib_devs = (struct ibv_device**) malloc(num_devs * sizeof(struct ibv_dev*));
if(NULL == ib_devs) {
BTL_ERROR(("Failed malloc: %s:%d\n", __FILE__, __LINE__));
return NULL;
}
dlist_start(dev_list);
dlist_start(dev_list);
i = 0;
i = 0;
dlist_for_each_data(dev_list, ib_dev, struct ibv_device)
ib_devs[i++] = ib_dev;
ib_devs[i++] = ib_dev;
#endif
/* We must loop through all the hca id's, get their handles and
for each hca we query the number of ports on the hca and set up
a distinct btl module for each hca port */
a distinct btl module for each hca port */
OBJ_CONSTRUCT(&btl_list, opal_list_t);
OBJ_CONSTRUCT(&btl_list, opal_list_t);
OBJ_CONSTRUCT(&mca_btl_openib_component.ib_lock, opal_mutex_t);
#if OMPI_HAVE_THREADS
mca_btl_openib_component.async_thread = 0;
@ -1303,11 +1303,11 @@ btl_openib_component_init(int *num_btl_modules,
char *str = opal_argv_join(mca_btl_openib_component.if_list, ',');
opal_show_help("help-mpi-btl-openib.txt", "nonexistent port",
true, orte_system_info.nodename,
((NULL != mca_btl_openib_component.if_include) ?
((NULL != mca_btl_openib_component.if_include) ?
"in" : "ex"), str);
free(str);
}
if(0 == mca_btl_openib_component.ib_num_btls) {
opal_show_help("help-mpi-btl-openib.txt",
"no active ports found", true, orte_system_info.nodename);
@ -1332,11 +1332,11 @@ btl_openib_component_init(int *num_btl_modules,
/* Copy the btl module structs into a contiguous array and fully
initialize them */
for(i = 0; i < mca_btl_openib_component.ib_num_btls; i++){
item = opal_list_remove_first(&btl_list);
ib_selected = (mca_btl_base_selected_module_t*)item;
item = opal_list_remove_first(&btl_list);
ib_selected = (mca_btl_base_selected_module_t*)item;
mca_btl_openib_component.openib_btls[i] =
(mca_btl_openib_module_t*)ib_selected->btl_module;
OBJ_RELEASE(ib_selected);
(mca_btl_openib_module_t*)ib_selected->btl_module;
OBJ_RELEASE(ib_selected);
openib_btl = mca_btl_openib_component.openib_btls[i];
btls[i] = &openib_btl->super;
if(finish_btl_init(openib_btl) != OMPI_SUCCESS)
@ -1404,7 +1404,7 @@ static void progress_pending_frags_pp(mca_btl_base_endpoint_t *ep, const int qp)
{
int i;
opal_list_item_t *frag;
OPAL_THREAD_LOCK(&ep->endpoint_lock);
for(i = 0; i < 2; i++) {
while((get_enpoint_credits(ep, qp) +
@ -1420,7 +1420,7 @@ static void progress_pending_frags_pp(mca_btl_base_endpoint_t *ep, const int qp)
void mca_btl_openib_frag_progress_pending_put_get(mca_btl_base_endpoint_t *ep,
const int qp)
{
{
mca_btl_openib_module_t* openib_btl = ep->endpoint_btl;
opal_list_item_t *frag;
size_t i, len = opal_list_get_size(&ep->pending_get_frags);
@ -1436,7 +1436,7 @@ void mca_btl_openib_frag_progress_pending_put_get(mca_btl_base_endpoint_t *ep,
&to_base_frag(frag)->base) == OMPI_ERR_OUT_OF_RESOURCE)
break;
}
len = opal_list_get_size(&ep->pending_put_frags);
for(i = 0; i < len && ep->qps[qp].qp->sd_wqe > 0; i++) {
OPAL_THREAD_LOCK(&ep->endpoint_lock);
@ -1452,7 +1452,7 @@ void mca_btl_openib_frag_progress_pending_put_get(mca_btl_base_endpoint_t *ep,
static int btl_openib_handle_incoming(mca_btl_openib_module_t *openib_btl,
mca_btl_openib_endpoint_t *ep,
mca_btl_openib_recv_frag_t *frag,
mca_btl_openib_recv_frag_t *frag,
size_t byte_len)
{
mca_btl_base_descriptor_t *des = &to_base_frag(frag)->base;
@ -1545,13 +1545,13 @@ static int btl_openib_handle_incoming(mca_btl_openib_module_t *openib_btl,
}
static char* btl_openib_component_status_to_string(enum ibv_wc_status status)
{
switch(status) {
{
switch(status) {
case IBV_WC_SUCCESS:
return "SUCCESS";
return "SUCCESS";
break;
case IBV_WC_LOC_LEN_ERR:
return "LOCAL LENGTH ERROR";
return "LOCAL LENGTH ERROR";
break;
case IBV_WC_LOC_QP_OP_ERR:
return "LOCAL QP OPERATION ERROR";
@ -1604,7 +1604,7 @@ static char* btl_openib_component_status_to_string(enum ibv_wc_status status)
case IBV_WC_INV_EEC_STATE_ERR:
return "INVALID EEC STATE ERROR";
break;
case IBV_WC_FATAL_ERR:
case IBV_WC_FATAL_ERR:
return "FATAL ERROR";
break;
case IBV_WC_RESP_TIMEOUT_ERR:
@ -1647,9 +1647,9 @@ static void progress_pending_frags_srq(mca_btl_openib_module_t* openib_btl,
{
opal_list_item_t *frag;
int i;
assert(BTL_OPENIB_QP_TYPE_SRQ(qp) || BTL_OPENIB_QP_TYPE_XRC(qp));
for(i = 0; i < 2; i++) {
while(openib_btl->qps[qp].u.srq_qp.sd_credits > 0) {
OPAL_THREAD_LOCK(&openib_btl->ib_lock);
@ -1777,7 +1777,7 @@ error:
static int poll_hca(mca_btl_openib_hca_t* hca, int count)
{
int ne = 0, cq;
int ne = 0, cq;
uint32_t hp_iter = 0;
struct ibv_wc wc;
@ -1805,14 +1805,14 @@ static int poll_hca(mca_btl_openib_hca_t* hca, int count)
hp_iter++;
hca->hp_cq_polls--;
}
handle_wc(hca, cq, &wc);
}
return count;
error:
BTL_ERROR(("error polling %s with %d errno says %s\n", cq_name[cq], ne,
strerror(errno)));
strerror(errno)));
return count;
}

Просмотреть файл

@ -69,7 +69,7 @@ typedef struct mca_btl_openib_eager_rdma_remote_t mca_btl_openib_eager_rdma_remo
#define MCA_BTL_OPENIB_RDMA_MAKE_REMOTE(F) do { \
((volatile uint8_t*)(F)->u.buf)[3] = EAGER_RDMA_BUFFER_REMOTE; \
}while (0)
#define MCA_BTL_OPENIB_RDMA_MAKE_LOCAL(F) do { \
((volatile uint8_t*)(F)->u.buf)[3] = EAGER_RDMA_BUFFER_LOCAL; \
}while (0)

Просмотреть файл

@ -6,20 +6,20 @@
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* 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.
* Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
* reserved.
* reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* Copyright (c) 2006-2007 Mellanox Technologies, Inc. All rights reserved.
*
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -27,8 +27,8 @@
#include <sys/time.h>
#include <time.h>
#include <errno.h>
#include <string.h>
#include <errno.h>
#include <string.h>
#include "orte/mca/ns/base/base.h"
#include "orte/mca/oob/base/base.h"
@ -38,9 +38,9 @@
#include "ompi/types.h"
#include "ompi/mca/pml/base/pml_base_sendreq.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/class/ompi_free_list.h"
#include "btl_openib_endpoint.h"
#include "btl_openib_endpoint.h"
#include "btl_openib_proc.h"
#include "btl_openib_xrc.h"
@ -114,10 +114,10 @@ static inline int acruire_wqe(mca_btl_openib_endpoint_t *ep,
if(qp_get_wqe(ep, qp) < 0) {
qp_put_wqe(ep, qp);
OPAL_THREAD_LOCK(&ep->qps[qp].qp->lock);
OPAL_THREAD_LOCK(&ep->qps[qp].qp->lock);
opal_list_append(&ep->qps[qp].qp->pending_frags[prio],
(opal_list_item_t *)frag);
OPAL_THREAD_UNLOCK(&ep->qps[qp].qp->lock);
OPAL_THREAD_UNLOCK(&ep->qps[qp].qp->lock);
return OMPI_ERR_OUT_OF_RESOURCE;
}
@ -142,7 +142,7 @@ static int acquire_send_credit(mca_btl_openib_endpoint_t *endpoint,
int qp = to_base_frag(frag)->base.order;
int prio = !(to_base_frag(frag)->base.des_flags & MCA_BTL_DES_FLAGS_PRIORITY);
if(BTL_OPENIB_QP_TYPE_PP(qp)) {
if(BTL_OPENIB_QP_TYPE_PP(qp)) {
if(OPAL_THREAD_ADD32(&endpoint->qps[qp].u.pp_qp.sd_credits, -1) < 0) {
OPAL_THREAD_ADD32(&endpoint->qps[qp].u.pp_qp.sd_credits, 1);
opal_list_append(&endpoint->qps[qp].pending_frags[prio],
@ -172,7 +172,7 @@ static int acquire_send_credit(mca_btl_openib_endpoint_t *endpoint,
/* this function is called with endpoint->endpoint_lock held */
int mca_btl_openib_endpoint_post_send(mca_btl_openib_endpoint_t *endpoint,
mca_btl_openib_send_frag_t *frag)
{
{
mca_btl_openib_header_t *hdr = frag->hdr;
mca_btl_base_descriptor_t *des = &to_base_frag(frag)->base;
int qp, ib_rc;
@ -225,7 +225,7 @@ int mca_btl_openib_endpoint_post_send(mca_btl_openib_endpoint_t *endpoint,
hdr->cm_seen = cm_return;
}
ib_rc = post_send(endpoint, frag, do_rdma);
ib_rc = post_send(endpoint, frag, do_rdma);
if(!ib_rc)
return OMPI_SUCCESS;
@ -252,15 +252,15 @@ int mca_btl_openib_endpoint_post_send(mca_btl_openib_endpoint_t *endpoint,
OPAL_THREAD_ADD32(&openib_btl->qps[qp].u.srq_qp.sd_credits, 1);
}
}
BTL_ERROR(("error posting send request error %d: %s\n",
ib_rc, strerror(ib_rc)));
return OMPI_ERROR;
BTL_ERROR(("error posting send request error %d: %s\n",
ib_rc, strerror(ib_rc)));
return OMPI_ERROR;
}
OBJ_CLASS_INSTANCE(mca_btl_openib_endpoint_t,
opal_list_item_t, mca_btl_openib_endpoint_construct,
OBJ_CLASS_INSTANCE(mca_btl_openib_endpoint_t,
opal_list_item_t, mca_btl_openib_endpoint_construct,
mca_btl_openib_endpoint_destruct);
/*
@ -291,9 +291,9 @@ endpoint_init_qp_pp(mca_btl_openib_endpoint_qp_t *ep_qp, const int qp)
/* local credits are set here such that on initial posting
* of the receive buffers we end up with zero credits to return
* to our peer. The peer initializes his sd_credits to reflect this
* below. Note that this may be a problem for iWARP as the sender
* now has credits even if the receive buffers are not yet posted
* to our peer. The peer initializes his sd_credits to reflect this
* below. Note that this may be a problem for iWARP as the sender
* now has credits even if the receive buffers are not yet posted
*/
ep_qp->u.pp_qp.rd_credits = -qp_info->rd_num;
@ -399,7 +399,7 @@ static void mca_btl_openib_endpoint_construct(mca_btl_base_endpoint_t* endpoint)
OBJ_CONSTRUCT(&endpoint->pending_lazy_frags, opal_list_t);
OBJ_CONSTRUCT(&endpoint->pending_get_frags, opal_list_t);
OBJ_CONSTRUCT(&endpoint->pending_put_frags, opal_list_t);
endpoint->get_tokens = mca_btl_openib_component.ib_qp_ous_rd_atom;
/* initialize RDMA eager related parts */
@ -410,8 +410,8 @@ static void mca_btl_openib_endpoint_construct(mca_btl_base_endpoint_t* endpoint)
sizeof(mca_btl_openib_eager_rdma_local_t));
OBJ_CONSTRUCT(&endpoint->eager_rdma_local.lock, opal_mutex_t);
endpoint->rem_info.rem_lid = 0;
endpoint->rem_info.rem_subnet_id = 0;
endpoint->rem_info.rem_lid = 0;
endpoint->rem_info.rem_subnet_id = 0;
endpoint->rem_info.rem_mtu = 0;
endpoint->nbo = false;
endpoint->use_eager_rdma = false;
@ -433,14 +433,14 @@ static void mca_btl_openib_endpoint_destruct(mca_btl_base_endpoint_t* endpoint)
do {
/* Make sure that mca_btl_openib_endpoint_connect_eager_rdma ()
* was not in "connect" or "bad" flow (failed to allocate memory)
* and changed the pointer back to NULL
* and changed the pointer back to NULL
*/
if(!opal_atomic_cmpset_ptr(&endpoint->eager_rdma_local.base.pval, NULL,
(void*)1)) {
if ((void*)1 != endpoint->eager_rdma_local.base.pval &&
if ((void*)1 != endpoint->eager_rdma_local.base.pval &&
NULL != endpoint->eager_rdma_local.base.pval) {
endpoint->endpoint_btl->super.btl_mpool->mpool_free(endpoint->endpoint_btl->super.btl_mpool,
endpoint->eager_rdma_local.base.pval,
endpoint->eager_rdma_local.base.pval,
(mca_mpool_base_registration_t*)endpoint->eager_rdma_local.reg);
pval_clean=true;
}
@ -450,7 +450,7 @@ static void mca_btl_openib_endpoint_destruct(mca_btl_base_endpoint_t* endpoint)
} while (!pval_clean);
/* Close opened QPs if we have them*/
for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS(&endpoint->qps[qp].pending_frags[0]);
MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS(&endpoint->qps[qp].pending_frags[1]);
OBJ_DESTRUCT(&endpoint->qps[qp].pending_frags[0]);
@ -487,10 +487,10 @@ static void mca_btl_openib_endpoint_destruct(mca_btl_base_endpoint_t* endpoint)
/* Clean pending lists */
MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS(&endpoint->pending_lazy_frags);
OBJ_DESTRUCT(&endpoint->pending_lazy_frags);
MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS(&endpoint->pending_get_frags);
OBJ_DESTRUCT(&endpoint->pending_get_frags);
MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS(&endpoint->pending_put_frags);
OBJ_DESTRUCT(&endpoint->pending_put_frags);
}
@ -504,14 +504,14 @@ int mca_btl_openib_endpoint_post_recvs(mca_btl_openib_endpoint_t *endpoint)
{
int qp;
for (qp = 0; qp < mca_btl_openib_component.num_qps; ++qp) {
if (BTL_OPENIB_QP_TYPE_PP(qp)) {
for (qp = 0; qp < mca_btl_openib_component.num_qps; ++qp) {
if (BTL_OPENIB_QP_TYPE_PP(qp)) {
mca_btl_openib_endpoint_post_rr_nolock(endpoint, qp);
} else {
mca_btl_openib_post_srr(endpoint->endpoint_btl, qp);
}
}
return OMPI_SUCCESS;
}
@ -538,7 +538,7 @@ void mca_btl_openib_endpoint_connected(mca_btl_openib_endpoint_t *endpoint)
master = true;
}
}
endpoint->endpoint_state = MCA_BTL_IB_CONNECTED;
endpoint->endpoint_btl->hca->non_eager_rdma_endpoints++;
@ -551,9 +551,9 @@ void mca_btl_openib_endpoint_connected(mca_btl_openib_endpoint_t *endpoint)
frag_item = opal_list_remove_first(&(endpoint->pending_lazy_frags));
frag = to_send_frag(frag_item);
/* We need to post this one */
if(OMPI_ERROR == mca_btl_openib_endpoint_post_send(endpoint, frag))
BTL_ERROR(("Error posting send"));
BTL_ERROR(("Error posting send"));
}
/* if upper layer called put or get before connection moved to connected
@ -603,13 +603,13 @@ static void mca_btl_openib_endpoint_credits(
struct mca_btl_base_descriptor_t* des,
int status)
{
int qp;
mca_btl_openib_send_control_frag_t *frag = to_send_control_frag(des);
qp = frag->qp_idx;
/* we don't acquire a WQE for credit message - so decrement.
* Note: doing it for QP used for credit management */
qp_get_wqe(ep, des->order);
@ -626,7 +626,7 @@ static void mca_btl_openib_endpoint_credits(
/**
* Return credits to peer
*/
void mca_btl_openib_endpoint_send_credits(mca_btl_openib_endpoint_t* endpoint,
const int qp)
{
@ -745,29 +745,29 @@ static int mca_btl_openib_endpoint_send_eager_rdma(
rdma_hdr->control.type = MCA_BTL_OPENIB_CONTROL_RDMA;
rdma_hdr->rkey = endpoint->eager_rdma_local.reg->mr->rkey;
rdma_hdr->rdma_start.lval = ompi_ptr_ptol(endpoint->eager_rdma_local.base.pval);
BTL_VERBOSE(("sending rkey %lu, rdma_start.lval %llu, pval %p, ival %u type %d and sizeof(rdma_hdr) %d\n",
rdma_hdr->rkey,
rdma_hdr->rdma_start.lval,
BTL_VERBOSE(("sending rkey %lu, rdma_start.lval %llu, pval %p, ival %u type %d and sizeof(rdma_hdr) %d\n",
rdma_hdr->rkey,
rdma_hdr->rdma_start.lval,
rdma_hdr->rdma_start.pval,
rdma_hdr->rdma_start.ival,
rdma_hdr->control.type,
rdma_hdr->control.type,
sizeof(mca_btl_openib_eager_rdma_header_t)
));
if(endpoint->nbo) {
BTL_OPENIB_EAGER_RDMA_CONTROL_HEADER_HTON((*rdma_hdr));
BTL_VERBOSE(("after HTON: sending rkey %lu, rdma_start.lval %llu, pval %p, ival %u\n",
rdma_hdr->rkey,
BTL_VERBOSE(("after HTON: sending rkey %lu, rdma_start.lval %llu, pval %p, ival %u\n",
rdma_hdr->rkey,
rdma_hdr->rdma_start.lval,
rdma_hdr->rdma_start.pval,
rdma_hdr->rdma_start.ival
));
}
rc = mca_btl_openib_endpoint_send(endpoint, frag);
rc = mca_btl_openib_endpoint_send(endpoint, frag);
if (OMPI_SUCCESS == rc ||OMPI_ERR_RESOURCE_BUSY == rc)
return OMPI_SUCCESS;
MCA_BTL_IB_FRAG_RETURN(frag);
BTL_ERROR(("Error sending RDMA buffer", strerror(errno)));
return rc;
@ -821,15 +821,15 @@ void mca_btl_openib_endpoint_connect_eager_rdma(
init_data.order = MCA_BTL_NO_ORDER;
init_data.list = NULL;
mca_btl_openib_frag_init(item, &init_data);
mca_btl_openib_frag_init(item, &init_data);
frag = to_recv_frag(item);
to_base_frag(frag)->type = MCA_BTL_OPENIB_FRAG_EAGER_RDMA;
to_com_frag(frag)->endpoint = endpoint;
frag->ftr = (mca_btl_openib_footer_t*)
((char*)to_base_frag(frag)->segment.seg_addr.pval +
mca_btl_openib_component.eager_limit);
MCA_BTL_OPENIB_RDMA_MAKE_REMOTE(frag->ftr);
}
@ -867,7 +867,7 @@ free_headers_buf:
free(headers_buf);
unlock_rdma_local:
/* set local rdma pointer back to zero. Will retry later */
opal_atomic_cmpset_ptr(&endpoint->eager_rdma_local.base.pval,
opal_atomic_cmpset_ptr(&endpoint->eager_rdma_local.base.pval,
endpoint->eager_rdma_local.base.pval, NULL);
endpoint->eager_rdma_local.frags = NULL;
}

Просмотреть файл

@ -5,19 +5,19 @@
* Copyright (c) 2004-2006 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* 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.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
* reserved.
* reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* Copyright (c) 2007 Mellanox Technologies. All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -31,8 +31,8 @@
#include "btl_openib.h"
#include "btl_openib_frag.h"
#include "btl_openib_eager_rdma.h"
#include <errno.h>
#include <string.h>
#include <errno.h>
#include <string.h>
#include "ompi/mca/btl/base/btl_base_error.h"
#include "connect/base.h"
@ -53,8 +53,8 @@ typedef enum {
MCA_BTL_IB_CONNECT_ACK,
/*Waiting for final connection ACK from endpoint */
MCA_BTL_IB_WAITING_ACK,
MCA_BTL_IB_WAITING_ACK,
/* Connected ... both sender & receiver have
* buffers associated with this connection */
MCA_BTL_IB_CONNECTED,
@ -68,23 +68,23 @@ typedef enum {
MCA_BTL_IB_FAILED
} mca_btl_openib_endpoint_state_t;
struct mca_btl_openib_rem_qp_info_t {
uint32_t rem_qp_num;
/* Remote QP number */
uint32_t rem_psn;
/* Remote processes port sequence number */
}; typedef struct mca_btl_openib_rem_qp_info_t mca_btl_openib_rem_qp_info_t;
struct mca_btl_openib_rem_qp_info_t {
uint32_t rem_qp_num;
/* Remote QP number */
uint32_t rem_psn;
/* Remote processes port sequence number */
}; typedef struct mca_btl_openib_rem_qp_info_t mca_btl_openib_rem_qp_info_t;
struct mca_btl_openib_rem_srq_info_t {
/* Remote SRQ number */
uint32_t rem_srq_num;
}; typedef struct mca_btl_openib_rem_srq_info_t mca_btl_openib_rem_srq_info_t;
struct mca_btl_openib_rem_info_t {
struct mca_btl_openib_rem_info_t {
uint16_t rem_lid;
/* Local identifier of the remote process */
uint64_t rem_subnet_id;
/* subnet id of remote process */
uint64_t rem_subnet_id;
/* subnet id of remote process */
uint32_t rem_mtu;
/* MTU of remote process */
uint32_t rem_index;
@ -92,18 +92,18 @@ struct mca_btl_openib_rem_info_t {
mca_btl_openib_rem_qp_info_t *rem_qps;
/* remote xrc_srq info , used only with xrc connections */
mca_btl_openib_rem_srq_info_t *rem_srqs;
}; typedef struct mca_btl_openib_rem_info_t mca_btl_openib_rem_info_t;
}; typedef struct mca_btl_openib_rem_info_t mca_btl_openib_rem_info_t;
/**
* Agggregates all per peer qp info for an endpoint
* Agggregates all per peer qp info for an endpoint
*/
struct mca_btl_openib_endpoint_pp_qp_t {
int32_t sd_credits; /**< this rank's view of the credits
* available for sending:
* this is the credits granted by the
* remote peer which has some relation to the
* number of receive buffers posted remotely
struct mca_btl_openib_endpoint_pp_qp_t {
int32_t sd_credits; /**< this rank's view of the credits
* available for sending:
* this is the credits granted by the
* remote peer which has some relation to the
* number of receive buffers posted remotely
*/
int32_t rd_posted; /**< number of descriptors posted to the nic*/
int32_t rd_credits; /**< number of credits to return to peer */
@ -114,9 +114,9 @@ struct mca_btl_openib_endpoint_pp_qp_t {
/**
* Aggregates all srq qp info for an endpoint
* Aggregates all srq qp info for an endpoint
*/
struct mca_btl_openib_endpoint_srq_qp_t {
struct mca_btl_openib_endpoint_srq_qp_t {
int32_t dummy;
}; typedef struct mca_btl_openib_endpoint_srq_qp_t mca_btl_openib_endpoint_srq_qp_t;
@ -169,26 +169,26 @@ struct mca_btl_base_endpoint_t {
opal_mutex_t endpoint_lock;
/**< lock for concurrent access to endpoint state */
opal_list_t pending_lazy_frags;
/**< list of pending frags due to lazy connection establishment
* for this endpotint
/**< list of pending frags due to lazy connection establishment
* for this endpotint
*/
mca_btl_openib_endpoint_qp_t *qps;
struct ibv_qp *xrc_recv_qp; /* in xrc we will use it as recv qp */
uint32_t xrc_recv_psn;
uint32_t xrc_recv_psn;
opal_list_t pending_get_frags; /**< list of pending rget ops */
opal_list_t pending_put_frags; /**< list of pending rput ops */
/* Local processes port sequence number (Low and High) */
int32_t get_tokens; /**< number of available get tokens */
@ -202,12 +202,12 @@ struct mca_btl_base_endpoint_t {
mca_btl_openib_eager_rdma_local_t eager_rdma_local;
/**< info about local RDMA buffer */
uint32_t index; /**< index of the endpoint in endpoints array */
/**< frags for sending explicit high priority credits */
bool nbo; /**< does the endpoint require network byte ordering? */
bool use_eager_rdma; /**< use eager rdma for this peer? */
mca_btl_openib_rem_info_t rem_info;
mca_btl_openib_rem_info_t rem_info;
};
typedef struct mca_btl_base_endpoint_t mca_btl_base_endpoint_t;
@ -242,7 +242,7 @@ static inline int post_recvs(mca_btl_base_endpoint_t *ep, const int qp,
int i;
struct ibv_recv_wr *bad_wr, *wr_list = NULL, *wr = NULL;
mca_btl_openib_module_t *openib_btl = ep->endpoint_btl;
if(0 == num_post)
return OMPI_SUCCESS;
@ -275,7 +275,7 @@ static inline int mca_btl_openib_endpoint_post_rr_nolock(
int rd_low = mca_btl_openib_component.qp_infos[qp].rd_low;
int cqp = mca_btl_openib_component.credits_qp, rc;
int cm_received = 0, num_post = 0;
assert(BTL_OPENIB_QP_TYPE_PP(qp));
if(ep->qps[qp].u.pp_qp.rd_posted <= rd_low)
@ -350,7 +350,7 @@ static inline void send_credits(mca_btl_openib_endpoint_t *ep, int qp)
if(!check_eager_rdma_credits(ep))
return;
try_send:
if(BTL_OPENIB_CREDITS_SEND_TRYLOCK(ep, qp))
mca_btl_openib_endpoint_send_credits(ep, qp);

Просмотреть файл

@ -5,22 +5,22 @@
* 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,
* 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.
* Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
* reserved.
* reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
#include "btl_openib.h"
#include "btl_openib_frag.h"
#include "btl_openib_frag.h"
#include "btl_openib_eager_rdma.h"
void mca_btl_openib_frag_init(ompi_free_list_item_t* item, void* ctx)
@ -159,10 +159,10 @@ static void coalesced_constructor(mca_btl_openib_coalesced_frag_t *frag)
}
OBJ_CLASS_INSTANCE(
mca_btl_openib_frag_t,
mca_btl_base_descriptor_t,
base_constructor,
NULL);
mca_btl_openib_frag_t,
mca_btl_base_descriptor_t,
base_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_openib_com_frag_t,
@ -201,19 +201,19 @@ OBJ_CLASS_INSTANCE(
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_openib_put_frag_t,
mca_btl_openib_put_frag_t,
mca_btl_openib_out_frag_t,
put_constructor,
NULL);
put_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_openib_get_frag_t,
mca_btl_openib_get_frag_t,
mca_btl_openib_in_frag_t,
get_constructor,
NULL);
get_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_openib_coalesced_frag_t,
mca_btl_openib_coalesced_frag_t,
mca_btl_openib_frag_t,
coalesced_constructor,
NULL);
coalesced_constructor,
NULL);

Просмотреть файл

@ -5,17 +5,17 @@
* Copyright (c) 2004-2006 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* 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.
* Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
* reserved.
* reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -24,7 +24,7 @@
#include "ompi_config.h"
#include <infiniband/verbs.h>
#include <infiniband/verbs.h>
#include "ompi/mca/btl/btl.h"
#if defined(c_plusplus) || defined(__cplusplus)
@ -84,7 +84,7 @@ typedef struct mca_btl_openib_footer_t mca_btl_openib_footer_t;
#ifdef WORDS_BIGENDIAN
#define MCA_BTL_OPENIB_FTR_SIZE_REVERSE(ftr)
#else
#else
#define MCA_BTL_OPENIB_FTR_SIZE_REVERSE(ftr) \
do { \
uint8_t tmp = (ftr).u.buf[0]; \
@ -106,7 +106,7 @@ typedef struct mca_btl_openib_footer_t mca_btl_openib_footer_t;
BTL_OPENIB_FOOTER_SEQ_HTON(h); \
MCA_BTL_OPENIB_FTR_SIZE_REVERSE(h); \
} while (0)
#define BTL_OPENIB_FOOTER_NTOH(h) \
do { \
BTL_OPENIB_FOOTER_SEQ_NTOH(h); \
@ -124,7 +124,7 @@ typedef struct mca_btl_openib_control_header_t mca_btl_openib_control_header_t;
struct mca_btl_openib_eager_rdma_header_t {
mca_btl_openib_control_header_t control;
uint8_t padding[3];
uint8_t padding[3];
uint32_t rkey;
ompi_ptr_t rdma_start;
};
@ -135,14 +135,14 @@ typedef struct mca_btl_openib_eager_rdma_header_t mca_btl_openib_eager_rdma_head
(h).rkey = htonl((h).rkey); \
(h).rdma_start.lval = hton64((h).rdma_start.lval); \
} while (0)
#define BTL_OPENIB_EAGER_RDMA_CONTROL_HEADER_NTOH(h) \
do { \
(h).rkey = ntohl((h).rkey); \
(h).rdma_start.lval = ntoh64((h).rdma_start.lval); \
} while (0)
struct mca_btl_openib_rdma_credits_header_t {
mca_btl_openib_control_header_t control;
uint8_t qpn;
@ -178,9 +178,9 @@ typedef enum mca_btl_openib_frag_type_t mca_btl_openib_frag_type_t;
/* base openib frag */
typedef struct mca_btl_openib_frag_t {
mca_btl_base_descriptor_t base;
mca_btl_base_segment_t segment;
mca_btl_openib_frag_type_t type;
mca_btl_base_descriptor_t base;
mca_btl_base_segment_t segment;
mca_btl_openib_frag_type_t type;
ompi_free_list_t* list;
} mca_btl_openib_frag_t;
OBJ_CLASS_DECLARATION(mca_btl_openib_frag_t);
@ -192,7 +192,7 @@ typedef struct mca_btl_openib_com_frag_t {
mca_btl_openib_frag_t super;
struct ibv_sge sg_entry;
struct mca_btl_openib_reg_t *registration;
struct mca_btl_base_endpoint_t *endpoint;
struct mca_btl_base_endpoint_t *endpoint;
} mca_btl_openib_com_frag_t;
OBJ_CLASS_DECLARATION(mca_btl_openib_com_frag_t);
@ -200,7 +200,7 @@ OBJ_CLASS_DECLARATION(mca_btl_openib_com_frag_t);
typedef struct mca_btl_openib_out_frag_t {
mca_btl_openib_com_frag_t super;
struct ibv_send_wr sr_desc;
struct ibv_send_wr sr_desc;
} mca_btl_openib_out_frag_t;
OBJ_CLASS_DECLARATION(mca_btl_openib_out_frag_t);
@ -234,21 +234,21 @@ OBJ_CLASS_DECLARATION(mca_btl_openib_recv_frag_t);
#define to_recv_frag(f) ((mca_btl_openib_recv_frag_t*)(f))
typedef struct mca_btl_openib_out_frag_t mca_btl_openib_put_frag_t;
typedef struct mca_btl_openib_out_frag_t mca_btl_openib_put_frag_t;
OBJ_CLASS_DECLARATION(mca_btl_openib_put_frag_t);
#define to_put_frag(f) ((mca_btl_openib_put_frag_t*)(f))
typedef struct mca_btl_openib_get_frag_t {
mca_btl_openib_in_frag_t super;
struct ibv_send_wr sr_desc;
struct ibv_send_wr sr_desc;
} mca_btl_openib_get_frag_t;
OBJ_CLASS_DECLARATION(mca_btl_openib_get_frag_t);
OBJ_CLASS_DECLARATION(mca_btl_openib_get_frag_t);
#define to_get_frag(f) ((mca_btl_openib_get_frag_t*)(f))
typedef struct mca_btl_openib_send_frag_t mca_btl_openib_send_control_frag_t;
OBJ_CLASS_DECLARATION(mca_btl_openib_send_control_frag_t);
typedef struct mca_btl_openib_send_frag_t mca_btl_openib_send_control_frag_t;
OBJ_CLASS_DECLARATION(mca_btl_openib_send_control_frag_t);
#define to_send_control_frag(f) ((mca_btl_openib_send_control_frag_t*)(f))

Просмотреть файл

@ -5,15 +5,15 @@
* 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,
* 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.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -47,7 +47,7 @@ typedef struct parsed_section_values_t {
uint32_t *vendor_ids;
int vendor_ids_len;
uint32_t *vendor_part_ids;
int vendor_part_ids_len;
@ -162,14 +162,14 @@ int ompi_btl_openib_ini_query(uint32_t vendor_id, uint32_t vendor_part_id,
}
if (mca_btl_openib_component.verbose) {
BTL_OUTPUT(("Querying INI files for vendor 0x%04x, part ID %d",
BTL_OUTPUT(("Querying INI files for vendor 0x%04x, part ID %d",
vendor_id, vendor_part_id));
}
reset_values(values);
/* Iterate over all the saved hcas */
for (item = opal_list_get_first(&hcas);
for (item = opal_list_get_first(&hcas);
item != opal_list_get_end(&hcas);
item = opal_list_get_next(item)) {
h = (hca_values_t*) item;
@ -364,7 +364,7 @@ static int parse_line(parsed_section_values_t *sv)
all whitespace at the beginning and ending of the value. */
if (0 == strcasecmp(key_buffer, "vendor_id")) {
if (OMPI_SUCCESS != (ret = intify_list(value, &sv->vendor_ids,
if (OMPI_SUCCESS != (ret = intify_list(value, &sv->vendor_ids,
&sv->vendor_ids_len))) {
return ret;
}
@ -393,7 +393,7 @@ static int parse_line(parsed_section_values_t *sv)
/* Have no idea what this parameter is. Not an error -- just
ignore it */
if (!showed_unknown_field_warning) {
opal_show_help("help-mpi-btl-openib.txt",
opal_show_help("help-mpi-btl-openib.txt",
"ini file:unknown field", true,
ini_filename, btl_openib_ini_yynewlines,
key_buffer);
@ -487,7 +487,7 @@ static int save_section(parsed_section_values_t *s)
bool found;
/* Is the parsed section valid? */
if (NULL == s->name || 0 == s->vendor_ids_len ||
if (NULL == s->name || 0 == s->vendor_ids_len ||
0 == s->vendor_part_ids_len) {
return OMPI_ERR_BAD_PARAM;
}
@ -499,7 +499,7 @@ static int save_section(parsed_section_values_t *s)
found = false;
/* Iterate over all the saved hcas */
for (item = opal_list_get_first(&hcas);
for (item = opal_list_get_first(&hcas);
item != opal_list_get_end(&hcas);
item = opal_list_get_next(item)) {
h = (hca_values_t*) item;
@ -515,7 +515,7 @@ static int save_section(parsed_section_values_t *s)
h->values.use_eager_rdma = s->values.use_eager_rdma;
h->values.use_eager_rdma_set = true;
}
found = true;
break;
}
@ -574,7 +574,7 @@ static int intify_list(char *value, uint32_t **values, int *len)
char *str = value;
*len = 0;
/* Comma-delimited list of values */
comma = strchr(str, ',');
if (NULL == comma) {

Просмотреть файл

@ -1,9 +1,9 @@
/*
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*
* @file

Просмотреть файл

@ -6,15 +6,15 @@
* 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,
* 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.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/

Просмотреть файл

@ -5,19 +5,19 @@
* 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,
* 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.
* Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2007 Mellanox Technologies. All rights reserved.
* Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
* reserved.
* reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -64,7 +64,7 @@ static inline int reg_string(const char* param_name, const char* param_desc,
int flags)
{
char *value;
mca_base_param_reg_string(&mca_btl_openib_component.super.btl_version,
mca_base_param_reg_string(&mca_btl_openib_component.super.btl_version,
param_name, param_desc, false, false,
default_value, &value);
@ -85,7 +85,7 @@ static inline int reg_int(const char* param_name, const char* param_desc,
int default_value, int *out_value, int flags)
{
int value;
mca_base_param_reg_int(&mca_btl_openib_component.super.btl_version,
mca_base_param_reg_int(&mca_btl_openib_component.super.btl_version,
param_name, param_desc, false, false,
default_value, &value);
@ -108,7 +108,7 @@ static inline int reg_int(const char* param_name, const char* param_desc,
/*
* Register and check all MCA parameters
*/
int btl_openib_register_mca_params(void)
int btl_openib_register_mca_params(void)
{
char *msg, *str;
int ival, ival2, ret, tmp;
@ -120,19 +120,19 @@ int btl_openib_register_mca_params(void)
} while (0)
/* register IB component parameters */
CHECK(reg_int("verbose",
CHECK(reg_int("verbose",
"Output some verbose OpenIB BTL information "
"(0 = no output, nonzero = output)", 0, &ival, 0));
mca_btl_openib_component.verbose = (0 != ival);
CHECK(reg_int("warn_no_hca_params_found",
CHECK(reg_int("warn_no_hca_params_found",
"Warn when no HCA-specific parameters are found in the INI file specified by the btl_openib_hca_param_files MCA parameter (0 = do not warn; any other value = warn)",
1, &ival, 0));
mca_btl_openib_component.warn_no_hca_params_found = (0 != ival);
CHECK(reg_int("warn_default_gid_prefix",
CHECK(reg_int("warn_default_gid_prefix",
"Warn when there is more than one active ports and at least one of them connected to the network with only default GID prefix configured (0 = do not warn; any other value = warn)",
1, &ival, 0));
mca_btl_openib_component.warn_default_gid_prefix = (0 != ival);
CHECK(reg_int("warn_nonexistent_if",
CHECK(reg_int("warn_nonexistent_if",
"Warn if non-existent HCAs and/or ports are specified in the btl_openib_if_[in|ex]clude MCA parameters (0 = do not warn; any other value = warn)",
1, &ival, 0));
mca_btl_openib_component.warn_nonexistent_if = (0 != ival);
@ -142,9 +142,9 @@ int btl_openib_register_mca_params(void)
#else
ival2 = 0;
#endif
CHECK(reg_int("want_fork_support",
CHECK(reg_int("want_fork_support",
"Whether fork support is desired or not "
"(negative = try to enable fork support, but continue even if it is not available, 0 = do not enable fork support, positive = try to enable fork support and fail if it is not available)",
"(negative = try to enable fork support, but continue even if it is not available, 0 = do not enable fork support, positive = try to enable fork support and fail if it is not available)",
ival2, &ival, 0));
#ifdef HAVE_IBV_FORK_INIT
mca_btl_openib_component.want_fork_support = ival;
@ -157,7 +157,7 @@ int btl_openib_register_mca_params(void)
}
#endif
asprintf(&str, "%s/mca-btl-openib-hca-params.ini",
asprintf(&str, "%s/mca-btl-openib-hca-params.ini",
opal_install_dirs.pkgdatadir);
if (NULL == str) {
return OMPI_ERR_OUT_OF_RESOURCE;
@ -167,9 +167,9 @@ int btl_openib_register_mca_params(void)
#else
ival2 = 0;
#endif
CHECK(reg_int("want_fork_support",
CHECK(reg_int("want_fork_support",
"Whether fork support is desired or not "
"(negative = try to enable fork support, but continue even if it is not available, 0 = do not enable fork support, positive = try to enable fork support and fail if it is not available)",
"(negative = try to enable fork support, but continue even if it is not available, 0 = do not enable fork support, positive = try to enable fork support and fail if it is not available)",
ival2, &ival, 0));
#ifdef HAVE_IBV_FORK_INIT
mca_btl_openib_component.want_fork_support = ival;
@ -186,14 +186,14 @@ int btl_openib_register_mca_params(void)
"Colon-delimited list of INI-style files that contain HCA vendor/part-specific parameters",
str, &mca_btl_openib_component.hca_params_file_names, 0));
free(str);
CHECK(reg_int("max_btls",
CHECK(reg_int("max_btls",
"Maximum number of HCA ports to use "
"(-1 = use all available, otherwise must be >= 1)",
-1, &mca_btl_openib_component.ib_max_btls,
REGINT_NEG_ONE_OK | REGINT_GE_ONE));
CHECK(reg_int("free_list_num",
"Intial size of free lists (must be >= 1)",
CHECK(reg_int("free_list_num",
"Intial size of free lists (must be >= 1)",
8, &mca_btl_openib_component.ib_free_list_num,
REGINT_GE_ONE));
CHECK(reg_int("free_list_max",
@ -201,29 +201,29 @@ int btl_openib_register_mca_params(void)
"(-1 = infinite, otherwise must be >= 0)",
-1, &mca_btl_openib_component.ib_free_list_max,
REGINT_NEG_ONE_OK | REGINT_GE_ONE));
CHECK(reg_int("free_list_inc",
CHECK(reg_int("free_list_inc",
"Increment size of free lists (must be >= 1)",
32, &mca_btl_openib_component.ib_free_list_inc,
REGINT_GE_ONE));
CHECK(reg_string("mpool",
"Name of the memory pool to be used (it is unlikely that you will ever want to change this",
"Name of the memory pool to be used (it is unlikely that you will ever want to change this",
"rdma", &mca_btl_openib_component.ib_mpool_name,
0));
CHECK(reg_int("reg_mru_len",
CHECK(reg_int("reg_mru_len",
"Length of the registration cache most recently used list "
"(must be >= 1)",
"(must be >= 1)",
16, (int*) &mca_btl_openib_component.reg_mru_len,
REGINT_GE_ONE));
CHECK(reg_int("ib_cq_size", "Size of the IB completion "
REGINT_GE_ONE));
CHECK(reg_int("ib_cq_size", "Size of the IB completion "
"queue (will automatically be set to a minimum of "
"(2 * number_of_peers * btl_openib_rd_num))",
1000, &ival, REGINT_GE_ONE));
mca_btl_openib_component.ib_cq_size[BTL_OPENIB_LP_CQ] =
mca_btl_openib_component.ib_cq_size[BTL_OPENIB_HP_CQ] = (uint32_t) ival;
CHECK(reg_int("ib_sg_list_size", "Size of IB segment list "
"(must be >= 1)",
"(must be >= 1)",
4, &ival, REGINT_GE_ONE));
mca_btl_openib_component.ib_sg_list_size = (uint32_t) ival;
@ -244,7 +244,7 @@ int btl_openib_register_mca_params(void)
}
CHECK(reg_int("ib_psn", "InfiniBand packet sequence starting number "
"(must be >= 0)",
"(must be >= 0)",
0, &ival, REGINT_GE_ZERO));
mca_btl_openib_component.ib_psn = (uint32_t) ival;
@ -252,7 +252,7 @@ int btl_openib_register_mca_params(void)
"(must be >= 0)",
4, &ival, REGINT_GE_ZERO));
mca_btl_openib_component.ib_qp_ous_rd_atom = (uint32_t) ival;
asprintf(&msg, "IB MTU, in bytes (if not specified in INI files). Valid values are: %d=256 bytes, %d=512 bytes, %d=1024 bytes, %d=2048 bytes, %d=4096 bytes",
IBV_MTU_256,
IBV_MTU_512,
@ -325,7 +325,7 @@ int btl_openib_register_mca_params(void)
CHECK(reg_int("ib_rnr_retry", "InfiniBand \"receiver not ready\" "
"retry count "
"(must be >= 0 and <= 7)",
"(must be >= 0 and <= 7)",
7, &ival, 0));
if (ival > 7) {
opal_show_help("help-mpi-btl-openib.txt", "invalid mca param value",
@ -347,7 +347,7 @@ int btl_openib_register_mca_params(void)
mca_btl_openib_component.ib_max_rdma_dst_ops = (uint32_t) ival;
CHECK(reg_int("ib_service_level", "InfiniBand service level "
"(must be >= 0 and <= 15)",
"(must be >= 0 and <= 15)",
0, &ival, 0));
if (ival > 15) {
opal_show_help("help-mpi-btl-openib.txt", "invalid mca param value",
@ -370,10 +370,10 @@ int btl_openib_register_mca_params(void)
mca_btl_openib_component.use_eager_rdma = 0;
#endif
CHECK(reg_int("eager_rdma_threshold",
CHECK(reg_int("eager_rdma_threshold",
"Use RDMA for short messages after this number of "
"messages are received from a given peer "
"(must be >= 1)",
"(must be >= 1)",
16, &ival, REGINT_GE_ONE));
mca_btl_openib_component.eager_rdma_threshold = (int32_t) ival;
@ -403,13 +403,13 @@ int btl_openib_register_mca_params(void)
mca_btl_openib_component.max_lmc = (uint32_t) ival;
#if OMPI_HAVE_THREADS
CHECK(reg_int("use_async_event_thread",
CHECK(reg_int("use_async_event_thread",
"If nonzero, use the thread that will handle InfiniBand asyncihronous events ",
1, &ival, 0));
mca_btl_openib_component.use_async_event_thread = (0 != ival);
#endif
CHECK(reg_int("buffer_alignment",
CHECK(reg_int("buffer_alignment",
"Prefered communication buffer alignment, in bytes "
"(must be > 0 and power of two)",
64, &ival, REGINT_GE_ZERO));
@ -420,28 +420,28 @@ int btl_openib_register_mca_params(void)
} else {
mca_btl_openib_component.buffer_alignment = (uint32_t) ival;
}
CHECK(reg_int("use_message_coalescing",
CHECK(reg_int("use_message_coalescing",
"Use message coalescing", 1, &ival, 0));
mca_btl_openib_component.use_message_coalescing = (0 != ival);
CHECK(reg_int("cq_poll_ratio",
CHECK(reg_int("cq_poll_ratio",
"how often poll high priority CQ versus low priority CQ",
100, &ival, REGINT_GE_ONE));
mca_btl_openib_component.cq_poll_ratio = (uint32_t)ival;
CHECK(reg_int("eager_rdma_poll_ratio",
CHECK(reg_int("eager_rdma_poll_ratio",
"how often poll eager RDMA channel versus CQ",
100, &ival, REGINT_GE_ONE));
mca_btl_openib_component.eager_rdma_poll_ratio = (uint32_t)ival;
CHECK(reg_int("hp_cq_poll_per_progress",
CHECK(reg_int("hp_cq_poll_per_progress",
"max number of completion events to process for each call "
"of BTL progress engine",
10, &ival, REGINT_GE_ONE));
mca_btl_openib_component.cq_poll_progress = (uint32_t)ival;
/* Info only */
mca_base_param_reg_int(&mca_btl_openib_component.super.btl_version,
"have_fork_support",
mca_base_param_reg_int(&mca_btl_openib_component.super.btl_version,
"have_fork_support",
"Whether the OpenFabrics stack supports applications that invoke the \"fork()\" system call or not (0 = no, 1 = yes). Note that this value does NOT indicate whether the system being run on supports \"fork()\" with OpenFabrics applications or not.",
false, true,
#ifdef HAVE_IBV_FORK_INIT
@ -452,12 +452,12 @@ int btl_openib_register_mca_params(void)
NULL);
mca_btl_openib_module.super.btl_exclusivity = MCA_BTL_EXCLUSIVITY_DEFAULT;
mca_btl_openib_module.super.btl_eager_limit = 12 * 1024;
mca_btl_openib_module.super.btl_rndv_eager_limit = 12 * 1024;
mca_btl_openib_module.super.btl_max_send_size = 64 * 1024;
mca_btl_openib_module.super.btl_rdma_pipeline_send_length = 1024 * 1024;
mca_btl_openib_module.super.btl_rdma_pipeline_frag_size = 1024 * 1024;
mca_btl_openib_module.super.btl_rdma_pipeline_frag_size = 1024 * 1024;
mca_btl_openib_module.super.btl_min_rdma_pipeline_size = 256 * 1024;
mca_btl_openib_module.super.btl_flags = MCA_BTL_FLAGS_RDMA |
MCA_BTL_FLAGS_NEED_ACK | MCA_BTL_FLAGS_NEED_CSUM | MCA_BTL_FLAGS_HETEROGENEOUS_RDMA;
@ -473,12 +473,12 @@ int btl_openib_register_mca_params(void)
CHECK(reg_string("if_include",
"Comma-delimited list of HCAs/ports to be used (e.g. \"mthca0,mthca1:2\"; empty value means to use all ports found). Mutually exclusive with btl_openib_if_exclude.",
NULL, &mca_btl_openib_component.if_include,
0));
0));
CHECK(reg_string("if_exclude",
"Comma-delimited list of HCAs/ports to be excluded (empty value means to not exclude any ports). Mutually exclusive with btl_openib_if_include.",
NULL, &mca_btl_openib_component.if_exclude,
0));
0));
return ret;
}
@ -491,8 +491,8 @@ static int32_t atoi_param(char *param, int32_t dflt)
return atoi(param);
}
static int mca_btl_openib_mca_setup_qps(void)
{
static int mca_btl_openib_mca_setup_qps(void)
{
/* All the multi-qp stuff.. */
char *str;
char **queues, **params = NULL;
@ -533,11 +533,11 @@ static int mca_btl_openib_mca_setup_qps(void)
}
while (queues[qp] != NULL) {
if (0 == strncmp("P,", queues[qp], 2)) {
if (0 == strncmp("P,", queues[qp], 2)) {
num_pp_qps++;
if(smallest_pp_qp > qp)
smallest_pp_qp = qp;
} else if (0 == strncmp("S,", queues[qp], 2)) {
} else if (0 == strncmp("S,", queues[qp], 2)) {
num_srq_qps++;
} else if (0 == strncmp("X,", queues[qp], 2)) {
#if HAVE_XRC
@ -549,7 +549,7 @@ static int mca_btl_openib_mca_setup_qps(void)
#endif
} else {
opal_show_help("help-mpi-btl-openib.txt",
"invalid qp type in receive_queues", true,
"invalid qp type in receive_queues", true,
orte_system_info.nodename, str, queues[qp]);
goto error;
}
@ -576,10 +576,10 @@ static int mca_btl_openib_mca_setup_qps(void)
mca_btl_openib_component.qp_infos = (mca_btl_openib_qp_info_t*)
malloc(sizeof(mca_btl_openib_qp_info_t) *
mca_btl_openib_component.num_qps);
qp = 0;
#define P(N) (((N) > count)?NULL:params[(N)])
while(queues[qp] != NULL) {
while(queues[qp] != NULL) {
int i = 0, count;
int32_t rd_low, rd_num;
params = opal_argv_split_with_empty(queues[qp], ',');
@ -601,9 +601,9 @@ static int mca_btl_openib_mca_setup_qps(void)
rd_win = atoi_param(P(4), (rd_num - rd_low) * 2);
rd_rsv = atoi_param(P(5), (rd_num * 2) / rd_win);
BTL_VERBOSE(("pp: rd_num is %d rd_low is %d rd_win %d rd_rsv %d\n",
BTL_VERBOSE(("pp: rd_num is %d rd_low is %d rd_win %d rd_rsv %d\n",
rd_num, rd_low, rd_win, rd_rsv));
/* Calculate the smallest freelist size that can be allowed */
if (rd_num + rd_rsv > min_freelist_size)
min_freelist_size = rd_num + rd_rsv;
@ -628,7 +628,7 @@ static int mca_btl_openib_mca_setup_qps(void)
/* by default set rd_low to be 3/4 of rd_num */
rd_low = atoi_param(P(3), rd_num - (rd_num / 4));
sd_max = atoi_param(P(4), rd_low / 4);
BTL_VERBOSE(("srq: rd_num is %d rd_low is %d sd_max is %d\n",
BTL_VERBOSE(("srq: rd_num is %d rd_low is %d sd_max is %d\n",
rd_num, rd_low, sd_max));
/* Calculate the smallest freelist size that can be allowed */
@ -652,7 +652,7 @@ static int mca_btl_openib_mca_setup_qps(void)
qp++;
}
params = NULL;
/* Sanity check some sizes */
max_qp_size = mca_btl_openib_component.qp_infos[mca_btl_openib_component.num_qps - 1].size;
@ -663,14 +663,14 @@ static int mca_btl_openib_mca_setup_qps(void)
if (max_qp_size < max_size_needed) {
opal_show_help("help-mpi-btl-openib.txt",
"biggest qp size is too small", true,
orte_system_info.nodename, max_qp_size,
orte_system_info.nodename, max_qp_size,
max_size_needed);
ret = OMPI_ERROR;
goto error;
} else if (max_qp_size > max_size_needed) {
opal_show_help("help-mpi-btl-openib.txt",
"biggest qp size is too big", true,
orte_system_info.nodename, max_qp_size,
orte_system_info.nodename, max_qp_size,
max_size_needed);
opal_output(0, "The biggest QP size is bigger than maximum send size. "
"This is not optimal configuration as memory will be waisted.\n");
@ -679,12 +679,12 @@ static int mca_btl_openib_mca_setup_qps(void)
if (mca_btl_openib_component.ib_free_list_max > 0 &&
min_freelist_size > mca_btl_openib_component.ib_free_list_max) {
opal_show_help("help-mpi-btl-openib.txt", "freelist too small", true,
orte_system_info.nodename,
orte_system_info.nodename,
mca_btl_openib_component.ib_free_list_max,
min_freelist_size);
goto error;
}
mca_btl_openib_component.rdma_qp = mca_btl_openib_component.num_qps - 1;
mca_btl_openib_component.credits_qp = smallest_pp_qp;

Просмотреть файл

@ -1,9 +1,9 @@
/*
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -15,7 +15,7 @@ extern "C" {
#endif
/**
* Function to register MCA params and check for sane values
* Function to register MCA params and check for sane values
*/
int btl_openib_register_mca_params(void);

Просмотреть файл

@ -5,16 +5,16 @@
* 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,
* 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.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -30,8 +30,8 @@
static void mca_btl_openib_proc_construct(mca_btl_openib_proc_t* proc);
static void mca_btl_openib_proc_destruct(mca_btl_openib_proc_t* proc);
OBJ_CLASS_INSTANCE(mca_btl_openib_proc_t,
opal_list_item_t, mca_btl_openib_proc_construct,
OBJ_CLASS_INSTANCE(mca_btl_openib_proc_t,
opal_list_item_t, mca_btl_openib_proc_construct,
mca_btl_openib_proc_destruct);
void mca_btl_openib_proc_construct(mca_btl_openib_proc_t* proc)
@ -92,7 +92,7 @@ static mca_btl_openib_proc_t* mca_btl_openib_proc_lookup_ompi(ompi_proc_t* ompi_
/*
* Create a IB process structure. There is a one-to-one correspondence
* between a ompi_proc_t and a mca_btl_openib_proc_t instance. We cache
* additional data (specifically the list of mca_btl_openib_endpoint_t instances,
* additional data (specifically the list of mca_btl_openib_endpoint_t instances,
* and published addresses) associated w/ a given destination on this
* datastructure.
*/
@ -108,7 +108,7 @@ mca_btl_openib_proc_t* mca_btl_openib_proc_create(ompi_proc_t* ompi_proc)
int rc;
void *message;
char *offset;
/* Check if we have already created a IB proc
* structure for this ompi process */
module_proc = mca_btl_openib_proc_lookup_ompi(ompi_proc);
@ -128,11 +128,11 @@ mca_btl_openib_proc_t* mca_btl_openib_proc_create(ompi_proc_t* ompi_proc)
* size) to represent the proc */
module_proc->proc_guid = ompi_proc->proc_name;
/* query for the peer address info */
rc = ompi_modex_recv(&mca_btl_openib_component.super.btl_version,
/* query for the peer address info */
rc = ompi_modex_recv(&mca_btl_openib_component.super.btl_version,
ompi_proc,
&message,
&msg_size);
&msg_size);
if (OMPI_SUCCESS != rc) {
BTL_ERROR(("[%s:%d] ompi_modex_recv failed for peer %s",
__FILE__, __LINE__,
@ -158,7 +158,7 @@ mca_btl_openib_proc_t* mca_btl_openib_proc_create(ompi_proc_t* ompi_proc)
/* Loop over unpacking all the ports */
for (i = 0; i < module_proc->proc_port_count; i++) {
/* Unpack the port */
memcpy(&module_proc->proc_ports[i], offset,
memcpy(&module_proc->proc_ports[i], offset,
sizeof(mca_btl_openib_port_info_t));
#if !defined(WORDS_BIGENDIAN) && OMPI_ENABLE_HETEROGENEOUS_SUPPORT
MCA_BTL_OPENIB_PORT_INFO_NTOH(module_proc->proc_ports[i]);
@ -198,15 +198,15 @@ mca_btl_openib_proc_t* mca_btl_openib_proc_create(ompi_proc_t* ompi_proc)
/*
* Note that this routine must be called with the lock on the process
* already held. Insert a btl instance into the proc array and assign
* already held. Insert a btl instance into the proc array and assign
* it an address.
*/
int mca_btl_openib_proc_insert(mca_btl_openib_proc_t* module_proc,
int mca_btl_openib_proc_insert(mca_btl_openib_proc_t* module_proc,
mca_btl_base_endpoint_t* module_endpoint)
{
/* insert into endpoint array */
#ifndef WORDS_BIGENDIAN
/* if we are little endian and our peer is not so lucky, then we
need to put all information sent to him in big endian (aka
@ -217,10 +217,10 @@ int mca_btl_openib_proc_insert(mca_btl_openib_proc_t* module_proc,
module_endpoint->nbo = true;
}
#endif
/* only allow eager rdma if the peers agree on the size of a long */
if((module_proc->proc_ompi->proc_arch & OMPI_ARCH_LONGISxx) !=
(ompi_proc_local()->proc_arch & OMPI_ARCH_LONGISxx)) {
(ompi_proc_local()->proc_arch & OMPI_ARCH_LONGISxx)) {
module_endpoint->use_eager_rdma = false;
}

Просмотреть файл

@ -5,15 +5,15 @@
* Copyright (c) 2004-2006 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* 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.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -37,26 +37,26 @@ extern "C" {
* BTL instance that attempts to open a connection to the process.
*/
struct mca_btl_openib_proc_t {
opal_list_item_t super;
opal_list_item_t super;
/**< allow proc to be placed on a list */
ompi_proc_t *proc_ompi;
ompi_proc_t *proc_ompi;
/**< pointer to corresponding ompi_proc_t */
orte_process_name_t proc_guid;
orte_process_name_t proc_guid;
/**< globally unique identifier for the process */
mca_btl_openib_port_info_t* proc_ports;
size_t proc_port_count;
mca_btl_openib_port_info_t* proc_ports;
size_t proc_port_count;
/**< number of ports published by endpoint */
struct mca_btl_base_endpoint_t **proc_endpoints;
/**< array of endpoints that have been created to access this proc */
struct mca_btl_base_endpoint_t **proc_endpoints;
/**< array of endpoints that have been created to access this proc */
size_t proc_endpoint_count;
size_t proc_endpoint_count;
/**< number of endpoints */
opal_mutex_t proc_lock;
opal_mutex_t proc_lock;
/**< lock to protect against concurrent access to proc state */
};
typedef struct mca_btl_openib_proc_t mca_btl_openib_proc_t;

Просмотреть файл

@ -1,15 +1,15 @@
/*
* Copyright (c) 2007 Mellanox Technologies. All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
#include "ompi_config.h"
#include <infiniband/verbs.h>
#include <infiniband/verbs.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@ -49,7 +49,7 @@ int mca_btl_openib_open_xrc_domain(struct mca_btl_openib_hca_t *hca)
strerror(errno)));
return OMPI_ERROR;
}
hca->xrc_fd = open(xrc_file_name, O_CREAT, S_IWUSR|S_IRUSR);
if (0 > hca->xrc_fd) {
BTL_ERROR(("Failed to open XRC domain file %s, errno says %s\n",
@ -57,7 +57,7 @@ int mca_btl_openib_open_xrc_domain(struct mca_btl_openib_hca_t *hca)
free(xrc_file_name);
return OMPI_ERROR;
}
hca->xrc_domain = ibv_open_xrc_domain(hca->ib_dev_context, hca->xrc_fd, O_CREAT);
if (NULL == hca->xrc_domain) {
BTL_ERROR(("Failed to open XRC domain\n"));
@ -127,7 +127,7 @@ static int ib_address_init(ib_address_t *ib_addr, uint16_t lid, uint64_t s_id, o
}
/* Create new entry in hash table for subnet_id and lid,
* update the endpoint pointer.
* update the endpoint pointer.
* Before call to this function you need to protect with
*/
int mca_btl_openib_ib_address_add_new (uint16_t lid, uint64_t s_id,
@ -146,7 +146,7 @@ int mca_btl_openib_ib_address_add_new (uint16_t lid, uint64_t s_id,
/* is it already in the table ?*/
OPAL_THREAD_LOCK(&mca_btl_openib_component.ib_lock);
if (OPAL_SUCCESS != opal_hash_table_get_value_ptr(&mca_btl_openib_component.ib_addr_table,
ib_addr->key,
ib_addr->key,
SIZE_OF3(s_id, lid, ep_jobid), &tmp)) {
/* It is new one, lets put it on the table */
ret = opal_hash_table_set_value_ptr(&mca_btl_openib_component.ib_addr_table,

Просмотреть файл

@ -1,9 +1,9 @@
/*
* Copyright (c) 2007 Mellanox Technologies. All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*
* @file
@ -34,7 +34,7 @@ struct ib_address_t {
opal_list_t pending_ep; /* list of endpoints that use this ib_address */
mca_btl_openib_qp_t *qp; /* pointer to qp that will be used
for communication with the
destination */
destination */
opal_mutex_t addr_lock; /* protection */
mca_btl_openib_ib_addr_state_t status; /* ib port status */
};