1
1

Merge pull request #230 from nkogteva/oshmem_refactor_macro_style

oshmem: refactor of oshmem/mca/sshmem/*.[ch] files to use #if MACRO style
Этот коммит содержится в:
Mike Dubman 2014-10-13 13:33:32 +03:00
родитель 6372ac926c de68d58a9e
Коммит a1db93077d
5 изменённых файлов: 15 добавлений и 18 удалений

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

@ -128,7 +128,7 @@ OSHMEM_DECLSPEC extern mca_base_framework_t oshmem_sshmem_base_framework;
#define __SSHMEM_FILE__ __FILE__ #define __SSHMEM_FILE__ __FILE__
#endif #endif
#ifdef OPAL_ENABLE_DEBUG #if OPAL_ENABLE_DEBUG
#define SSHMEM_VERBOSE(level, ...) \ #define SSHMEM_VERBOSE(level, ...) \
oshmem_output_verbose(level, oshmem_sshmem_base_framework.framework_output, \ oshmem_output_verbose(level, oshmem_sshmem_base_framework.framework_output, \
"%s:%d - %s()", __SSHMEM_FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) "%s:%d - %s()", __SSHMEM_FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)

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

@ -35,6 +35,8 @@ AC_DEFUN([MCA_oshmem_sshmem_verbs_CONFIG],[
AC_SUBST([oshmem_verbs_LDFLAGS]) AC_SUBST([oshmem_verbs_LDFLAGS])
AC_SUBST([oshmem_verbs_LIBS]) AC_SUBST([oshmem_verbs_LIBS])
# ibv_reg_shared_mr was added in MOFED 1.8
oshmem_have_mpage=0
# If we have the oshmem_verbs stuff available, find out what we've got # If we have the oshmem_verbs stuff available, find out what we've got
AS_IF( AS_IF(
[test "$oshmem_verbs_sm_build_verbs" = "1"], [test "$oshmem_verbs_sm_build_verbs" = "1"],
@ -42,9 +44,6 @@ AC_DEFUN([MCA_oshmem_sshmem_verbs_CONFIG],[
OSHMEM_LIBSHMEM_EXTRA_LDFLAGS="$OSHMEM_LIBSHMEM_EXTRA_LDFLAGS $oshmem_verbs_LDFLAGS" OSHMEM_LIBSHMEM_EXTRA_LDFLAGS="$OSHMEM_LIBSHMEM_EXTRA_LDFLAGS $oshmem_verbs_LDFLAGS"
OSHMEM_LIBSHMEM_EXTRA_LIBS="$OSHMEM_LIBSHMEM_EXTRA_LIBS $oshmem_verbs_LIBS" OSHMEM_LIBSHMEM_EXTRA_LIBS="$OSHMEM_LIBSHMEM_EXTRA_LIBS $oshmem_verbs_LIBS"
# ibv_reg_shared_mr was added in MOFED 1.8
oshmem_have_mpage=0
oshmem_verbs_save_CPPFLAGS="$CPPFLAGS" oshmem_verbs_save_CPPFLAGS="$CPPFLAGS"
oshmem_verbs_save_LDFLAGS="$LDFLAGS" oshmem_verbs_save_LDFLAGS="$LDFLAGS"
oshmem_verbs_save_LIBS="$LIBS" oshmem_verbs_save_LIBS="$LIBS"
@ -64,22 +63,19 @@ AC_DEFUN([MCA_oshmem_sshmem_verbs_CONFIG],[
CPPFLAGS="$oshmem_verbs_save_CPPFLAGS" CPPFLAGS="$oshmem_verbs_save_CPPFLAGS"
LDFLAGS="$oshmem_verbs_save_LDFLAGS" LDFLAGS="$oshmem_verbs_save_LDFLAGS"
LIBS="$oshmem_verbs_save_LIBS" LIBS="$oshmem_verbs_save_LIBS"
AC_DEFINE_UNQUOTED(MPAGE_ENABLE, $oshmem_have_mpage,
[Whether we can use M-PAGE supported since MOFED 1.8])
if test "x$oshmem_have_mpage" = "x0"; then if test "x$oshmem_have_mpage" = "x0"; then
oshmem_verbs_sm_build_verbs=0 oshmem_verbs_sm_build_verbs=0
fi fi
]) ])
AC_DEFINE_UNQUOTED(MPAGE_ENABLE, $oshmem_have_mpage, [Whether we can use M-PAGE supported since MOFED 1.8])
exp_access_happy=0
exp_reg_mr_happy=0 exp_reg_mr_happy=0
AS_IF([test "$oshmem_have_mpage" = "3"], AS_IF([test "$oshmem_have_mpage" = "3"],
[ [
AC_CHECK_MEMBER([struct ibv_exp_reg_shared_mr_in.exp_access], AC_CHECK_MEMBER([struct ibv_exp_reg_shared_mr_in.exp_access],
[AC_DEFINE_UNQUOTED(MPAGE_HAVE_SMR_EXP_ACCESS, 1, [exp_access_happy=1],
[exp_access field is part of ibv_exp_reg_shared_mr_in]
)],
[], [],
[#include <infiniband/verbs_exp.h>]) [#include <infiniband/verbs_exp.h>])
@ -88,7 +84,8 @@ AC_DEFUN([MCA_oshmem_sshmem_verbs_CONFIG],[
[], [],
[#include <infiniband/verbs_exp.h>]) [#include <infiniband/verbs_exp.h>])
]) ])
AC_DEFINE_UNQUOTED(MPAGE_HAVE_IBV_EXP_REG_MR_CREATE_FLAGS, $exp_reg_mr_happy, [create_flags field is part of ibv_exp_reg_mr_in]), AC_DEFINE_UNQUOTED(MPAGE_HAVE_SMR_EXP_ACCESS, $exp_access_happy, [exp_access field is part of ibv_exp_reg_shared_mr_in])
AC_DEFINE_UNQUOTED(MPAGE_HAVE_IBV_EXP_REG_MR_CREATE_FLAGS, $exp_reg_mr_happy, [create_flags field is part of ibv_exp_reg_mr_in])
AS_IF([test "$enable_verbs_sshmem" = "yes" -a "$oshmem_verbs_sm_build_verbs" = "0"], AS_IF([test "$enable_verbs_sshmem" = "yes" -a "$oshmem_verbs_sm_build_verbs" = "0"],
[AC_MSG_WARN([VERBS shared memory support requested but not found]) [AC_MSG_WARN([VERBS shared memory support requested but not found])

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

@ -31,7 +31,7 @@ typedef struct openib_device_t {
struct ibv_mr *ib_mr_shared; struct ibv_mr *ib_mr_shared;
} openib_device_t; } openib_device_t;
#if defined(MPAGE_ENABLE) && (MPAGE_ENABLE > 0) #if (MPAGE_ENABLE > 0)
# if MPAGE_ENABLE < 3 # if MPAGE_ENABLE < 3
# define IBV_EXP_ACCESS_ALLOCATE_MR IBV_ACCESS_ALLOCATE_MR # define IBV_EXP_ACCESS_ALLOCATE_MR IBV_ACCESS_ALLOCATE_MR
@ -60,7 +60,7 @@ static inline void mca_sshmem_verbs_fill_shared_mr(struct ibv_exp_reg_shared_mr_
mr->pd = pd; mr->pd = pd;
mr->addr = addr; mr->addr = addr;
mr->mr_handle = handle; mr->mr_handle = handle;
#if defined(MPAGE_HAVE_SMR_EXP_ACCESS) #if (MPAGE_HAVE_SMR_EXP_ACCESS)
mr->exp_access = access; mr->exp_access = access;
#else #else
mr->access = access; mr->access = access;

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

@ -160,7 +160,7 @@ verbs_runtime_query(mca_base_module_t **module,
OBJ_CONSTRUCT(&device->ib_mr_array, opal_value_array_t); OBJ_CONSTRUCT(&device->ib_mr_array, opal_value_array_t);
opal_value_array_init(&device->ib_mr_array, sizeof(struct ibv_mr *)); opal_value_array_init(&device->ib_mr_array, sizeof(struct ibv_mr *));
#if defined(MPAGE_ENABLE) && (MPAGE_ENABLE > 0) #if (MPAGE_ENABLE > 0)
exp_access_flag = IBV_EXP_ACCESS_ALLOCATE_MR | exp_access_flag = IBV_EXP_ACCESS_ALLOCATE_MR |
IBV_EXP_ACCESS_SHARED_MR_USER_READ | IBV_EXP_ACCESS_SHARED_MR_USER_READ |
IBV_EXP_ACCESS_SHARED_MR_USER_WRITE; IBV_EXP_ACCESS_SHARED_MR_USER_WRITE;
@ -175,7 +175,7 @@ verbs_runtime_query(mca_base_module_t **module,
opal_value_array_append_item(&device->ib_mr_array, &ib_mr); opal_value_array_append_item(&device->ib_mr_array, &ib_mr);
} }
#if defined(MPAGE_ENABLE) && (MPAGE_ENABLE > 0) #if (MPAGE_ENABLE > 0)
if (!rc && mca_sshmem_verbs_component.has_shared_mr > 0) { if (!rc && mca_sshmem_verbs_component.has_shared_mr > 0) {
struct ibv_exp_reg_shared_mr_in in_smr; struct ibv_exp_reg_shared_mr_in in_smr;

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

@ -253,7 +253,7 @@ segment_create(map_segment_t *ds_buf,
OBJ_CONSTRUCT(&device->ib_mr_array, opal_value_array_t); OBJ_CONSTRUCT(&device->ib_mr_array, opal_value_array_t);
opal_value_array_init(&device->ib_mr_array, sizeof(struct ibv_mr *)); opal_value_array_init(&device->ib_mr_array, sizeof(struct ibv_mr *));
#if defined(MPAGE_ENABLE) && (MPAGE_ENABLE > 0) #if (MPAGE_ENABLE > 0)
exp_access_flag = IBV_EXP_ACCESS_ALLOCATE_MR | exp_access_flag = IBV_EXP_ACCESS_ALLOCATE_MR |
IBV_EXP_ACCESS_SHARED_MR_USER_READ | IBV_EXP_ACCESS_SHARED_MR_USER_READ |
IBV_EXP_ACCESS_SHARED_MR_USER_WRITE; IBV_EXP_ACCESS_SHARED_MR_USER_WRITE;
@ -282,7 +282,7 @@ segment_create(map_segment_t *ds_buf,
opal_value_array_append_item(&device->ib_mr_array, &ib_mr); opal_value_array_append_item(&device->ib_mr_array, &ib_mr);
} }
#if defined(MPAGE_ENABLE) && (MPAGE_ENABLE > 0) #if (MPAGE_ENABLE > 0)
if (!rc && mca_sshmem_verbs_component.has_shared_mr) { if (!rc && mca_sshmem_verbs_component.has_shared_mr) {
access_flag = IBV_ACCESS_LOCAL_WRITE | access_flag = IBV_ACCESS_LOCAL_WRITE |
IBV_ACCESS_REMOTE_WRITE | IBV_ACCESS_REMOTE_WRITE |