1
1

Merge one-sided updates to the trunk - written by Brian Barrett and Nathan Hjelmn

cmr=v1.7.5:reviewer=hjelmn:subject=Update one-sided to MPI-3

This commit was SVN r30816.
This commit is contained in:
Ralph Castain 2014-02-25 17:36:43 +00:00
parent 202bf90287
commit 49d938de29
132 changed files with 13242 additions and 8659 deletions

5
RMA_TODO.txt Normal file
View File

@ -0,0 +1,5 @@
- Support non-contiguous operations in Portals4 implementation
- Add memory barriers where needed in synchronization primitives of
Portals4 implementation
- Re-implement rdma component

View File

@ -127,6 +127,8 @@ int ompi_attr_create_predefined(void)
OMPI_SUCCESS != (ret = create_win(MPI_WIN_BASE)) ||
OMPI_SUCCESS != (ret = create_win(MPI_WIN_SIZE)) ||
OMPI_SUCCESS != (ret = create_win(MPI_WIN_DISP_UNIT)) ||
OMPI_SUCCESS != (ret = create_win(MPI_WIN_CREATE_FLAVOR)) ||
OMPI_SUCCESS != (ret = create_win(MPI_WIN_MODEL)) ||
#if 0
/* JMS For when we implement IMPI */
OMPI_SUCCESS != (ret = create_comm(IMPI_CLIENT_SIZE, true)) ||
@ -193,6 +195,8 @@ int ompi_attr_free_predefined(void)
OMPI_SUCCESS != (ret = free_win(MPI_WIN_BASE)) ||
OMPI_SUCCESS != (ret = free_win(MPI_WIN_SIZE)) ||
OMPI_SUCCESS != (ret = free_win(MPI_WIN_DISP_UNIT)) ||
OMPI_SUCCESS != (ret = free_win(MPI_WIN_CREATE_FLAVOR)) ||
OMPI_SUCCESS != (ret = free_win(MPI_WIN_MODEL)) ||
#if 0
/* JMS For when we implement IMPI */
OMPI_SUCCESS != (ret = free_comm(IMPI_CLIENT_SIZE)) ||

View File

@ -128,11 +128,7 @@ int main(int argc, char **argv) {
GAP_CHECK("w_f_to_c_index", test_win, w_f_to_c_index, w_keyhash, 1);
GAP_CHECK("error_handler", test_win, error_handler, w_f_to_c_index, 1);
GAP_CHECK("errhandler_type", test_win, errhandler_type, error_handler, 1);
GAP_CHECK("w_disp_unit", test_win, w_disp_unit, errhandler_type, 1);
GAP_CHECK("w_baseptr", test_win, w_baseptr, w_disp_unit, 1);
GAP_CHECK("w_size", test_win, w_size, w_baseptr, 1);
GAP_CHECK("w_mode", test_win, w_mode, w_size, 1);
GAP_CHECK("w_osc_module", test_win, w_osc_module, w_size, 1);
GAP_CHECK("w_osc_module", test_win, w_osc_module, errhandler_type, 1);
/* Test Predefined info sizes */
printf("=============================================\n");

View File

@ -107,6 +107,9 @@ ompi_mpi_errcode_t ompi_t_err_cvar_set_never;
ompi_mpi_errcode_t ompi_t_err_pvar_no_startstop;
ompi_mpi_errcode_t ompi_t_err_pvar_no_write;
ompi_mpi_errcode_t ompi_t_err_pvar_no_atomic;
ompi_mpi_errcode_t ompi_err_rma_range;
ompi_mpi_errcode_t ompi_err_rma_attach;
ompi_mpi_errcode_t ompi_err_rma_flavor;
static void ompi_mpi_errcode_construct(ompi_mpi_errcode_t* errcode);
static void ompi_mpi_errcode_destruct(ompi_mpi_errcode_t* errcode);
@ -202,6 +205,9 @@ int ompi_mpi_errcode_init (void)
CONSTRUCT_ERRCODE( ompi_t_err_pvar_no_startstop, MPI_T_ERR_PVAR_NO_STARTSTOP, "MPI_T_ERR_PVAR_NO_STARTSTOP: variable cannot be started or stopped" );
CONSTRUCT_ERRCODE( ompi_t_err_pvar_no_write, MPI_T_ERR_PVAR_NO_WRITE, "MPI_T_ERR_PVAR_NO_WRITE: variable cannot be written or reset" );
CONSTRUCT_ERRCODE( ompi_t_err_pvar_no_atomic, MPI_T_ERR_PVAR_NO_ATOMIC, "MPI_T_ERR_PVAR_NO_ATOMIC: variable cannot be read and written atomically" );
CONSTRUCT_ERRCODE( ompi_err_rma_range, MPI_ERR_RMA_RANGE, "MPI_ERR_RMA_RANGE: invalid RMA address range" );
CONSTRUCT_ERRCODE( ompi_err_rma_attach, MPI_ERR_RMA_ATTACH, "MPI_ERR_RMA_ATTACH: Could not attach RMA segment" );
CONSTRUCT_ERRCODE( ompi_err_rma_flavor, MPI_ERR_RMA_FLAVOR, "MPI_ERR_RMA_FLAVOR: Invalid type of window" );
/* Per MPI-3 p353:27-32, MPI_LASTUSEDCODE must be >=
MPI_ERR_LASTCODE. So just start it as == MPI_ERR_LASTCODE. */
@ -292,6 +298,9 @@ int ompi_mpi_errcode_finalize(void)
OBJ_DESTRUCT(&ompi_t_err_pvar_no_startstop);
OBJ_DESTRUCT(&ompi_t_err_pvar_no_write);
OBJ_DESTRUCT(&ompi_t_err_pvar_no_atomic);
OBJ_DESTRUCT(&ompi_err_rma_range);
OBJ_DESTRUCT(&ompi_err_rma_attach);
OBJ_DESTRUCT(&ompi_err_rma_flavor);
OBJ_DESTRUCT(&ompi_mpi_errcodes);
return OMPI_SUCCESS;

View File

@ -13,7 +13,7 @@
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2009-2012 Oak Rigde National Laboratory. All rights reserved.
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos Nat Security, LLC. All rights reserved.
* Copyright (c) 2012-2014 Los Alamos Nat Security, LLC. All rights reserved.
* Copyright (c) 2011-2013 INRIA. All rights reserved.
* $COPYRIGHT$
*
@ -488,6 +488,13 @@ typedef int (MPI_Grequest_cancel_function)(void *, int);
#define MPI_LOCK_EXCLUSIVE 1
#define MPI_LOCK_SHARED 2
#define MPI_WIN_FLAVOR_CREATE 1
#define MPI_WIN_FLAVOR_ALLOCATE 2
#define MPI_WIN_FLAVOR_DYNAMIC 3
#define MPI_WIN_FLAVOR_SHARED 4
#define MPI_WIN_UNIFIED 0
#define MPI_WIN_SEPARATE 1
/*
* Predefined attribute keyvals
@ -509,6 +516,8 @@ enum {
MPI_WIN_BASE,
MPI_WIN_SIZE,
MPI_WIN_DISP_UNIT,
MPI_WIN_CREATE_FLAVOR,
MPI_WIN_MODEL,
/* Even though these four are IMPI attributes, they need to be there
for all MPI jobs */
@ -590,10 +599,14 @@ enum {
#define MPI_T_ERR_PVAR_NO_STARTSTOP 65
#define MPI_T_ERR_PVAR_NO_WRITE 66
#define MPI_T_ERR_PVAR_NO_ATOMIC 67
#define MPI_ERR_RMA_RANGE 68
#define MPI_ERR_RMA_ATTACH 69
#define MPI_ERR_RMA_FLAVOR 70
/* Per MPI-3 p349 47, MPI_ERR_LASTCODE must be >= the last predefined
MPI_ERR_<foo> code. So just set it equal to the last code --
MPI_T_ERR_PVAR_NO_ATOMIC, in this case. */
#define MPI_ERR_LASTCODE MPI_T_ERR_PVAR_NO_ATOMIC
MPI_ERR_RMA_FLAVOR, in this case. */
#define MPI_ERR_LASTCODE MPI_ERR_RMA_FLAVOR
#define MPI_ERR_SYSRESOURCE -2
@ -888,6 +901,7 @@ OMPI_DECLSPEC extern struct ompi_predefined_op_t ompi_mpi_op_bxor;
OMPI_DECLSPEC extern struct ompi_predefined_op_t ompi_mpi_op_maxloc;
OMPI_DECLSPEC extern struct ompi_predefined_op_t ompi_mpi_op_minloc;
OMPI_DECLSPEC extern struct ompi_predefined_op_t ompi_mpi_op_replace;
OMPI_DECLSPEC extern struct ompi_predefined_op_t ompi_mpi_op_no_op;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_datatype_null;
@ -1019,6 +1033,7 @@ OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE;
#define MPI_MAXLOC OMPI_PREDEFINED_GLOBAL(MPI_Op, ompi_mpi_op_maxloc)
#define MPI_MINLOC OMPI_PREDEFINED_GLOBAL(MPI_Op, ompi_mpi_op_minloc)
#define MPI_REPLACE OMPI_PREDEFINED_GLOBAL(MPI_Op, ompi_mpi_op_replace)
#define MPI_NO_OP OMPI_PREDEFINED_GLOBAL(MPI_Op, ompi_mpi_op_no_op)
/* C datatypes */
#define MPI_DATATYPE_NULL OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_datatype_null)
@ -1298,6 +1313,9 @@ OMPI_DECLSPEC int MPI_Comm_spawn_multiple(int count, char *array_of_commands[],
OMPI_DECLSPEC int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm);
OMPI_DECLSPEC int MPI_Comm_split_type(MPI_Comm comm, int split_type, int key, MPI_Info info, MPI_Comm *newcomm);
OMPI_DECLSPEC int MPI_Comm_test_inter(MPI_Comm comm, int *flag);
OMPI_DECLSPEC int MPI_Compare_and_swap(void *origin_addr, void *compare_addr,
void *result_addr, MPI_Datatype datatype, int target_rank,
MPI_Aint target_disp, MPI_Win win);
OMPI_DECLSPEC int MPI_Dims_create(int nnodes, int ndims, int dims[]);
OMPI_DECLSPEC MPI_Fint MPI_Errhandler_c2f(MPI_Errhandler errhandler);
OMPI_DECLSPEC int MPI_Errhandler_create(MPI_Handler_function *function,
@ -1313,6 +1331,8 @@ OMPI_DECLSPEC int MPI_Error_class(int errorcode, int *errorclass);
OMPI_DECLSPEC int MPI_Error_string(int errorcode, char *string, int *resultlen);
OMPI_DECLSPEC int MPI_Exscan(const void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
OMPI_DECLSPEC int MPI_Fetch_and_op(void *origin_addr, void *result_addr, MPI_Datatype datatype,
int target_rank, MPI_Aint target_disp, MPI_Op op, MPI_Win win);
OMPI_DECLSPEC int MPI_Iexscan(const void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request);
#if OMPI_PROVIDE_MPI_FILE_INTERFACE
@ -1428,6 +1448,10 @@ OMPI_DECLSPEC int MPI_Get(void *origin_addr, int origin_count,
MPI_Datatype origin_datatype, int target_rank,
MPI_Aint target_disp, int target_count,
MPI_Datatype target_datatype, MPI_Win win);
OMPI_DECLSPEC int MPI_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, int target_count,
MPI_Datatype target_datatype, MPI_Op op, MPI_Win win);
OMPI_DECLSPEC int MPI_Get_library_version(char *version, int *resultlen);
OMPI_DECLSPEC int MPI_Get_processor_name(char *name, int *resultlen);
OMPI_DECLSPEC int MPI_Get_version(int *version, int *subversion);
@ -1575,6 +1599,9 @@ OMPI_DECLSPEC int MPI_Put(const void *origin_addr, int origin_count, MPI_Dataty
int target_rank, MPI_Aint target_disp, int target_count,
MPI_Datatype target_datatype, MPI_Win win);
OMPI_DECLSPEC int MPI_Query_thread(int *provided);
OMPI_DECLSPEC int MPI_Raccumulate(void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
int target_rank, MPI_Aint target_disp, int target_count,
MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request *request);
OMPI_DECLSPEC int MPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Request *request);
OMPI_DECLSPEC int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source,
@ -1603,6 +1630,17 @@ OMPI_DECLSPEC MPI_Request MPI_Request_f2c(MPI_Fint request);
OMPI_DECLSPEC int MPI_Request_free(MPI_Request *request);
OMPI_DECLSPEC int MPI_Request_get_status(MPI_Request request, int *flag,
MPI_Status *status);
OMPI_DECLSPEC int MPI_Rget(void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype,
MPI_Win win, MPI_Request *request);
OMPI_DECLSPEC int MPI_Rget_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, int target_count,
MPI_Datatype target_datatype, MPI_Op op,
MPI_Win win, MPI_Request *request);
OMPI_DECLSPEC int MPI_Rput(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
int target_rank, MPI_Aint target_disp, int target_cout,
MPI_Datatype target_datatype, MPI_Win win, MPI_Request *request);
OMPI_DECLSPEC int MPI_Rsend(const void *ibuf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm);
OMPI_DECLSPEC int MPI_Rsend_init(const void *buf, int count, MPI_Datatype datatype,
@ -1768,39 +1806,55 @@ OMPI_DECLSPEC int MPI_Wait(MPI_Request *request, MPI_Status *status);
OMPI_DECLSPEC int MPI_Waitsome(int incount, MPI_Request array_of_requests[],
int *outcount, int array_of_indices[],
MPI_Status array_of_statuses[]);
OMPI_DECLSPEC int MPI_Win_allocate(MPI_Aint size, int disp_unit, MPI_Info info,
MPI_Comm comm, void *baseptr, MPI_Win *win);
OMPI_DECLSPEC int MPI_Win_allocate_shared(MPI_Aint size, int disp_unit, MPI_Info info,
MPI_Comm comm, void *baseptr, MPI_Win *win);
OMPI_DECLSPEC int MPI_Win_attach(MPI_Win win, void *base, MPI_Aint size);
OMPI_DECLSPEC MPI_Fint MPI_Win_c2f(MPI_Win win);
OMPI_DECLSPEC int MPI_Win_call_errhandler(MPI_Win win, int errorcode);
OMPI_DECLSPEC int MPI_Win_complete(MPI_Win win);
OMPI_DECLSPEC int MPI_Win_create(void *base, MPI_Aint size, int disp_unit,
MPI_Info info, MPI_Comm comm, MPI_Win *win);
OMPI_DECLSPEC int MPI_Win_create_dynamic(MPI_Info info, MPI_Comm comm, MPI_Win *win);
OMPI_DECLSPEC int MPI_Win_create_errhandler(MPI_Win_errhandler_function *function,
MPI_Errhandler *errhandler);
OMPI_DECLSPEC int MPI_Win_create_keyval(MPI_Win_copy_attr_function *win_copy_attr_fn,
MPI_Win_delete_attr_function *win_delete_attr_fn,
int *win_keyval, void *extra_state);
OMPI_DECLSPEC int MPI_Win_delete_attr(MPI_Win win, int win_keyval);
OMPI_DECLSPEC int MPI_Win_detach(MPI_Win win, void *base);
OMPI_DECLSPEC MPI_Win MPI_Win_f2c(MPI_Fint win);
OMPI_DECLSPEC int MPI_Win_fence(int assert, MPI_Win win);
OMPI_DECLSPEC int MPI_Win_flush(int rank, MPI_Win win);
OMPI_DECLSPEC int MPI_Win_flush_all(MPI_Win win);
OMPI_DECLSPEC int MPI_Win_flush_local(int rank, MPI_Win win);
OMPI_DECLSPEC int MPI_Win_flush_local_all(MPI_Win win);
OMPI_DECLSPEC int MPI_Win_free(MPI_Win *win);
OMPI_DECLSPEC int MPI_Win_free_keyval(int *win_keyval);
OMPI_DECLSPEC int MPI_Win_get_attr(MPI_Win win, int win_keyval,
void *attribute_val, int *flag);
OMPI_DECLSPEC int MPI_Win_get_errhandler(MPI_Win win, MPI_Errhandler *errhandler);
OMPI_DECLSPEC int MPI_Win_get_group(MPI_Win win, MPI_Group *group);
OMPI_DECLSPEC int MPI_Win_get_info(MPI_Win win, MPI_Info *info_used);
OMPI_DECLSPEC int MPI_Win_get_name(MPI_Win win, char *win_name, int *resultlen);
OMPI_DECLSPEC int MPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win);
OMPI_DECLSPEC int MPI_Win_lock_all(int assert, MPI_Win win);
OMPI_DECLSPEC int MPI_Win_post(MPI_Group group, int assert, MPI_Win win);
OMPI_DECLSPEC int MPI_Win_set_attr(MPI_Win win, int win_keyval, void *attribute_val);
OMPI_DECLSPEC int MPI_Win_set_errhandler(MPI_Win win, MPI_Errhandler errhandler);
OMPI_DECLSPEC int MPI_Win_set_info(MPI_Win win, MPI_Info info);
OMPI_DECLSPEC int MPI_Win_set_name(MPI_Win win, const char *win_name);
OMPI_DECLSPEC int MPI_Win_shared_query(MPI_Win win, int rank, MPI_Aint *size, int *disp_unit, void *baseptr);
OMPI_DECLSPEC int MPI_Win_start(MPI_Group group, int assert, MPI_Win win);
OMPI_DECLSPEC int MPI_Win_sync(MPI_Win win);
OMPI_DECLSPEC int MPI_Win_test(MPI_Win win, int *flag);
OMPI_DECLSPEC int MPI_Win_unlock(int rank, MPI_Win win);
OMPI_DECLSPEC int MPI_Win_unlock_all(MPI_Win win);
OMPI_DECLSPEC int MPI_Win_wait(MPI_Win win);
OMPI_DECLSPEC double MPI_Wtick(void);
OMPI_DECLSPEC double MPI_Wtime(void);
/*
* Profiling MPI API
*/
@ -1949,6 +2003,9 @@ OMPI_DECLSPEC int PMPI_Comm_spawn_multiple(int count, char *array_of_commands[]
OMPI_DECLSPEC int PMPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm);
OMPI_DECLSPEC int PMPI_Comm_split_type(MPI_Comm comm, int split_type, int key, MPI_Info info, MPI_Comm *newcomm);
OMPI_DECLSPEC int PMPI_Comm_test_inter(MPI_Comm comm, int *flag);
OMPI_DECLSPEC int PMPI_Compare_and_swap(void *origin_addr, void *compare_addr,
void *result_addr, MPI_Datatype datatype, int target_rank,
MPI_Aint target_disp, MPI_Win win);
OMPI_DECLSPEC int PMPI_Dims_create(int nnodes, int ndims, int dims[]);
OMPI_DECLSPEC MPI_Fint PMPI_Errhandler_c2f(MPI_Errhandler errhandler);
OMPI_DECLSPEC int PMPI_Errhandler_create(MPI_Handler_function *function,
@ -1964,6 +2021,8 @@ OMPI_DECLSPEC int PMPI_Error_class(int errorcode, int *errorclass);
OMPI_DECLSPEC int PMPI_Error_string(int errorcode, char *string, int *resultlen);
OMPI_DECLSPEC int PMPI_Exscan(const void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
OMPI_DECLSPEC int PMPI_Fetch_and_op(void *origin_addr, void *result_addr, MPI_Datatype datatype,
int target_rank, MPI_Aint target_disp, MPI_Op op, MPI_Win win);
OMPI_DECLSPEC int PMPI_Iexscan(const void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request);
#if OMPI_PROVIDE_MPI_FILE_INTERFACE
@ -2081,6 +2140,10 @@ OMPI_DECLSPEC int PMPI_Get(void *origin_addr, int origin_count,
MPI_Datatype origin_datatype, int target_rank,
MPI_Aint target_disp, int target_count,
MPI_Datatype target_datatype, MPI_Win win);
OMPI_DECLSPEC int PMPI_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, int target_count,
MPI_Datatype target_datatype, MPI_Op op, MPI_Win win);
OMPI_DECLSPEC int PMPI_Get_library_version(char *version, int *resultlen);
OMPI_DECLSPEC int PMPI_Get_processor_name(char *name, int *resultlen);
OMPI_DECLSPEC int PMPI_Get_version(int *version, int *subversion);
@ -2228,6 +2291,9 @@ OMPI_DECLSPEC int PMPI_Put(const void *origin_addr, int origin_count, MPI_Datat
int target_rank, MPI_Aint target_disp, int target_count,
MPI_Datatype target_datatype, MPI_Win win);
OMPI_DECLSPEC int PMPI_Query_thread(int *provided);
OMPI_DECLSPEC int PMPI_Raccumulate(void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
int target_rank, MPI_Aint target_disp, int target_count,
MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request *request);
OMPI_DECLSPEC int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Request *request);
OMPI_DECLSPEC int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int source,
@ -2256,6 +2322,17 @@ OMPI_DECLSPEC MPI_Request PMPI_Request_f2c(MPI_Fint request);
OMPI_DECLSPEC int PMPI_Request_free(MPI_Request *request);
OMPI_DECLSPEC int PMPI_Request_get_status(MPI_Request request, int *flag,
MPI_Status *status);
OMPI_DECLSPEC int PMPI_Rget(void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype,
MPI_Win win, MPI_Request *request);
OMPI_DECLSPEC int PMPI_Rget_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, int target_count,
MPI_Datatype target_datatype, MPI_Op op,
MPI_Win win, MPI_Request *request);
OMPI_DECLSPEC int PMPI_Rput(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
int target_rank, MPI_Aint target_disp, int target_cout,
MPI_Datatype target_datatype, MPI_Win win, MPI_Request *request);
OMPI_DECLSPEC int PMPI_Rsend(const void *ibuf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm);
OMPI_DECLSPEC int PMPI_Rsend_init(const void *buf, int count, MPI_Datatype datatype,
@ -2421,34 +2498,51 @@ OMPI_DECLSPEC int PMPI_Wait(MPI_Request *request, MPI_Status *status);
OMPI_DECLSPEC int PMPI_Waitsome(int incount, MPI_Request array_of_requests[],
int *outcount, int array_of_indices[],
MPI_Status array_of_statuses[]);
OMPI_DECLSPEC int PMPI_Win_allocate(MPI_Aint size, int disp_unit, MPI_Info info,
MPI_Comm comm, void *baseptr, MPI_Win *win);
OMPI_DECLSPEC int PMPI_Win_allocate_shared(MPI_Aint size, int disp_unit, MPI_Info info,
MPI_Comm comm, void *baseptr, MPI_Win *win);
OMPI_DECLSPEC int PMPI_Win_attach(MPI_Win win, void *base, MPI_Aint size);
OMPI_DECLSPEC MPI_Fint PMPI_Win_c2f(MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_call_errhandler(MPI_Win win, int errorcode);
OMPI_DECLSPEC int PMPI_Win_complete(MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_create(void *base, MPI_Aint size, int disp_unit,
MPI_Info info, MPI_Comm comm, MPI_Win *win);
OMPI_DECLSPEC int PMPI_Win_create_dynamic(MPI_Info info, MPI_Comm comm, MPI_Win *win);
OMPI_DECLSPEC int PMPI_Win_create_errhandler(MPI_Win_errhandler_function *function,
MPI_Errhandler *errhandler);
OMPI_DECLSPEC int PMPI_Win_create_keyval(MPI_Win_copy_attr_function *win_copy_attr_fn,
MPI_Win_delete_attr_function *win_delete_attr_fn,
int *win_keyval, void *extra_state);
OMPI_DECLSPEC int PMPI_Win_delete_attr(MPI_Win win, int win_keyval);
OMPI_DECLSPEC int PMPI_Win_detach(MPI_Win win, void *base);
OMPI_DECLSPEC MPI_Win PMPI_Win_f2c(MPI_Fint win);
OMPI_DECLSPEC int PMPI_Win_fence(int assert, MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_flush(int rank, MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_flush_all(MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_flush_local(int rank, MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_flush_local_all(MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_free(MPI_Win *win);
OMPI_DECLSPEC int PMPI_Win_free_keyval(int *win_keyval);
OMPI_DECLSPEC int PMPI_Win_get_attr(MPI_Win win, int win_keyval,
void *attribute_val, int *flag);
OMPI_DECLSPEC int PMPI_Win_get_errhandler(MPI_Win win, MPI_Errhandler *errhandler);
OMPI_DECLSPEC int PMPI_Win_get_group(MPI_Win win, MPI_Group *group);
OMPI_DECLSPEC int PMPI_Win_get_info(MPI_Win win, MPI_Info *info_used);
OMPI_DECLSPEC int PMPI_Win_get_name(MPI_Win win, char *win_name, int *resultlen);
OMPI_DECLSPEC int PMPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_lock_all(int assert, MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_post(MPI_Group group, int assert, MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_set_attr(MPI_Win win, int win_keyval, void *attribute_val);
OMPI_DECLSPEC int PMPI_Win_set_errhandler(MPI_Win win, MPI_Errhandler errhandler);
OMPI_DECLSPEC int PMPI_Win_set_info(MPI_Win win, MPI_Info info);
OMPI_DECLSPEC int PMPI_Win_set_name(MPI_Win win, const char *win_name);
OMPI_DECLSPEC int PMPI_Win_shared_query(MPI_Win win, int rank, MPI_Aint *size, int *disp_unit, void *baseptr);
OMPI_DECLSPEC int PMPI_Win_start(MPI_Group group, int assert, MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_sync(MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_test(MPI_Win win, int *flag);
OMPI_DECLSPEC int PMPI_Win_unlock(int rank, MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_unlock_all(MPI_Win win);
OMPI_DECLSPEC int PMPI_Win_wait(MPI_Win win);
OMPI_DECLSPEC double PMPI_Wtick(void);
OMPI_DECLSPEC double PMPI_Wtime(void);

View File

@ -320,7 +320,10 @@ $constants->{MPI_T_ERR_CVAR_SET_NEVER} = 64;
$constants->{MPI_T_ERR_PVAR_NO_STARTSTOP} = 65;
$constants->{MPI_T_ERR_PVAR_NO_WRITE} = 66;
$constants->{MPI_T_ERR_PVAR_NO_ATOMIC} = 67;
$constants->{MPI_ERR_LASTCODE} = $constants->{MPI_T_ERR_PVAR_NO_ATOMIC};
$constants->{MPI_ERR_RMA_RANGE} = 68;
$constants->{MPI_ERR_RMA_ATTACH} = 69;
$constants->{MPI_ERR_RMA_FLAVOR} = 70;
$constants->{MPI_ERR_LASTCODE} = $constants->{MPI_ERR_RMA_FLAVOR};
$constants->{MPI_ERR_SYSRESOURCE} = -2;

View File

@ -227,6 +227,8 @@ enum {
OMPI_OP_BASE_FORTRAN_MINLOC,
/** Corresponds to Fortran MPI_REPLACE */
OMPI_OP_BASE_FORTRAN_REPLACE,
/** Corresponds to Fortran MPI_NO_OP */
OMPI_OP_BASE_FORTRAN_NO_OP,
/** Maximum value */
OMPI_OP_BASE_FORTRAN_OP_MAX

View File

@ -37,8 +37,13 @@ int ompi_osc_base_find_available(bool enable_progress_threads,
bool enable_mpi_threads);
int ompi_osc_base_select(ompi_win_t *win,
void **base,
size_t size,
int disp_unit,
ompi_communicator_t *comm,
ompi_info_t *info,
ompi_communicator_t *comm);
int flavor,
int *model);
int ompi_osc_base_finalize(void);

View File

@ -27,8 +27,13 @@
int
ompi_osc_base_select(ompi_win_t *win,
ompi_info_t *info,
ompi_communicator_t *comm)
void **base,
size_t size,
int disp_unit,
ompi_communicator_t *comm,
ompi_info_t *info,
int flavor,
int *model)
{
opal_list_item_t *item;
ompi_osc_base_component_t *best_component = NULL;
@ -45,7 +50,7 @@ ompi_osc_base_select(ompi_win_t *win,
ompi_osc_base_component_t *component = (ompi_osc_base_component_t*)
((mca_base_component_list_item_t*) item)->cli_component;
priority = component->osc_query(win, info, comm);
priority = component->osc_query(win, base, size, disp_unit, comm, info, flavor);
if (priority < 0) continue;
if (priority > best_priority) {
best_component = component;
@ -55,5 +60,5 @@ ompi_osc_base_select(ompi_win_t *win,
if (NULL == best_component) return OMPI_ERR_NOT_SUPPORTED;
return best_component->osc_select(win, info, comm);
return best_component->osc_select(win, base, size, disp_unit, comm, info, flavor, model);
}

View File

@ -239,3 +239,65 @@ ompi_osc_base_process_op(void *outbuf,
return OMPI_SUCCESS;
}
int
ompi_osc_base_sndrcv_op(void *origin,
int32_t origin_count,
struct ompi_datatype_t *origin_dt,
void *target,
int32_t target_count,
struct ompi_datatype_t *target_dt,
ompi_op_t *op)
{
if (ompi_datatype_is_predefined(origin_dt) && origin_dt == target_dt) {
ompi_op_reduce(op, origin, target, origin_count, origin_dt);
} else {
ompi_osc_base_convertor_t recv_convertor;
opal_convertor_t send_convertor;
struct iovec iov;
uint32_t iov_count = 1;
size_t max_data;
int completed, length;
struct opal_convertor_master_t master = {NULL, 0, 0, 0, {0, }, NULL};
/* initialize send convertor */
OBJ_CONSTRUCT(&send_convertor, opal_convertor_t);
opal_convertor_copy_and_prepare_for_send(ompi_proc_local()->proc_convertor,
&(origin_dt->super), origin_count, origin, 0,
&send_convertor);
/* initialize recv convertor */
OBJ_CONSTRUCT(&recv_convertor, ompi_osc_base_convertor_t);
recv_convertor.op = op;
recv_convertor.datatype = ompi_datatype_get_single_predefined_type_from_args(target_dt);
opal_convertor_copy_and_prepare_for_recv(ompi_proc_local()->proc_convertor,
&(target_dt->super), target_count,
target, 0, &recv_convertor.convertor);
memcpy(&master, recv_convertor.convertor.master, sizeof(struct opal_convertor_master_t));
master.next = recv_convertor.convertor.master;
master.pFunctions = (conversion_fct_t*) &ompi_osc_base_copy_functions;
recv_convertor.convertor.master = &master;
recv_convertor.convertor.fAdvance = opal_unpack_general;
/* copy */
iov.iov_len = length = 64 * 1024;
iov.iov_base = (IOVBASE_TYPE*)malloc( length * sizeof(char) );
completed = 0;
while(0 == completed) {
iov.iov_len = length;
iov_count = 1;
max_data = length;
completed |= opal_convertor_pack( &send_convertor, &iov, &iov_count, &max_data );
completed |= opal_convertor_unpack( &recv_convertor.convertor, &iov, &iov_count, &max_data );
}
free( iov.iov_base );
OBJ_DESTRUCT( &send_convertor );
OBJ_DESTRUCT( &recv_convertor );
}
return OMPI_SUCCESS;
}

View File

@ -117,4 +117,12 @@ OMPI_DECLSPEC int ompi_osc_base_process_op(void *outbuf,
int count,
ompi_op_t *op);
OMPI_DECLSPEC int ompi_osc_base_sndrcv_op(void *origin,
int32_t origin_count,
struct ompi_datatype_t *origin_dt,
void *target,
int32_t target_count,
struct ompi_datatype_t *target_dt,
ompi_op_t *op);
END_C_DECLS

View File

@ -49,7 +49,7 @@ struct ompi_communicator_t;
struct ompi_group_t;
struct ompi_datatype_t;
struct ompi_op_t;
struct ompi_request_t;
/* ******************************************************************** */
@ -111,9 +111,12 @@ typedef int (*ompi_osc_base_component_finalize_fn_t)(void);
* @retval >= 0 The priority of the component for this window
*/
typedef int (*ompi_osc_base_component_query_fn_t)(struct ompi_win_t *win,
void **base,
size_t size,
int disp_unit,
struct ompi_communicator_t *comm,
struct ompi_info_t *info,
struct ompi_communicator_t *comm);
int flavor);
/**
* OSC component select
@ -140,9 +143,13 @@ typedef int (*ompi_osc_base_component_query_fn_t)(struct ompi_win_t *win,
* @retval OMPI_ERROR An unspecified error occurred
*/
typedef int (*ompi_osc_base_component_select_fn_t)(struct ompi_win_t *win,
void **base,
size_t size,
int disp_unit,
struct ompi_communicator_t *comm,
struct ompi_info_t *info,
struct ompi_communicator_t *comm);
int flavor,
int *model);
/**
* OSC component interface
@ -171,6 +178,11 @@ typedef ompi_osc_base_component_2_0_0_t ompi_osc_base_component_t;
/* ******************************************************************** */
typedef int (*ompi_osc_base_module_win_shared_query_fn_t)(struct ompi_win_t *win, int rank,
size_t *size, int *disp_unit, void *baseptr);
typedef int (*ompi_osc_base_module_win_attach_fn_t)(struct ompi_win_t *win, void *base, size_t size);
typedef int (*ompi_osc_base_module_win_detach_fn_t)(struct ompi_win_t *win, void *base);
/**
* Free resources associated with win
@ -220,6 +232,80 @@ typedef int (*ompi_osc_base_module_accumulate_fn_t)(void *origin_addr,
struct ompi_op_t *op,
struct ompi_win_t *win);
typedef int (*ompi_osc_base_module_compare_and_swap_fn_t)(void *origin_addr,
void *compare_addr,
void *result_addr,
struct ompi_datatype_t *dt,
int target,
OPAL_PTRDIFF_TYPE target_disp,
struct ompi_win_t *win);
typedef int (*ompi_osc_base_module_fetch_and_op_fn_t)(void *origin_addr,
void *result_addr,
struct ompi_datatype_t *dt,
int target,
OPAL_PTRDIFF_TYPE target_disp,
struct ompi_op_t *op,
struct ompi_win_t *win);
typedef int (*ompi_osc_base_module_get_accumulate_fn_t)(void *origin_addr,
int origin_count,
struct ompi_datatype_t *origin_datatype,
void *result_addr,
int result_count,
struct ompi_datatype_t *result_datatype,
int target_rank,
OPAL_PTRDIFF_TYPE target_disp,
int target_count,
struct ompi_datatype_t *target_datatype,
struct ompi_op_t *op,
struct ompi_win_t *win);
typedef int (*ompi_osc_base_module_rput_fn_t)(void *origin_addr,
int origin_count,
struct ompi_datatype_t *origin_dt,
int target,
OPAL_PTRDIFF_TYPE target_disp,
int target_count,
struct ompi_datatype_t *target_dt,
struct ompi_win_t *win,
struct ompi_request_t **request);
typedef int (*ompi_osc_base_module_rget_fn_t)(void *origin_addr,
int origin_count,
struct ompi_datatype_t *origin_dt,
int target,
OPAL_PTRDIFF_TYPE target_disp,
int target_count,
struct ompi_datatype_t *target_dt,
struct ompi_win_t *win,
struct ompi_request_t **request);
typedef int (*ompi_osc_base_module_raccumulate_fn_t)(void *origin_addr,
int origin_count,
struct ompi_datatype_t *origin_dt,
int target,
OPAL_PTRDIFF_TYPE target_disp,
int target_count,
struct ompi_datatype_t *target_dt,
struct ompi_op_t *op,
struct ompi_win_t *win,
struct ompi_request_t **request);
typedef int (*ompi_osc_base_module_rget_accumulate_fn_t)(void *origin_addr,
int origin_count,
struct ompi_datatype_t *origin_datatype,
void *result_addr,
int result_count,
struct ompi_datatype_t *result_datatype,
int target_rank,
OPAL_PTRDIFF_TYPE target_disp,
int target_count,
struct ompi_datatype_t *target_datatype,
struct ompi_op_t *op,
struct ompi_win_t *win,
struct ompi_request_t **request);
typedef int (*ompi_osc_base_module_fence_fn_t)(int assert, struct ompi_win_t *win);
@ -249,10 +335,26 @@ typedef int (*ompi_osc_base_module_lock_fn_t)(int lock_type,
int assert,
struct ompi_win_t *win);
typedef int (*ompi_osc_base_module_unlock_fn_t)(int target,
struct ompi_win_t *win);
typedef int (*ompi_osc_base_module_lock_all_fn_t)(int assert,
struct ompi_win_t *win);
typedef int (*ompi_osc_base_module_unlock_all_fn_t)(struct ompi_win_t *win);
typedef int (*ompi_osc_base_module_sync_fn_t)(struct ompi_win_t *win);
typedef int (*ompi_osc_base_module_flush_fn_t)(int target,
struct ompi_win_t *win);
typedef int (*ompi_osc_base_module_flush_all_fn_t)(struct ompi_win_t *win);
typedef int (*ompi_osc_base_module_flush_local_fn_t)(int target,
struct ompi_win_t *win);
typedef int (*ompi_osc_base_module_flush_local_all_fn_t)(struct ompi_win_t *win);
typedef int (*ompi_osc_base_module_set_info_fn_t)(struct ompi_win_t *win, struct ompi_info_t *info);
typedef int (*ompi_osc_base_module_get_info_fn_t)(struct ompi_win_t *win, struct ompi_info_t **info_used);
/* ******************************************************************** */
@ -266,47 +368,58 @@ typedef int (*ompi_osc_base_module_unlock_fn_t)(int target,
* free to create a structure that inherits this one for use as the
* module structure.
*/
struct ompi_osc_base_module_1_0_0_t {
/** Free resources associated with the window */
struct ompi_osc_base_module_3_0_0_t {
ompi_osc_base_module_win_shared_query_fn_t osc_win_shared_query;
ompi_osc_base_module_win_attach_fn_t osc_win_attach;
ompi_osc_base_module_win_detach_fn_t osc_win_detach;
ompi_osc_base_module_free_fn_t osc_free;
/** Implement MPI_PUT */
ompi_osc_base_module_put_fn_t osc_put;
/** Implement MPI_GET */
ompi_osc_base_module_get_fn_t osc_get;
/** Implement MPI_ACCUMULATE */
ompi_osc_base_module_accumulate_fn_t osc_accumulate;
ompi_osc_base_module_compare_and_swap_fn_t osc_compare_and_swap;
ompi_osc_base_module_fetch_and_op_fn_t osc_fetch_and_op;
ompi_osc_base_module_get_accumulate_fn_t osc_get_accumulate;
ompi_osc_base_module_rput_fn_t osc_rput;
ompi_osc_base_module_rget_fn_t osc_rget;
ompi_osc_base_module_raccumulate_fn_t osc_raccumulate;
ompi_osc_base_module_rget_accumulate_fn_t osc_rget_accumulate;
/** Implement MPI_WIN_FENCE */
ompi_osc_base_module_fence_fn_t osc_fence;
/* Implement MPI_WIN_START */
ompi_osc_base_module_start_fn_t osc_start;
/* Implement MPI_WIN_COMPLETE */
ompi_osc_base_module_complete_fn_t osc_complete;
/* Implement MPI_WIN_POST */
ompi_osc_base_module_post_fn_t osc_post;
/* Implement MPI_WIN_WAIT */
ompi_osc_base_module_wait_fn_t osc_wait;
/* Implement MPI_WIN_TEST */
ompi_osc_base_module_test_fn_t osc_test;
/* Implement MPI_WIN_LOCK */
ompi_osc_base_module_lock_fn_t osc_lock;
/* Implement MPI_WIN_UNLOCK */
ompi_osc_base_module_unlock_fn_t osc_unlock;
ompi_osc_base_module_lock_all_fn_t osc_lock_all;
ompi_osc_base_module_unlock_all_fn_t osc_unlock_all;
ompi_osc_base_module_sync_fn_t osc_sync;
ompi_osc_base_module_flush_fn_t osc_flush;
ompi_osc_base_module_flush_all_fn_t osc_flush_all;
ompi_osc_base_module_flush_local_fn_t osc_flush_local;
ompi_osc_base_module_flush_local_all_fn_t osc_flush_local_all;
ompi_osc_base_module_set_info_fn_t osc_set_info;
ompi_osc_base_module_get_info_fn_t osc_get_info;
};
typedef struct ompi_osc_base_module_1_0_0_t ompi_osc_base_module_1_0_0_t;
typedef ompi_osc_base_module_1_0_0_t ompi_osc_base_module_t;
typedef struct ompi_osc_base_module_3_0_0_t ompi_osc_base_module_3_0_0_t;
typedef ompi_osc_base_module_3_0_0_t ompi_osc_base_module_t;
/* ******************************************************************** */
/** Macro for use in components that are of type osc */
#define OMPI_OSC_BASE_VERSION_2_0_0 \
#define OMPI_OSC_BASE_VERSION_3_0_0 \
MCA_BASE_VERSION_2_0_0, \
"osc", 2, 0, 0
"osc", 3, 0, 0
/* ******************************************************************** */

View File

@ -0,0 +1,43 @@
#
# Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
EXTRA_DIST =
portals4_sources = \
osc_portals4.h \
osc_portals4_comm.c \
osc_portals4_component.c \
osc_portals4_active_target.c \
osc_portals4_passive_target.c \
osc_portals4_request.c
AM_CPPFLAGS = $(osc_portals4_CPPFLAGS)
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_ompi_osc_portals4_DSO
component_noinst =
component_install = mca_osc_portals4.la
else
component_noinst = libmca_osc_portals4.la
component_install =
endif
mcacomponentdir = $(pkglibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_osc_portals4_la_SOURCES = $(portals4_sources)
mca_osc_portals4_la_LIBADD = $(osc_portals4_LIBS)
mca_osc_portals4_la_LDFLAGS = -module -avoid-version $(osc_portals4_LDFLAGS)
noinst_LTLIBRARIES = $(component_noinst)
libmca_osc_portals4_la_SOURCES = $(portals4_sources)
libmca_osc_portals4_la_LIBADD = $(osc_portals4_LIBS)
libmca_osc_portals4_la_LDFLAGS = -module -avoid-version $(osc_portals4_LDFLAGS)

View File

@ -0,0 +1,42 @@
# -*- shell-script -*-
#
# Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_ompi_osc_portals4_POST_CONFIG(will_build)
# ----------------------------------------
# Only require the tag if we're actually going to be built
AC_DEFUN([MCA_ompi_osc_portals4_POST_CONFIG], [
AS_IF([test "$1" = "1"], [OMPI_REQUIRE_ENDPOINT_TAG([PORTALS4])])
])dnl
# MCA_osc_portals4_CONFIG(action-if-can-compile,
# [action-if-cant-compile])
# ------------------------------------------------
AC_DEFUN([MCA_ompi_osc_portals4_CONFIG],[
AC_CONFIG_FILES([ompi/mca/osc/portals4/Makefile])
OMPI_CHECK_PORTALS4([osc_portals4],
[osc_portals4_happy="yes"],
[osc_portals4_happy="no"])
AS_IF([test "$osc_portals4_happy" = "yes"],
[osc_portals4_WRAPPER_EXTRA_LDFLAGS="$osc_portals4_LDFLAGS"
osc_portals4_WRAPPER_EXTRA_LIBS="$osc_portals4_LIBS"
$1],
[$2])
# need to propogate CPPFLAGS to all of OMPI
AS_IF([test "$DIRECT_osc" = "portals4"],
[CPPFLAGS="$CPPFLAGS $osc_portals4_CPPFLAGS"])
# substitute in the things needed to build portals4
AC_SUBST([osc_portals4_CPPFLAGS])
AC_SUBST([osc_portals4_LDFLAGS])
AC_SUBST([osc_portals4_LIBS])
])dnl

View File

@ -0,0 +1,338 @@
/*
* Copyright (c) 2011-2013 Sandia National Laboratories. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OSC_PORTALS4_PORTALS4_H
#define OSC_PORTALS4_PORTALS4_H
#include <portals4.h>
#include "ompi/class/ompi_free_list.h"
#include "ompi/group/group.h"
#include "ompi/communicator/communicator.h"
#define OSC_PORTALS4_MB_DATA 0x0000000000000000ULL
#define OSC_PORTALS4_MB_CONTROL 0x1000000000000000ULL
/* Component structure. There is one of these per process, per process lifetime.
*
* Currently, the Portals 4 one-sided implementation only uses a
* matching interface for all communication. There are plans for
* using a non-matching interface for a few windows (they each need
* their own PTE, which is a precious resource). In anticipation of
* that, we initialize the network interfaces and keep them in the
* component structure (for win create), but then also keep a handle
* copy in the window module, so that we can use the right structures
* once we add the non-matching support.
*
* The sizes are kept in the component structure because we can only
* find them during PtlNIInit, and it would be poor to do that for
* every window creation. Again, the window module has a copy of the
* max sizes, but tweaked to match the window configuration (ie,
* there's one atomic size, instead of an ordered and unordered size,
* since we know the ordering constraints during window creation).
*/
struct ompi_osc_portals4_component_t {
ompi_osc_base_component_t super;
ptl_handle_ni_t matching_ni_h;
ptl_handle_eq_t matching_eq_h;
ptl_pt_index_t matching_pt_idx;
ptl_size_t matching_atomic_max;
ptl_size_t matching_fetch_atomic_max;
ptl_size_t matching_atomic_ordered_size;
ompi_free_list_t requests; /* request free list for the r* communication variants */
};
typedef struct ompi_osc_portals4_component_t ompi_osc_portals4_component_t;
OMPI_DECLSPEC extern ompi_osc_portals4_component_t mca_osc_portals4_component;
/* Data about me exposed to remote peers. Used in generalized active
target and passive target synchronization. */
struct ompi_osc_portals4_node_state_t {
volatile int32_t post_count;
volatile int32_t complete_count;
volatile uint64_t lock;
};
typedef struct ompi_osc_portals4_node_state_t ompi_osc_portals4_node_state_t;
#define LOCK_ILLEGAL (0x4000000000000000ULL)
#define LOCK_UNLOCKED (0x0000000000000000ULL)
#define LOCK_EXCLUSIVE (0x0000000100000000ULL)
/* Module structure. There is one of these per window */
struct ompi_osc_portals4_module_t {
ompi_osc_base_module_t super;
void *free_after; /* if non-null, this pointer should be free()ed when window destroyed */
struct ompi_communicator_t *comm; /* communicator which backs this window (unique to this window) */
int disp_unit; /* if -1, have to look at disp_units */
int *disp_units; /* array (possibly NULL!) of displacement units, per peer */
ptl_handle_ni_t ni_h; /* network interface used by this window */
ptl_pt_index_t pt_idx; /* portal table index used by this window (this will be same across window) */
ptl_handle_ct_t ct_h; /* Counting event handle used for completion in this window */
#if OMPI_PORTALS4_MAX_MD_SIZE < OMPI_PORTALS4_MAX_VA_SIZE
ptl_handle_md_t *md_h; /* memory descriptor describing all of memory used by this window */
ptl_handle_md_t *req_md_h; /* memory descriptor with event completion used by this window */
#else
ptl_handle_md_t md_h[1]; /* memory descriptor describing all of memory used by this window */
ptl_handle_md_t req_md_h[1]; /* memory descriptor with event completion used by this window */
#endif
ptl_handle_me_t data_me_h; /* data match list entry (MB are CID | OSC_PORTALS4_MB_DATA) */
ptl_handle_me_t control_me_h; /* match list entry for control data (node_state_t). Match bits are (CID | OSC_PORTALS4_MB_CONTROL). */
int64_t opcount;
ptl_match_bits_t match_bits; /* match bits for module. Same as cid for comm in most cases. */
ptl_size_t atomic_max; /* max size of atomic messages. Will guarantee ordering IF ordering requested */
ptl_size_t fetch_atomic_max; /* max size of fetchatomic messages. Will guarantee ordering IF ordering requested */
/* variable containing specified value. Needed for atomic
increments so they can be non-blocking */
int32_t zero;
int32_t one;
ompi_group_t *start_group;
ompi_group_t *post_group;
opal_list_t outstanding_locks;
/* things that are remotely accessible */
ompi_osc_portals4_node_state_t state;
};
typedef struct ompi_osc_portals4_module_t ompi_osc_portals4_module_t;
static inline size_t
get_displacement(ompi_osc_portals4_module_t *module,
int target)
{
if (-1 == module->disp_unit) {
return module->disp_units[target];
} else {
return module->disp_unit;
}
}
/*
* See note in ompi/mtl/portals4/mtl_portals4.h for how we deal with
* platforms that don't allow us to crate an MD that covers all of
* memory.
*/
static inline void
ompi_osc_portals4_get_md(const void *ptr, const ptl_handle_md_t *array,
ptl_handle_md_t *md_h, void **base_ptr)
{
#if OMPI_PORTALS4_MAX_MD_SIZE < OMPI_PORTALS4_MAX_VA_SIZE
int mask = (1ULL << (OMPI_PORTALS4_MAX_VA_SIZE - OMPI_PORTALS4_MAX_MD_SIZE + 1)) - 1;
int which = (((uintptr_t) ptr) >> (OMPI_PORTALS4_MAX_MD_SIZE - 1)) & mask;
*md_h = array[which];
*base_ptr = (void*) (which * (1ULL << (OMPI_PORTALS4_MAX_MD_SIZE - 1)));
#else
*md_h = array[0];
*base_ptr = 0;
#endif
}
static inline int
ompi_osc_portals4_get_num_mds(void)
{
#if OMPI_PORTALS4_MAX_MD_SIZE < OMPI_PORTALS4_MAX_VA_SIZE
return (1 << (OMPI_PORTALS4_MAX_VA_SIZE - OMPI_PORTALS4_MAX_MD_SIZE + 1));
#else
return 1;
#endif
}
int ompi_osc_portals4_attach(struct ompi_win_t *win, void *base, size_t len);
int ompi_osc_portals4_detach(struct ompi_win_t *win, void *base);
int ompi_osc_portals4_free(struct ompi_win_t *win);
int ompi_osc_portals4_put(void *origin_addr,
int origin_count,
struct ompi_datatype_t *origin_dt,
int target,
OPAL_PTRDIFF_TYPE target_disp,
int target_count,
struct ompi_datatype_t *target_dt,
struct ompi_win_t *win);
int ompi_osc_portals4_get(void *origin_addr,
int origin_count,
struct ompi_datatype_t *origin_dt,
int target,
OPAL_PTRDIFF_TYPE target_disp,
int target_count,
struct ompi_datatype_t *target_dt,
struct ompi_win_t *win);
int ompi_osc_portals4_accumulate(void *origin_addr,
int origin_count,
struct ompi_datatype_t *origin_dt,
int target,
OPAL_PTRDIFF_TYPE target_disp,
int target_count,
struct ompi_datatype_t *target_dt,
struct ompi_op_t *op,
struct ompi_win_t *win);
int ompi_osc_portals4_compare_and_swap(void *origin_addr,
void *compare_addr,
void *result_addr,
struct ompi_datatype_t *dt,
int target,
OPAL_PTRDIFF_TYPE target_disp,
struct ompi_win_t *win);
int ompi_osc_portals4_fetch_and_op(void *origin_addr,
void *result_addr,
struct ompi_datatype_t *dt,
int target,
OPAL_PTRDIFF_TYPE target_disp,
struct ompi_op_t *op,
struct ompi_win_t *win);
int ompi_osc_portals4_get_accumulate(void *origin_addr,
int origin_count,
struct ompi_datatype_t *origin_datatype,
void *result_addr,
int result_count,
struct ompi_datatype_t *result_datatype,
int target_rank,
MPI_Aint target_disp,
int target_count,
struct ompi_datatype_t *target_datatype,
struct ompi_op_t *op,
struct ompi_win_t *win);
int ompi_osc_portals4_rput(void *origin_addr,
int origin_count,
struct ompi_datatype_t *origin_dt,
int target,
OPAL_PTRDIFF_TYPE target_disp,
int target_count,
struct ompi_datatype_t *target_dt,
struct ompi_win_t *win,
struct ompi_request_t **request);
int ompi_osc_portals4_rget(void *origin_addr,
int origin_count,
struct ompi_datatype_t *origin_dt,
int target,
OPAL_PTRDIFF_TYPE target_disp,
int target_count,
struct ompi_datatype_t *target_dt,
struct ompi_win_t *win,
struct ompi_request_t **request);
int ompi_osc_portals4_raccumulate(void *origin_addr,
int origin_count,
struct ompi_datatype_t *origin_dt,
int target,
OPAL_PTRDIFF_TYPE target_disp,
int target_count,
struct ompi_datatype_t *target_dt,
struct ompi_op_t *op,
struct ompi_win_t *win,
struct ompi_request_t **request);
int ompi_osc_portals4_rget_accumulate(void *origin_addr,
int origin_count,
struct ompi_datatype_t *origin_datatype,
void *result_addr,
int result_count,
struct ompi_datatype_t *result_datatype,
int target_rank,
MPI_Aint target_disp,
int target_count,
struct ompi_datatype_t *target_datatype,
struct ompi_op_t *op,
struct ompi_win_t *win,
struct ompi_request_t **request);
int ompi_osc_portals4_fence(int assert, struct ompi_win_t *win);
int ompi_osc_portals4_start(struct ompi_group_t *group,
int assert,
struct ompi_win_t *win);
int ompi_osc_portals4_complete(struct ompi_win_t *win);
int ompi_osc_portals4_post(struct ompi_group_t *group,
int assert,
struct ompi_win_t *win);
int ompi_osc_portals4_wait(struct ompi_win_t *win);
int ompi_osc_portals4_test(struct ompi_win_t *win,
int *flag);
int ompi_osc_portals4_lock(int lock_type,
int target,
int assert,
struct ompi_win_t *win);
int ompi_osc_portals4_unlock(int target,
struct ompi_win_t *win);
int ompi_osc_portals4_lock_all(int assert,
struct ompi_win_t *win);
int ompi_osc_portals4_unlock_all(struct ompi_win_t *win);
int ompi_osc_portals4_sync(struct ompi_win_t *win);
int ompi_osc_portals4_flush(int target,
struct ompi_win_t *win);
int ompi_osc_portals4_flush_all(struct ompi_win_t *win);
int ompi_osc_portals4_flush_local(int target,
struct ompi_win_t *win);
int ompi_osc_portals4_flush_local_all(struct ompi_win_t *win);
int ompi_osc_portals4_set_info(struct ompi_win_t *win, struct ompi_info_t *info);
int ompi_osc_portals4_get_info(struct ompi_win_t *win, struct ompi_info_t **info_used);
static inline int
ompi_osc_portals4_complete_all(ompi_osc_portals4_module_t *module)
{
int ret;
ptl_ct_event_t event;
ret = PtlCTWait(module->ct_h, module->opcount, &event);
if (PTL_OK != ret || 0 != event.failure) {
opal_output_verbose(1, ompi_osc_base_framework.framework_output,
"%s:%d: flush_all ct failure: ret=%d, failure=%d\n",
__FILE__, __LINE__, ret, (int) event.failure);
event.success = event.failure = 0;
PtlCTSet(module->ct_h, event);
module->opcount = 0;
}
assert(event.success == (size_t) module->opcount);
PtlAtomicSync();
return ret;
}
static inline ptl_process_t
ompi_osc_portals4_get_peer(ompi_osc_portals4_module_t *module, int rank)
{
ompi_proc_t *proc = ompi_comm_peer_lookup(module->comm, rank);
return *((ptl_process_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]);
}
static inline ptl_process_t
ompi_osc_portals4_get_peer_group(struct ompi_group_t *group, int rank)
{
ompi_proc_t *proc = ompi_group_get_proc_ptr(group, rank);
return *((ptl_process_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]);
}
#endif

View File

@ -0,0 +1,192 @@
/*
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "ompi/mca/osc/osc.h"
#include "ompi/mca/osc/base/base.h"
#include "ompi/mca/osc/base/osc_base_obj_convert.h"
#include "osc_portals4.h"
#include "ompi/mca/mtl/portals4/mtl_portals4_endpoint.h"
int
ompi_osc_portals4_fence(int assert, struct ompi_win_t *win)
{
ompi_osc_portals4_module_t *module =
(ompi_osc_portals4_module_t*) win->w_osc_module;
int comm_ret, ret;
comm_ret = ompi_osc_portals4_complete_all(module);
ret = module->comm->c_coll.coll_barrier(module->comm,
module->comm->c_coll.coll_barrier_module);
return (OMPI_SUCCESS == comm_ret) ? ret : comm_ret;
}
int
ompi_osc_portals4_start(struct ompi_group_t *group,
int assert,
struct ompi_win_t *win)
{
ompi_osc_portals4_module_t *module =
(ompi_osc_portals4_module_t*) win->w_osc_module;
if (0 == (assert & MPI_MODE_NOCHECK)) {
int size;
OBJ_RETAIN(group);
module->start_group = group;
size = ompi_group_size(module->start_group);
while (module->state.post_count != size) opal_progress();
} else {
module->start_group = NULL;
}
return OMPI_SUCCESS;
}
int
ompi_osc_portals4_complete(struct ompi_win_t *win)
{
ompi_osc_portals4_module_t *module =
(ompi_osc_portals4_module_t*) win->w_osc_module;
int ret, i, size;
ptl_handle_md_t md_h;
void *base;
ret = ompi_osc_portals4_complete_all(module);
if (ret != OMPI_SUCCESS) return ret;
if (NULL != module->start_group) {
module->state.post_count = 0;
PtlAtomicSync();
ompi_osc_portals4_get_md(&module->one, module->md_h, &md_h, &base);
size = ompi_group_size(module->start_group);
for (i = 0 ; i < size ; ++i) {
ret = PtlAtomic(md_h,
(ptl_size_t) ((char*) &module->one - (char*) base),
sizeof(module->one),
PTL_ACK_REQ,
ompi_osc_portals4_get_peer_group(module->start_group, i),
module->pt_idx,
module->match_bits | OSC_PORTALS4_MB_CONTROL,
offsetof(ompi_osc_portals4_node_state_t, complete_count),
NULL,
0,
PTL_SUM,
PTL_INT32_T);
if (ret != OMPI_SUCCESS) return ret;
OPAL_THREAD_ADD64(&module->opcount, 1);
}
ret = ompi_osc_portals4_complete_all(module);
if (ret != OMPI_SUCCESS) return ret;
OBJ_RELEASE(module->start_group);
module->start_group = NULL;
}
return OMPI_SUCCESS;
}
int