1
1

Make openib compile again for Windows.

Update the CMake script for checking mca subdirs.
Add windows support for __attribute__ packed structures.
Define usleep and posix_memalign with equivalent windows functions.
And a few minor fixes, type casts.

This commit was SVN r24429.
Этот коммит содержится в:
Shiqing Fan 2011-02-22 15:49:27 +00:00
родитель baad4e1844
Коммит 90eeba252e
4 изменённых файлов: 38 добавлений и 15 удалений

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

@ -151,22 +151,26 @@ FOREACH (MCA_FRAMEWORK ${MCA_FRAMEWORK_LIST})
IF(BUILD_COMPONENT)
IF(NOT COMPONENT_FILES)
FILE(GLOB_RECURSE COMPONENT_FILES "${CURRENT_PATH}/*.C" "${CURRENT_PATH}/*.h"
#check exclude list
SET(EXCLUDE_LIST "")
FILE(STRINGS ${CURRENT_PATH}/.windows EXCLUDE_LIST REGEX "^exclude_list=")
IF(NOT EXCLUDE_LIST STREQUAL "")
STRING(REPLACE "exclude_list=" "" EXCLUDE_LIST ${EXCLUDE_LIST})
FILE(GLOB_RECURSE RESULT_FILES "${CURRENT_PATH}/*.C" "${CURRENT_PATH}/*.h"
"${CURRENT_PATH}/*.cc" "${CURRENT_PATH}/*.cpp")
#check exclude list
SET(EXCLUDE_LIST "")
FILE(STRINGS ${CURRENT_PATH}/.windows EXCLUDE_LIST REGEX "^exclude_list=")
IF(NOT EXCLUDE_LIST STREQUAL "")
STRING(REPLACE "exclude_list=" "" EXCLUDE_LIST ${EXCLUDE_LIST})
ENDIF(NOT EXCLUDE_LIST STREQUAL "")
# remove the files in the exclude list
FOREACH(FILE ${EXCLUDE_LIST})
LIST(REMOVE_ITEM COMPONENT_FILES "${CURRENT_PATH}/${FILE}")
LIST(REMOVE_ITEM RESULT_FILES "${CURRENT_PATH}/${FILE}")
ENDFOREACH(FILE)
# append the rest of the files to the main list
SET(COMPONENT_FILES ${COMPONENT_FILES} ${RESULT_FILES})
ENDIF(NOT EXCLUDE_LIST STREQUAL "")
IF(NOT COMPONENT_FILES)
FILE(GLOB_RECURSE COMPONENT_FILES "${CURRENT_PATH}/*.C" "${CURRENT_PATH}/*.h")
ENDIF(NOT COMPONENT_FILES)
# check the library build type

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

@ -527,8 +527,8 @@ static int openib_reg_mr(void *reg_data, void *base, size_t size,
{
mca_btl_openib_device_t *device = (mca_btl_openib_device_t*)reg_data;
mca_btl_openib_reg_t *openib_reg = (mca_btl_openib_reg_t*)reg;
enum ibv_access_flags access_flag = IBV_ACCESS_LOCAL_WRITE |
IBV_ACCESS_REMOTE_WRITE | IBV_ACCESS_REMOTE_READ;
enum ibv_access_flags access_flag = (ibv_access_flags) (IBV_ACCESS_LOCAL_WRITE |
IBV_ACCESS_REMOTE_WRITE | IBV_ACCESS_REMOTE_READ);
#if HAVE_DECL_IBV_ACCESS_SO
if (reg->flags & MCA_MPOOL_FLAGS_SO_MEM) {

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

@ -43,7 +43,10 @@
#include "btl_openib_proc.h"
#include "connect/connect.h"
#include "orte/util/show_help.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
typedef enum {
ENDPOINT_CONNECT_REQUEST,
@ -51,7 +54,11 @@ typedef enum {
ENDPOINT_CONNECT_ACK
} connect_message_type_t;
#ifndef __WINDOWS__
#define PACK_SUFFIX __attribute__((packed))
#else
#define PACK_SUFFIX
#endif
#define SL_NOT_PRESENT 0x7F
#define MAX_GET_SL_REC_RETRIES 20
@ -69,6 +76,12 @@ typedef enum {
#define IB_SA_PATH_REC_DLID (1<<4)
#define IB_SA_PATH_REC_SLID (1<<5)
#ifdef __WINDOWS__
#pragma pack(push)
#pragma pack(1)
#endif
struct ib_mad_hdr {
uint8_t base_version;
uint8_t mgmt_class;
@ -134,6 +147,10 @@ struct ib_mad_sa {
union ib_sa_data sa_data;
} PACK_SUFFIX;
#ifdef __WINDOWS__
#pragma pack(pop)
#endif
static struct mca_btl_openib_sa_qp_cache {
/* There will be a MR with the one send and receive buffer together */
/* The send buffer is first, the receive buffer is second */
@ -1349,12 +1366,12 @@ static int get_pathrecord_sl(struct ibv_context *context_arg,
/* if the destination lid SL value is not in the cache, go get it */
if (SL_NOT_PRESENT == cache->sl_values[rem_lid]) {
/* sag is first buffer, where we build the SA Get request to send */
sag = (void *)(cache->send_recv_buffer);
sag = (ib_mad_sa *)(cache->send_recv_buffer);
init_sa_mad(cache, sag, &swr, &ssge, lid, rem_lid);
/* sar is the receive buffer (40 byte GRH) */
sar = (void *)(cache->send_recv_buffer + sizeof(struct ib_mad_sa) + 40);
sar = (ib_mad_sa *)(cache->send_recv_buffer + sizeof(struct ib_mad_sa) + 40);
rc = get_pathrecord_info(cache, sag, sar, &swr, lid, rem_lid);
if (0 != rc) {

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

@ -158,6 +158,8 @@ typedef unsigned int uint;
#define srand48 srand
#define lrand48 rand
#define nanosleep(tp, rem) Sleep(*tp.tv_sec*1000+*tp.tv_nsec/1000000)
#define usleep(t) Sleep(t/1000)
#define posix_memalign(p, a, s) *p=_aligned_malloc(s,a)
#ifndef UINT32_MAX
#define UINT32_MAX _UI32_MAX