Commit 061a8599 authored by James Dinan's avatar James Dinan
Browse files

[svn-r10472] Implementation of Window get/set info

Implementation of MPI-3 window info query routines.

Reviewer: balaji
parent 54f231fb
......@@ -997,6 +997,8 @@ int MPI_Win_shared_query(MPI_Win win, int rank, MPI_Aint *size, int *disp_unit,
int MPI_Win_create_dynamic(MPI_Info info, MPI_Comm comm, MPI_Win *win);
int MPI_Win_attach(MPI_Win win, void *base, MPI_Aint size);
int MPI_Win_detach(MPI_Win win, const void *base);
int MPI_Win_get_info(MPI_Win win, MPI_Info *info_used);
int MPI_Win_set_info(MPI_Win win, MPI_Info info);
int MPI_Get_accumulate(const void *origin_addr, int origin_count,
MPI_Datatype origin_datatype, void *result_addr, int result_count,
......@@ -1458,6 +1460,8 @@ int PMPI_Win_shared_query(MPI_Win win, int rank, MPI_Aint *size, int *disp_unit,
int PMPI_Win_create_dynamic(MPI_Info info, MPI_Comm comm, MPI_Win *win);
int PMPI_Win_attach(MPI_Win win, void *base, MPI_Aint size);
int PMPI_Win_detach(MPI_Win win, const void *base);
int PMPI_Win_get_info(MPI_Win win, MPI_Info *info_used);
int PMPI_Win_set_info(MPI_Win win, MPI_Info info);
int PMPI_Get_accumulate(const void *origin_addr, int origin_count,
MPI_Datatype origin_datatype, void *result_addr, int result_count,
......
......@@ -1575,6 +1575,9 @@ typedef struct MPID_RMA_Ops {
int (*Win_detach)(struct MPID_Win *, const void *);
int (*Win_shared_query)(struct MPID_Win *, int, MPI_Aint *, int *, void *);
int (*Win_set_info)(struct MPID_Win *, MPID_Info *);
int (*Win_get_info)(struct MPID_Win *, MPID_Info **);
int (*Win_lock_all)(int, struct MPID_Win *);
int (*Win_unlock_all)(struct MPID_Win *);
......@@ -3255,6 +3258,8 @@ int MPID_Win_shared_query(MPID_Win *win, int rank, MPI_Aint *size, int *disp_uni
int MPID_Win_create_dynamic(MPID_Info *info, MPID_Comm *comm, MPID_Win **win);
int MPID_Win_attach(MPID_Win *win, void *base, MPI_Aint size);
int MPID_Win_detach(MPID_Win *win, const void *base);
int MPID_Win_get_info(MPID_Win *win, MPID_Info **info_used);
int MPID_Win_set_info(MPID_Win *win, MPID_Info *info);
int MPID_Get_accumulate(const void *origin_addr, int origin_count,
MPI_Datatype origin_datatype, void *result_addr, int result_count,
......
......@@ -1413,6 +1413,10 @@ is too big (> MPIU_SHMW_GHND_SZ)
**mpi_win_flush_local_all %W:MPI_Win_flush_local_all(%W) failed
**mpi_win_sync:MPI_Win_sync failed
**mpi_win_sync %W:MPI_Win_sync(%W) failed
**mpi_win_get_info:MPI_Win_get_info failed
**mpi_win_get_info %W %p:MPI_Win_get_info(win=%W, info_used=%p) failed
**mpi_win_set_info:MPI_Win_set_info failed
**mpi_win_set_info %W %I:MPI_Win_set_info(win=%W, info=%I) failed
# pmi2 errors
**bad_keyval:PMI2 received malformed key-value pair
......
......@@ -32,10 +32,12 @@ mpi_sources += \
src/mpi/rma/win_flush_local_all.c \
src/mpi/rma/win_free.c \
src/mpi/rma/win_get_group.c \
src/mpi/rma/win_get_info.c \
src/mpi/rma/win_get_name.c \
src/mpi/rma/win_lock.c \
src/mpi/rma/win_lock_all.c \
src/mpi/rma/win_post.c \
src/mpi/rma/win_set_info.c \
src/mpi/rma/win_set_name.c \
src/mpi/rma/win_shared_query.c \
src/mpi/rma/win_start.c \
......
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
*
* (C) 2012 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpiimpl.h"
/* -- Begin Profiling Symbol Block for routine MPI_Win_get_info */
#if defined(HAVE_PRAGMA_WEAK)
#pragma weak MPI_Win_get_info = PMPI_Win_get_info
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
#pragma _HP_SECONDARY_DEF PMPI_Win_get_info MPI_Win_get_info
#elif defined(HAVE_PRAGMA_CRI_DUP)
#pragma _CRI duplicate MPI_Win_get_info as PMPI_Win_get_info
#endif
/* -- End Profiling Symbol Block */
/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
the MPI routines */
#ifndef MPICH_MPI_FROM_PMPI
#undef MPI_Win_get_info
#define MPI_Win_get_info PMPI_Win_get_info
#endif
#undef FUNCNAME
#define FUNCNAME MPI_Win_get_info
/*@
MPI_Win_get_info - Returns a new info object containing the hints of the
window associated with win. The current setting of all hints actually used
by the system related to this window is returned in info_used. If no such
hints exist, a handle to a newly created info object is returned that
contains no key/value pair. The user is responsible for freeing info_used
via MPI_INFO_FREE.
Input Parameters:
. win - window object (handle)
Output Parameters:
. info - new info argument (handle)
.N ThreadSafe
.N Fortran
.N Errors
.N MPI_SUCCESS
.N MPI_ERR_ARG
.N MPI_ERR_WIN
.N MPI_ERR_INFO
.N MPI_ERR_OTHER
@*/
int MPI_Win_get_info(MPI_Win win, MPI_Info *info_used)
{
static const char FCNAME[] = "MPI_Win_get_info";
int mpi_errno = MPI_SUCCESS;
MPID_Win *win_ptr = NULL;
MPID_Info *info_ptr = NULL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_WIN_GET_INFO);
MPIR_ERRTEST_INITIALIZED_ORDIE();
MPIU_THREAD_CS_ENTER(ALLFUNC,);
MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_GET_INFO);
/* Validate parameters, especially handles needing to be converted */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
MPIR_ERRTEST_ARGNULL(info_used, "info", mpi_errno);
}
MPID_END_ERROR_CHECKS;
}
# endif /* HAVE_ERROR_CHECKING */
/* Convert MPI object handles to object pointers */
MPID_Win_get_ptr( win, win_ptr );
/* Validate parameters and objects (post conversion) */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
/* Validate pointers */
MPID_Win_valid_ptr( win_ptr, mpi_errno );
if (mpi_errno) goto fn_fail;
}
MPID_END_ERROR_CHECKS;
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
mpi_errno = MPID_Win_get_info(win_ptr, &info_ptr);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
*info_used = info_ptr->handle;
/* ... end of body of routine ... */
fn_exit:
MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_GET_INFO);
MPIU_THREAD_CS_EXIT(ALLFUNC,);
return mpi_errno;
fn_fail:
/* --BEGIN ERROR HANDLING-- */
# ifdef HAVE_ERROR_CHECKING
{
mpi_errno = MPIR_Err_create_code(
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
"**mpi_win_get_info", "**mpi_win_get_info %W %p", win, info_used);
}
# endif
mpi_errno = MPIR_Err_return_win( win_ptr, FCNAME, mpi_errno );
goto fn_exit;
/* --END ERROR HANDLING-- */
}
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
*
* (C) 2012 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpiimpl.h"
/* -- Begin Profiling Symbol Block for routine MPI_Win_set_info */
#if defined(HAVE_PRAGMA_WEAK)
#pragma weak MPI_Win_set_info = PMPI_Win_set_info
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
#pragma _HP_SECONDARY_DEF PMPI_Win_set_info MPI_Win_set_info
#elif defined(HAVE_PRAGMA_CRI_DUP)
#pragma _CRI duplicate MPI_Win_set_info as PMPI_Win_set_info
#endif
/* -- End Profiling Symbol Block */
/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
the MPI routines */
#ifndef MPICH_MPI_FROM_PMPI
#undef MPI_Win_set_info
#define MPI_Win_set_info PMPI_Win_set_info
#endif
#undef FUNCNAME
#define FUNCNAME MPI_Win_set_info
/*@
MPI_Win_set_info - Set new values for the hints of the window associated
with win. The call is collective on the group of win. The info object may
be different on each process, but any info entries that an implementation
requires to be the same on all processes must appear with the same value in
each process's info object.
Input Parameters:
+ win - window object (handle)
- info - info argument (handle)
.N ThreadSafe
.N Fortran
.N Errors
.N MPI_SUCCESS
.N MPI_ERR_ARG
.N MPI_ERR_WIN
.N MPI_ERR_INFO
.N MPI_ERR_OTHER
@*/
int MPI_Win_set_info(MPI_Win win, MPI_Info info)
{
static const char FCNAME[] = "MPI_Win_set_info";
int mpi_errno = MPI_SUCCESS;
MPID_Win *win_ptr = NULL;
MPID_Info *info_ptr = NULL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_WIN_SET_INFO);
MPIR_ERRTEST_INITIALIZED_ORDIE();
MPIU_THREAD_CS_ENTER(ALLFUNC,);
MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_SET_INFO);
/* Validate parameters, especially handles needing to be converted */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
MPIR_ERRTEST_INFO(info, mpi_errno);
}
MPID_END_ERROR_CHECKS;
}
# endif /* HAVE_ERROR_CHECKING */
/* Convert MPI object handles to object pointers */
MPID_Win_get_ptr( win, win_ptr );
MPID_Info_get_ptr( info, info_ptr );
/* Validate parameters and objects (post conversion) */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
/* Validate pointers */
MPID_Win_valid_ptr( win_ptr, mpi_errno );
if (mpi_errno) goto fn_fail;
MPID_Info_valid_ptr( info_ptr, mpi_errno );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
}
MPID_END_ERROR_CHECKS;
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
mpi_errno = MPID_Win_set_info(win_ptr, info_ptr);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
/* ... end of body of routine ... */
fn_exit:
MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_SET_INFO);
MPIU_THREAD_CS_EXIT(ALLFUNC,);
return mpi_errno;
fn_fail:
/* --BEGIN ERROR HANDLING-- */
# ifdef HAVE_ERROR_CHECKING
{
mpi_errno = MPIR_Err_create_code(
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
"**mpi_win_set_info", "**mpi_win_set_info %W %I", win, info);
}
# endif
mpi_errno = MPIR_Err_return_win( win_ptr, FCNAME, mpi_errno );
goto fn_exit;
/* --END ERROR HANDLING-- */
}
......@@ -1180,6 +1180,9 @@ int MPIDI_Win_attach(MPID_Win *win, void *base, MPI_Aint size);
int MPIDI_Win_detach(MPID_Win *win, const void *base);
int MPIDI_Win_shared_query(MPID_Win *win_ptr, int rank, MPI_Aint *size, int *disp_unit, void *base);
int MPIDI_Win_set_info(MPID_Win *win, MPID_Info *info);
int MPIDI_Win_get_info(MPID_Win *win, MPID_Info **info_used);
int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
MPI_Datatype origin_datatype, void *result_addr, int result_count,
MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp,
......
......@@ -189,6 +189,26 @@ enum MPIDI_CH3_Lock_states_e {
MPIDI_CH3_WIN_LOCK_FLUSH
};
enum MPIDI_Win_info_arv_vals_accumulate_ordering_e {
MPIDI_ACC_ORDER_RAR = 1,
MPIDI_ACC_ORDER_RAW = 2,
MPIDI_ACC_ORDER_WAR = 4,
MPIDI_ACC_ORDER_WAW = 8
};
enum MPIDI_Win_info_arg_vals_accumulate_ops_e {
MPIDI_ACC_OPS_SAME_OP,
MPIDI_ACC_OPS_SAME_OP_NO_OP
};
struct MPIDI_Win_info_args_s {
int no_locks; /* valid flavor = all */
int accumulate_ordering;
int accumulate_ops;
int same_size; /* valid flavor = allocate */
int alloc_shared_noncontig; /* valid flavor = allocate shared */
};
#define MPIDI_DEV_WIN_DECL \
volatile int my_counter; /* completion counter for operations \
targeting this window */ \
......@@ -221,8 +241,8 @@ enum MPIDI_CH3_Lock_states_e {
that this process has \
completed as target */ \
MPI_Aint *sizes; /* array of sizes of all windows */ \
struct MPIDI_Win_info_args_s info_args; \
#ifdef MPIDI_CH3_WIN_DECL
#define MPID_DEV_WIN_DECL \
MPIDI_DEV_WIN_DECL \
......
......@@ -5,6 +5,7 @@
*/
#include "mpidimpl.h"
#include "mpiinfo.h"
#include "mpidrma.h"
#ifdef USE_MPIU_INSTR
......@@ -52,6 +53,9 @@ int MPIDI_CH3U_Win_create_gather( void *base, MPI_Aint size, int disp_unit,
comm_size = (*win_ptr)->comm_ptr->local_size;
rank = (*win_ptr)->comm_ptr->rank;
/* RMA handlers should be set before calling this function */
mpi_errno = (*win_ptr)->RMAFns.Win_set_info(*win_ptr, info);
MPIU_INSTR_DURATION_START(wincreate_allgather);
/* allocate memory for the base addresses, disp_units, and
completion counters of all processes */
......@@ -270,3 +274,97 @@ fn_fail:
goto fn_exit;
/* --END ERROR HANDLING-- */
}
#undef FUNCNAME
#define FUNCNAME MPIDI_Win_set_info
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_Win_set_info(MPID_Win *win, MPID_Info *info)
{
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_SET_INFO);
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_WIN_SET_INFO);
/* No op, info arguments are ignored by default */
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_WIN_SET_INFO);
return mpi_errno;
fn_fail:
goto fn_exit;
}
#undef FUNCNAME
#define FUNCNAME MPIDI_Win_get_info
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_Win_get_info(MPID_Win *win, MPID_Info **info_used)
{
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_GET_INFO);
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_WIN_GET_INFO);
/* Allocate an empty info object */
mpi_errno = MPIU_Info_alloc(info_used);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
/* Populate the predefined info keys */
if (win->info_args.no_locks)
mpi_errno = MPI_Info_set((*info_used)->handle, "no_locks", "true");
else
mpi_errno = MPI_Info_set((*info_used)->handle, "no_locks", "");
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
{
#define BUFSIZE 32
char buf[BUFSIZE];
int c = 0;
if (win->info_args.accumulate_ordering & MPIDI_ACC_ORDER_RAR)
c += snprintf(buf+c, BUFSIZE-c, "%srar", (c > 0) ? "," : "");
if (win->info_args.accumulate_ordering & MPIDI_ACC_ORDER_RAW)
c += snprintf(buf+c, BUFSIZE-c, "%sraw", (c > 0) ? "," : "");
if (win->info_args.accumulate_ordering & MPIDI_ACC_ORDER_WAR)
c += snprintf(buf+c, BUFSIZE-c, "%swar", (c > 0) ? "," : "");
if (win->info_args.accumulate_ordering & MPIDI_ACC_ORDER_WAW)
c += snprintf(buf+c, BUFSIZE-c, "%swaw", (c > 0) ? "," : "");
MPI_Info_set((*info_used)->handle, "accumulate_ordering", buf);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
#undef BUFSIZE
}
if (win->info_args.accumulate_ordering == MPIDI_ACC_OPS_SAME_OP)
mpi_errno = MPI_Info_set((*info_used)->handle, "accumulate_ops", "same_op");
else
mpi_errno = MPI_Info_set((*info_used)->handle, "accumulate_ops", "same_op_no_op");
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
if (win->create_flavor == MPI_WIN_FLAVOR_SHARED) {
if (win->info_args.alloc_shared_noncontig)
mpi_errno = MPI_Info_set((*info_used)->handle, "alloc_shared_noncontig", "true");
else
mpi_errno = MPI_Info_set((*info_used)->handle, "alloc_shared_noncontig", "");
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
}
else if (win->create_flavor == MPI_WIN_FLAVOR_ALLOCATE) {
if (win->info_args.same_size)
mpi_errno = MPI_Info_set((*info_used)->handle, "same_size", "true");
else
mpi_errno = MPI_Info_set((*info_used)->handle, "same_size", "");
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
}
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_WIN_GET_INFO);
return mpi_errno;
fn_fail:
goto fn_exit;
}
......@@ -32,6 +32,9 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
ftable->Win_detach = MPIDI_Win_detach; \
ftable->Win_shared_query = MPIDI_Win_shared_query; \
\
ftable->Win_set_info = MPIDI_Win_set_info; \
ftable->Win_get_info = MPIDI_Win_get_info; \
\
ftable->Put = MPIDI_Put; \
ftable->Get = MPIDI_Get; \
ftable->Accumulate = MPIDI_Accumulate; \
......@@ -278,6 +281,14 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
(*win_ptr)->pt_rma_puts_accs = NULL;
(*win_ptr)->my_pt_rma_puts_accs = 0;
/* Initialize the info flags */
(*win_ptr)->info_args.no_locks = 0;
(*win_ptr)->info_args.accumulate_ordering = MPIDI_ACC_ORDER_RAR | MPIDI_ACC_ORDER_RAW |
MPIDI_ACC_ORDER_WAR | MPIDI_ACC_ORDER_WAW;
(*win_ptr)->info_args.accumulate_ops = MPIDI_ACC_OPS_SAME_OP_NO_OP;
(*win_ptr)->info_args.same_size = 0;
(*win_ptr)->info_args.alloc_shared_noncontig = 0;
MPID_WIN_FTABLE_SET_DEFAULTS(win_ptr);
fn_exit:
......@@ -286,3 +297,47 @@ fn_exit:
fn_fail:
goto fn_exit;
}
#undef FUNCNAME
#define FUNCNAME MPID_Win_set_info
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPID_Win_set_info(MPID_Win *win, MPID_Info *info)
{
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPID_WIN_SET_INFO);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_WIN_SET_INFO);
mpi_errno = win->RMAFns.Win_set_info(win, info);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_WIN_SET_INFO);
return mpi_errno;
fn_fail:
goto fn_exit;
}
#undef FUNCNAME
#define FUNCNAME MPID_Win_get_info
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPID_Win_get_info(MPID_Win *win, MPID_Info **info_used)
{
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPID_WIN_GET_INFO);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_WIN_GET_INFO);
mpi_errno = win->RMAFns.Win_get_info(win, info_used);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_WIN_GET_INFO);
return mpi_errno;
fn_fail:
goto fn_exit;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment