Mainly type casts.
Get rid of pthread and other unnecessary stuffs for Windows. This commit was SVN r23376.
Этот коммит содержится в:
родитель
74120b46c1
Коммит
cdc7e0bec9
@ -26,7 +26,9 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include <string.h>
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
#include "opal/class/opal_bitmap.h"
|
||||
@ -56,7 +58,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
@ -66,7 +67,9 @@
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
mca_btl_openib_module_t mca_btl_openib_module = {
|
||||
{
|
||||
@ -115,7 +118,9 @@ void mca_btl_openib_show_init_error(const char *file, int line,
|
||||
{
|
||||
if (ENOMEM == errno) {
|
||||
int ret;
|
||||
#ifndef __WINDOWS__
|
||||
struct rlimit limit;
|
||||
#endif
|
||||
char *str_limit = NULL;
|
||||
|
||||
#if HAVE_DECL_RLIMIT_MEMLOCK
|
||||
@ -123,6 +128,7 @@ void mca_btl_openib_show_init_error(const char *file, int line,
|
||||
#else
|
||||
ret = -1;
|
||||
#endif
|
||||
#ifndef __WINDOWS__
|
||||
if (0 != ret) {
|
||||
asprintf(&str_limit, "Unknown");
|
||||
} else if (limit.rlim_cur == RLIM_INFINITY) {
|
||||
@ -130,6 +136,7 @@ void mca_btl_openib_show_init_error(const char *file, int line,
|
||||
} else {
|
||||
asprintf(&str_limit, "%ld", (long)limit.rlim_cur);
|
||||
}
|
||||
#endif
|
||||
|
||||
orte_show_help("help-mpi-btl-openib.txt", "init-fail-no-mem",
|
||||
true, orte_process_info.nodename,
|
||||
@ -803,7 +810,7 @@ int mca_btl_openib_del_procs(struct mca_btl_base_module_t* btl,
|
||||
for(ep_index=0;
|
||||
ep_index < opal_pointer_array_get_size(openib_btl->device->endpoints);
|
||||
ep_index++) {
|
||||
endpoint =
|
||||
endpoint = (mca_btl_openib_endpoint_t *)
|
||||
opal_pointer_array_get_item(openib_btl->device->endpoints,
|
||||
ep_index);
|
||||
if(!endpoint || endpoint->endpoint_btl != openib_btl) {
|
||||
@ -1151,7 +1158,7 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_src(
|
||||
return NULL;
|
||||
|
||||
iov.iov_len = max_data;
|
||||
iov.iov_base = (unsigned char*)to_base_frag(frag)->segment.seg_addr.pval +
|
||||
iov.iov_base = (IOVBASE_TYPE *)to_base_frag(frag)->segment.seg_addr.pval +
|
||||
reserve;
|
||||
rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data);
|
||||
|
||||
@ -1253,8 +1260,8 @@ static int mca_btl_openib_finalize_resources(struct mca_btl_base_module_t* btl)
|
||||
for (ep_index=0;
|
||||
ep_index < opal_pointer_array_get_size(openib_btl->device->endpoints);
|
||||
ep_index++) {
|
||||
endpoint=opal_pointer_array_get_item(openib_btl->device->endpoints,
|
||||
ep_index);
|
||||
endpoint=(mca_btl_openib_endpoint_t *)opal_pointer_array_get_item(openib_btl->device->endpoints,
|
||||
ep_index);
|
||||
if(!endpoint) {
|
||||
BTL_VERBOSE(("In finalize, got another null endpoint"));
|
||||
continue;
|
||||
|
@ -39,7 +39,9 @@ const char *ibv_get_sysfs_path(void);
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <malloc.h>
|
||||
@ -203,7 +205,9 @@ static int btl_openib_component_close(void)
|
||||
#endif
|
||||
|
||||
ompi_btl_openib_connect_base_finalize();
|
||||
#ifndef __WINDOWS__
|
||||
ompi_btl_openib_fd_finalize();
|
||||
#endif
|
||||
ompi_btl_openib_ini_finalize();
|
||||
if (NULL != mca_btl_openib_component.receive_queues) {
|
||||
free(mca_btl_openib_component.receive_queues);
|
||||
@ -304,7 +308,7 @@ static int btl_openib_modex_send(void)
|
||||
mca_btl_openib_component.openib_btls[i]->cpcs[j]->data.cbm_modex_message_len;
|
||||
}
|
||||
}
|
||||
message = malloc(msg_size);
|
||||
message = (char *) malloc(msg_size);
|
||||
if (NULL == message) {
|
||||
BTL_ERROR(("Failed malloc"));
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
@ -413,7 +417,7 @@ static void btl_openib_control(mca_btl_base_module_t* btl,
|
||||
mca_btl_openib_module_t *obtl = (mca_btl_openib_module_t*)btl;
|
||||
mca_btl_openib_endpoint_t* ep = to_com_frag(des)->endpoint;
|
||||
mca_btl_openib_control_header_t *ctl_hdr =
|
||||
to_base_frag(des)->segment.seg_addr.pval;
|
||||
(mca_btl_openib_control_header_t *) to_base_frag(des)->segment.seg_addr.pval;
|
||||
mca_btl_openib_eager_rdma_header_t *rdma_hdr;
|
||||
mca_btl_openib_header_coalesced_t *clsc_hdr =
|
||||
(mca_btl_openib_header_coalesced_t*)(ctl_hdr + 1);
|
||||
@ -673,7 +677,7 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device,
|
||||
for(i = 0; i < mca_btl_openib_component.btls_per_lid; i++){
|
||||
char param[40];
|
||||
|
||||
openib_btl = malloc(sizeof(mca_btl_openib_module_t));
|
||||
openib_btl = (mca_btl_openib_module_t *) malloc(sizeof(mca_btl_openib_module_t));
|
||||
if(NULL == openib_btl) {
|
||||
BTL_ERROR(("Failed malloc: %s:%d", __FILE__, __LINE__));
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
@ -1009,15 +1013,15 @@ static int prepare_device_for_use(mca_btl_openib_device_t *device)
|
||||
if (mca_btl_openib_component.max_eager_rdma > 0 &&
|
||||
device->use_eager_rdma) {
|
||||
device->eager_rdma_buffers =
|
||||
calloc(mca_btl_openib_component.max_eager_rdma * device->btls,
|
||||
sizeof(mca_btl_openib_endpoint_t*));
|
||||
(mca_btl_base_endpoint_t **) calloc(mca_btl_openib_component.max_eager_rdma * device->btls,
|
||||
sizeof(mca_btl_openib_endpoint_t*));
|
||||
if(NULL == device->eager_rdma_buffers) {
|
||||
BTL_ERROR(("Memory allocation fails"));
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
}
|
||||
|
||||
init_data = malloc(sizeof(mca_btl_openib_frag_init_data_t));
|
||||
init_data = (mca_btl_openib_frag_init_data_t *) 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_eager_rdma_header_t);
|
||||
@ -1048,7 +1052,7 @@ static int prepare_device_for_use(mca_btl_openib_device_t *device)
|
||||
|
||||
/* 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));
|
||||
init_data = (mca_btl_openib_frag_init_data_t *) malloc(sizeof(mca_btl_openib_frag_init_data_t));
|
||||
/* Initialize pool of send fragments */
|
||||
length = sizeof(mca_btl_openib_header_t) +
|
||||
sizeof(mca_btl_openib_header_coalesced_t) +
|
||||
@ -1082,7 +1086,7 @@ static int prepare_device_for_use(mca_btl_openib_device_t *device)
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
init_data = malloc(sizeof(mca_btl_openib_frag_init_data_t));
|
||||
init_data = (mca_btl_openib_frag_init_data_t *) 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) +
|
||||
@ -1248,7 +1252,7 @@ static void merge_values(ompi_btl_openib_ini_values_t *target,
|
||||
static bool inline is_credit_message(const mca_btl_openib_recv_frag_t *frag)
|
||||
{
|
||||
mca_btl_openib_control_header_t* chdr =
|
||||
to_base_frag(frag)->segment.seg_addr.pval;
|
||||
(mca_btl_openib_control_header_t *) to_base_frag(frag)->segment.seg_addr.pval;
|
||||
return (MCA_BTL_TAG_BTL == frag->hdr->tag) &&
|
||||
(MCA_BTL_OPENIB_CONTROL_CREDITS == chdr->type);
|
||||
}
|
||||
@ -1256,7 +1260,7 @@ static bool inline is_credit_message(const mca_btl_openib_recv_frag_t *frag)
|
||||
static bool inline is_cts_message(const mca_btl_openib_recv_frag_t *frag)
|
||||
{
|
||||
mca_btl_openib_control_header_t* chdr =
|
||||
to_base_frag(frag)->segment.seg_addr.pval;
|
||||
(mca_btl_openib_control_header_t *) to_base_frag(frag)->segment.seg_addr.pval;
|
||||
return (MCA_BTL_TAG_BTL == frag->hdr->tag) &&
|
||||
(MCA_BTL_OPENIB_CONTROL_CTS == chdr->type);
|
||||
}
|
||||
@ -1275,7 +1279,7 @@ static void init_apm_port(mca_btl_openib_device_t *device, int port, uint16_t li
|
||||
int index;
|
||||
struct mca_btl_openib_module_t *btl;
|
||||
for(index = 0; index < device->btls; index++) {
|
||||
btl = opal_pointer_array_get_item(device->device_btls, index);
|
||||
btl = (mca_btl_openib_module_t *) opal_pointer_array_get_item(device->device_btls, index);
|
||||
/* Ok, we already have btl for the fist port,
|
||||
* second one will be used for APM */
|
||||
btl->apm_port = port;
|
||||
@ -2307,8 +2311,8 @@ struct dev_distance {
|
||||
|
||||
static int compare_distance(const void *p1, const void *p2)
|
||||
{
|
||||
const struct dev_distance *d1 = p1;
|
||||
const struct dev_distance *d2 = p2;
|
||||
const struct dev_distance *d1 = (const dev_distance *) p1;
|
||||
const struct dev_distance *d2 = (const dev_distance *) p2;
|
||||
|
||||
return d1->distance - d2->distance;
|
||||
}
|
||||
@ -2317,7 +2321,7 @@ static struct dev_distance *
|
||||
sort_devs_by_distance(struct ibv_device **ib_devs, int count)
|
||||
{
|
||||
int i;
|
||||
struct dev_distance *devs = malloc(count * sizeof(struct dev_distance));
|
||||
struct dev_distance *devs = (dev_distance *) malloc(count * sizeof(struct dev_distance));
|
||||
|
||||
opal_carto_base_get_host_graph(&host_topo, "Infiniband");
|
||||
|
||||
@ -2381,20 +2385,24 @@ btl_openib_component_init(int *num_btl_modules,
|
||||
goto no_btls;
|
||||
}
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
seedv[0] = ORTE_PROC_MY_NAME->vpid;
|
||||
seedv[1] = opal_sys_timer_get_cycles();
|
||||
seedv[2] = opal_sys_timer_get_cycles();
|
||||
seed48(seedv);
|
||||
#endif
|
||||
|
||||
/* Read in INI files with device-specific parameters */
|
||||
if (OMPI_SUCCESS != (ret = ompi_btl_openib_ini_init())) {
|
||||
goto no_btls;
|
||||
}
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
/* Initialize FD listening */
|
||||
if (OMPI_SUCCESS != ompi_btl_openib_fd_init()) {
|
||||
goto no_btls;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Init CPC components */
|
||||
if (OMPI_SUCCESS != (ret = ompi_btl_openib_connect_base_init())) {
|
||||
@ -2467,7 +2475,7 @@ btl_openib_component_init(int *num_btl_modules,
|
||||
OBJ_CONSTRUCT(&mca_btl_openib_component.send_user_free, ompi_free_list_t);
|
||||
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 = (mca_btl_openib_frag_init_data_t *) 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;
|
||||
@ -2484,7 +2492,7 @@ btl_openib_component_init(int *num_btl_modules,
|
||||
goto no_btls;
|
||||
}
|
||||
|
||||
init_data = malloc(sizeof(mca_btl_openib_frag_init_data_t));
|
||||
init_data = (mca_btl_openib_frag_init_data_t *) 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;
|
||||
@ -2501,7 +2509,7 @@ btl_openib_component_init(int *num_btl_modules,
|
||||
goto no_btls;
|
||||
}
|
||||
|
||||
init_data = malloc(sizeof(mca_btl_openib_frag_init_data_t));
|
||||
init_data = (mca_btl_openib_frag_init_data_t *) malloc(sizeof(mca_btl_openib_frag_init_data_t));
|
||||
length = sizeof(mca_btl_openib_coalesced_frag_t);
|
||||
|
||||
init_data->list = &mca_btl_openib_component.send_free_coalesced;
|
||||
@ -2695,7 +2703,7 @@ btl_openib_component_init(int *num_btl_modules,
|
||||
|
||||
/* Allocate space for btl modules */
|
||||
mca_btl_openib_component.openib_btls =
|
||||
malloc(sizeof(mca_btl_openib_module_t*) *
|
||||
(mca_btl_openib_module_t **) malloc(sizeof(mca_btl_openib_module_t*) *
|
||||
mca_btl_openib_component.ib_num_btls);
|
||||
if(NULL == mca_btl_openib_component.openib_btls) {
|
||||
BTL_ERROR(("Failed malloc: %s:%d", __FILE__, __LINE__));
|
||||
@ -2806,8 +2814,10 @@ btl_openib_component_init(int *num_btl_modules,
|
||||
/* If we fail early enough in the setup, we just modex around that
|
||||
there are no openib BTL's in this process and return NULL. */
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
/* Be sure to shut down the fd listener */
|
||||
ompi_btl_openib_fd_finalize();
|
||||
#endif
|
||||
|
||||
mca_btl_openib_component.ib_num_btls = 0;
|
||||
btl_openib_modex_send();
|
||||
@ -2960,7 +2970,8 @@ static int btl_openib_handle_incoming(mca_btl_openib_module_t *openib_btl,
|
||||
hdr->credits = 0;
|
||||
}
|
||||
} else {
|
||||
mca_btl_openib_rdma_credits_header_t *chdr=des->des_dst->seg_addr.pval;
|
||||
mca_btl_openib_rdma_credits_header_t *chdr =
|
||||
(mca_btl_openib_rdma_credits_header_t *) des->des_dst->seg_addr.pval;
|
||||
if(ep->nbo) {
|
||||
BTL_OPENIB_RDMA_CREDITS_HEADER_NTOH(*chdr);
|
||||
}
|
||||
@ -3050,9 +3061,6 @@ static char* btl_openib_component_status_to_string(enum ibv_wc_status status)
|
||||
case IBV_WC_LOC_QP_OP_ERR:
|
||||
return "LOCAL QP OPERATION ERROR";
|
||||
break;
|
||||
case IBV_WC_LOC_EEC_OP_ERR:
|
||||
return "LOCAL EEC OPERATION ERROR";
|
||||
break;
|
||||
case IBV_WC_LOC_PROT_ERR:
|
||||
return "LOCAL PROTOCOL ERROR";
|
||||
break;
|
||||
@ -3511,7 +3519,7 @@ static int btl_openib_component_progress(void)
|
||||
|
||||
for(i = 0; i < mca_btl_openib_component.devices_count; i++) {
|
||||
mca_btl_openib_device_t *device =
|
||||
opal_pointer_array_get_item(&mca_btl_openib_component.devices, i);
|
||||
(mca_btl_openib_device_t *) opal_pointer_array_get_item(&mca_btl_openib_component.devices, i);
|
||||
count += progress_one_device(device);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,9 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
@ -195,7 +197,7 @@ OBJ_CLASS_INSTANCE(mca_btl_openib_endpoint_t,
|
||||
*/
|
||||
static mca_btl_openib_qp_t *endpoint_alloc_qp(void)
|
||||
{
|
||||
mca_btl_openib_qp_t *qp = calloc(1, sizeof(mca_btl_openib_qp_t));
|
||||
mca_btl_openib_qp_t *qp = (mca_btl_openib_qp_t *) calloc(1, sizeof(mca_btl_openib_qp_t));
|
||||
if(!qp) {
|
||||
BTL_ERROR(("Failed to allocate memory for qp"));
|
||||
return NULL;
|
||||
@ -316,7 +318,8 @@ void mca_btl_openib_endpoint_init(mca_btl_openib_module_t *btl,
|
||||
ep->rem_info.rem_vendor_id = (remote_proc_info->pm_port_info).vendor_id;
|
||||
ep->rem_info.rem_vendor_part_id = (remote_proc_info->pm_port_info).vendor_part_id;
|
||||
|
||||
ep->rem_info.rem_transport_type = (remote_proc_info->pm_port_info).transport_type;
|
||||
ep->rem_info.rem_transport_type =
|
||||
(mca_btl_openib_transport_type_t) (remote_proc_info->pm_port_info).transport_type;
|
||||
|
||||
for (qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
|
||||
endpoint_init_qp(ep, qp);
|
||||
@ -922,7 +925,7 @@ void mca_btl_openib_endpoint_connect_eager_rdma(
|
||||
if(NULL == headers_buf)
|
||||
goto unlock_rdma_local;
|
||||
|
||||
buf = openib_btl->super.btl_mpool->mpool_alloc(openib_btl->super.btl_mpool,
|
||||
buf = (char *) openib_btl->super.btl_mpool->mpool_alloc(openib_btl->super.btl_mpool,
|
||||
openib_btl->eager_rdma_frag_size *
|
||||
mca_btl_openib_component.eager_rdma_num,
|
||||
mca_btl_openib_component.buffer_alignment,
|
||||
@ -942,7 +945,7 @@ void mca_btl_openib_endpoint_connect_eager_rdma(
|
||||
mca_btl_openib_frag_init_data_t init_data;
|
||||
|
||||
item = (ompi_free_list_item_t*)&headers_buf[i];
|
||||
item->registration = (void*)endpoint->eager_rdma_local.reg;
|
||||
item->registration = (mca_mpool_base_registration_t *)endpoint->eager_rdma_local.reg;
|
||||
item->ptr = buf + i * openib_btl->eager_rdma_frag_size;
|
||||
OBJ_CONSTRUCT(item, mca_btl_openib_recv_frag_t);
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
void mca_btl_openib_frag_init(ompi_free_list_item_t* item, void* ctx)
|
||||
{
|
||||
mca_btl_openib_frag_init_data_t* init_data = ctx;
|
||||
mca_btl_openib_frag_init_data_t* init_data = (mca_btl_openib_frag_init_data_t *) ctx;
|
||||
mca_btl_openib_frag_t *frag = to_base_frag(item);
|
||||
|
||||
if(MCA_BTL_OPENIB_FRAG_RECV == frag->type) {
|
||||
|
@ -24,7 +24,9 @@
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "orte/util/show_help.h"
|
||||
#include "opal/util/opal_sos.h"
|
||||
@ -319,7 +321,7 @@ static int parse_line(parsed_section_values_t *sv)
|
||||
if (key_buffer_len < strlen(btl_openib_ini_yytext) + 1) {
|
||||
char *tmp;
|
||||
key_buffer_len = strlen(btl_openib_ini_yytext) + 1;
|
||||
tmp = realloc(key_buffer, key_buffer_len);
|
||||
tmp = (char *) realloc(key_buffer, key_buffer_len);
|
||||
if (NULL == tmp) {
|
||||
free(key_buffer);
|
||||
key_buffer_len = 0;
|
||||
@ -632,7 +634,7 @@ int ompi_btl_openib_ini_intify_list(char *value, uint32_t **values, int *len)
|
||||
if (NULL == comma) {
|
||||
/* If we only got one value (i.e., no comma found), then
|
||||
just make an array of one value and save it */
|
||||
*values = malloc(sizeof(uint32_t));
|
||||
*values = (uint32_t *) malloc(sizeof(uint32_t));
|
||||
if (NULL == *values) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
@ -648,7 +650,7 @@ int ompi_btl_openib_ini_intify_list(char *value, uint32_t **values, int *len)
|
||||
str = comma + 1;
|
||||
comma = strchr(str, ',');
|
||||
}
|
||||
*values = malloc(sizeof(uint32_t) * newsize);
|
||||
*values = (uint32_t *) malloc(sizeof(uint32_t) * newsize);
|
||||
if (NULL == *values) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ mca_btl_openib_proc_t* mca_btl_openib_proc_create(ompi_proc_t* ompi_proc)
|
||||
modex_message_size = ((char *) &(dummy.end)) - ((char*) &dummy);
|
||||
|
||||
/* Unpack the number of modules in the message */
|
||||
offset = message;
|
||||
offset = (char *) message;
|
||||
unpack8(&offset, &(module_proc->proc_port_count));
|
||||
BTL_VERBOSE(("unpack: %d btls", module_proc->proc_port_count));
|
||||
if (module_proc->proc_port_count > 0) {
|
||||
@ -200,7 +200,7 @@ mca_btl_openib_proc_t* mca_btl_openib_proc_create(ompi_proc_t* ompi_proc)
|
||||
BTL_VERBOSE(("unpacked btl %d: number of cpcs to follow %d (offset now %d)",
|
||||
i, module_proc->proc_ports[i].pm_cpc_data_count,
|
||||
(int)(offset-((char*)message))));
|
||||
module_proc->proc_ports[i].pm_cpc_data =
|
||||
module_proc->proc_ports[i].pm_cpc_data = (ompi_btl_openib_connect_base_module_data_t *)
|
||||
calloc(module_proc->proc_ports[i].pm_cpc_data_count,
|
||||
sizeof(ompi_btl_openib_connect_base_module_data_t));
|
||||
if (NULL == module_proc->proc_ports[i].pm_cpc_data) {
|
||||
|
@ -15,7 +15,9 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "ompi/mca/btl/base/base.h"
|
||||
#include "btl_openib_xrc.h"
|
||||
|
@ -103,7 +103,7 @@ int ompi_btl_openib_connect_base_register(void)
|
||||
|
||||
/* Parse the if_[in|ex]clude paramters to come up with a list of
|
||||
CPCs that are available */
|
||||
available = calloc(1, sizeof(all));
|
||||
available = (ompi_btl_openib_connect_base_component_t **) calloc(1, sizeof(all));
|
||||
|
||||
/* If we have an "include" list, then find all those CPCs and put
|
||||
them in available[] */
|
||||
@ -241,7 +241,7 @@ int ompi_btl_openib_connect_base_select_for_local_port(mca_btl_openib_module_t *
|
||||
int i, rc, cpc_index, len;
|
||||
ompi_btl_openib_connect_base_module_t **cpcs;
|
||||
|
||||
cpcs = calloc(num_available,
|
||||
cpcs = (ompi_btl_openib_connect_base_module_t **) calloc(num_available,
|
||||
sizeof(ompi_btl_openib_connect_base_module_t *));
|
||||
if (NULL == cpcs) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
@ -253,7 +253,7 @@ int ompi_btl_openib_connect_base_select_for_local_port(mca_btl_openib_module_t *
|
||||
for (len = 1, i = 0; NULL != available[i]; ++i) {
|
||||
len += strlen(available[i]->cbc_name) + 2;
|
||||
}
|
||||
msg = malloc(len);
|
||||
msg = (char *) malloc(len);
|
||||
if (NULL == msg) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ static int oob_component_query(mca_btl_openib_module_t *btl,
|
||||
rml_recv_posted = true;
|
||||
}
|
||||
|
||||
*cpc = malloc(sizeof(ompi_btl_openib_connect_base_module_t));
|
||||
*cpc = (ompi_btl_openib_connect_base_module_t *) malloc(sizeof(ompi_btl_openib_connect_base_module_t));
|
||||
if (NULL == *cpc) {
|
||||
orte_rml.recv_cancel(ORTE_NAME_WILDCARD, OMPI_RML_TAG_OPENIB);
|
||||
rml_recv_posted = false;
|
||||
@ -289,8 +289,8 @@ static int qp_connect_all(mca_btl_openib_endpoint_t *endpoint)
|
||||
for (i = 0; i < mca_btl_openib_component.num_qps; i++) {
|
||||
struct ibv_qp_attr attr;
|
||||
struct ibv_qp* qp = endpoint->qps[i].qp->lcl_qp;
|
||||
enum ibv_mtu mtu = (openib_btl->device->mtu < endpoint->rem_info.rem_mtu) ?
|
||||
openib_btl->device->mtu : endpoint->rem_info.rem_mtu;
|
||||
enum ibv_mtu mtu = (ibv_mtu) ((openib_btl->device->mtu < endpoint->rem_info.rem_mtu) ?
|
||||
openib_btl->device->mtu : endpoint->rem_info.rem_mtu) ;
|
||||
|
||||
memset(&attr, 0, sizeof(attr));
|
||||
attr.qp_state = IBV_QPS_RTR;
|
||||
|
@ -14,19 +14,33 @@
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <rdma/rdma_cma.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_NET_IF_H
|
||||
#include <net/if.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
#include <malloc.h>
|
||||
#include <stddef.h>
|
||||
|
||||
@ -273,7 +287,7 @@ static void rdmacm_component_register(void)
|
||||
*/
|
||||
static char *stringify(uint32_t addr)
|
||||
{
|
||||
char *line = malloc(64);
|
||||
char *line = (char *) malloc(64);
|
||||
asprintf(&line, "%d.%d.%d.%d (0x%x)",
|
||||
#if defined(WORDS_BIGENDIAN)
|
||||
(addr >> 24),
|
||||
@ -321,12 +335,12 @@ static mca_btl_openib_endpoint_t *rdmacm_find_endpoint(rdmacm_contents_t *conten
|
||||
mca_btl_openib_endpoint_t *endpoint;
|
||||
modex_message_t *message;
|
||||
|
||||
endpoint = opal_pointer_array_get_item(endpoints, i);
|
||||
endpoint = (mca_btl_openib_endpoint_t *) opal_pointer_array_get_item(endpoints, i);
|
||||
if (NULL == endpoint) {
|
||||
continue;
|
||||
}
|
||||
|
||||
message = endpoint->endpoint_remote_cpc_data->cbm_modex_message;
|
||||
message = (modex_message_t *) endpoint->endpoint_remote_cpc_data->cbm_modex_message;
|
||||
OPAL_OUTPUT((-1, "message ipaddr = %s port %d",
|
||||
a = stringify(message->ipaddr), message->tcp_port));
|
||||
#if OPAL_ENABLE_DEBUG
|
||||
@ -793,7 +807,7 @@ static int handle_connect_request(struct rdma_cm_event *event)
|
||||
endpoint = rdmacm_find_endpoint(contents, event->id, rem_port);
|
||||
if (NULL == endpoint) {
|
||||
struct sockaddr *peeraddr = rdma_get_peer_addr(event->id);
|
||||
cant_find_endpoint_context_t *c = calloc(1, sizeof(*c));
|
||||
cant_find_endpoint_context_t *c = (cant_find_endpoint_context_t *) calloc(1, sizeof(*c));
|
||||
if (NULL != c) {
|
||||
snprintf(c->device_name, sizeof(c->device_name) - 1,
|
||||
"%s:%d",
|
||||
@ -807,7 +821,7 @@ static int handle_connect_request(struct rdma_cm_event *event)
|
||||
goto out;
|
||||
}
|
||||
|
||||
message = endpoint->endpoint_remote_cpc_data->cbm_modex_message;
|
||||
message = (modex_message_t *) endpoint->endpoint_remote_cpc_data->cbm_modex_message;
|
||||
endpoint->endpoint_initiator =
|
||||
i_initiate(contents->ipaddr, contents->tcp_port,
|
||||
message->ipaddr, rem_port);
|
||||
@ -1039,8 +1053,10 @@ static int rdmacm_endpoint_finalize(struct mca_btl_base_endpoint_t *endpoint)
|
||||
OPAL_OUTPUT((-1, "MAIN Main thread calling disconnect on ID %p",
|
||||
(void*) ((id_context_t*) item2)->id));
|
||||
++num_to_wait_for;
|
||||
#ifndef __WINDOWS__
|
||||
ompi_btl_openib_fd_run_in_service(call_disconnect_callback,
|
||||
item2);
|
||||
#endif
|
||||
}
|
||||
/* remove_item returns the item before the item removed,
|
||||
meaning that the for list is still safe */
|
||||
@ -1056,8 +1072,10 @@ static int rdmacm_endpoint_finalize(struct mca_btl_base_endpoint_t *endpoint)
|
||||
|
||||
/* Now wait for all the disconnect callbacks to occur */
|
||||
while (num_to_wait_for != disconnect_callbacks) {
|
||||
#ifndef __WINDOWS__
|
||||
ompi_btl_openib_fd_main_thread_drain();
|
||||
sched_yield();
|
||||
#endif
|
||||
}
|
||||
|
||||
OPAL_OUTPUT((-1, "MAIN Endpoint finished finalizing"));
|
||||
@ -1124,7 +1142,7 @@ static int rdmacm_connect_endpoint(id_context_t *context,
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
message = endpoint->endpoint_remote_cpc_data->cbm_modex_message;
|
||||
message = (modex_message_t *) endpoint->endpoint_remote_cpc_data->cbm_modex_message;
|
||||
BTL_VERBOSE(("%s connected!!! local %x remote %x state = %d",
|
||||
contents->server?"server":"client",
|
||||
contents->ipaddr,
|
||||
@ -1756,7 +1774,7 @@ static int create_message(rdmacm_contents_t *server,
|
||||
char *a;
|
||||
#endif
|
||||
|
||||
message = malloc(sizeof(modex_message_t));
|
||||
message = (modex_message_t *) malloc(sizeof(modex_message_t));
|
||||
if (NULL == message) {
|
||||
BTL_ERROR(("malloc failed"));
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
@ -1804,7 +1822,7 @@ static int rdmacm_component_query(mca_btl_openib_module_t *openib_btl, ompi_btl_
|
||||
|
||||
BTL_VERBOSE(("rdmacm_component_query"));
|
||||
|
||||
*cpc = malloc(sizeof(ompi_btl_openib_connect_base_module_t));
|
||||
*cpc = (ompi_btl_openib_connect_base_module_t *) malloc(sizeof(ompi_btl_openib_connect_base_module_t));
|
||||
if (NULL == *cpc) {
|
||||
rc = OMPI_ERR_OUT_OF_RESOURCE;
|
||||
goto out;
|
||||
@ -1948,8 +1966,10 @@ static int rdmacm_component_finalize(void)
|
||||
}
|
||||
|
||||
if (NULL != event_channel) {
|
||||
#ifndef __WINDOWS__
|
||||
rc = ompi_btl_openib_fd_unmonitor(event_channel->fd,
|
||||
rdmacm_unmonitor, (void*) &barrier);
|
||||
#endif
|
||||
if (OMPI_SUCCESS != rc) {
|
||||
BTL_ERROR(("Error disabling fd monitor"));
|
||||
}
|
||||
@ -1957,7 +1977,9 @@ static int rdmacm_component_finalize(void)
|
||||
/* Wait for the service thread to stop monitoring the fd */
|
||||
OPAL_OUTPUT((-1, "MAIN rdmacm_component_finalize: waiting for thread to finish"));
|
||||
while (0 == barrier) {
|
||||
#ifndef __WINDOWS__
|
||||
sched_yield();
|
||||
#endif
|
||||
}
|
||||
OPAL_OUTPUT((-1, "MAIN rdmacm_component_finalize: thread finished"));
|
||||
}
|
||||
@ -2017,9 +2039,11 @@ static int rdmacm_component_init(void)
|
||||
return OMPI_ERR_UNREACH;
|
||||
}
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
/* Start monitoring the fd associated with the cm_device */
|
||||
ompi_btl_openib_fd_monitor(event_channel->fd, OPAL_EV_READ,
|
||||
rdmacm_event_dispatch, NULL);
|
||||
#endif
|
||||
|
||||
rdmacm_component_initialized = true;
|
||||
return OMPI_SUCCESS;
|
||||
|
@ -151,6 +151,8 @@ typedef unsigned int uint;
|
||||
#define getch _getch
|
||||
#define random rand
|
||||
#define strtok_r strtok_s
|
||||
#define srand48 srand
|
||||
#define lrand48 rand
|
||||
|
||||
#ifndef UINT32_MAX
|
||||
#define UINT32_MAX _UI32_MAX
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user