X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/18449bfffced07ec0a49297f1eb76c4fe6792895..4f994c9a8d72e683e77173cb49c3949447c645cb:/include/smpi/smpi.h diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index 05683997f5..1f19913b04 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -180,8 +180,8 @@ enum ERROR_ENUM { #define MPI_COMM_TYPE_SHARED 1 #define MPI_WIN_NULL ((MPI_Win)NULL) -#define MPI_VERSION 2 -#define MPI_SUBVERSION 2 +#define MPI_VERSION 3 +#define MPI_SUBVERSION 1 #define MPI_UNWEIGHTED (int *)0 #define MPI_ARGV_NULL (char **)0 #define MPI_ARGVS_NULL (char ***)0 @@ -212,6 +212,7 @@ enum ERROR_ENUM { typedef ptrdiff_t MPI_Aint; typedef long long MPI_Offset; +typedef long long MPI_Count; struct s_MPI_File; typedef struct s_MPI_File *MPI_File; @@ -292,9 +293,7 @@ XBT_PUBLIC_DATA const MPI_Datatype MPI_INTEGER4; XBT_PUBLIC_DATA const MPI_Datatype MPI_INTEGER8; XBT_PUBLIC_DATA const MPI_Datatype MPI_INTEGER16; -//for now we only send int values at max -#define MPI_Count int -#define MPI_COUNT MPI_INT +XBT_PUBLIC_DATA const MPI_Datatype MPI_COUNT; //defines for fortran compatibility #if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__) @@ -392,6 +391,9 @@ typedef void MPI_Type_delete_attr_function_fort(MPI_Datatype type, int keyval, v typedef void MPI_Win_copy_attr_function_fort(MPI_Win win, int keyval, void* extra_state, void* attribute_val_in, void* attribute_val_out, int* flag, int* ierr); typedef void MPI_Win_delete_attr_function_fort(MPI_Win win, int keyval, void* attribute_val, void* extra_state, int* ierr); +typedef int MPI_Grequest_query_function(void *extra_state, MPI_Status *status); +typedef int MPI_Grequest_free_function(void *extra_state); +typedef int MPI_Grequest_cancel_function(void *extra_state, int complete); #define MPI_COMM_NULL_COPY_FN ((MPI_Comm_copy_attr_function*)0) #define MPI_COMM_NULL_DELETE_FN ((MPI_Comm_delete_attr_function*)0) #define MPI_TYPE_NULL_COPY_FN ((MPI_Type_copy_attr_function*)0) @@ -570,6 +572,39 @@ MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_Request_c2f, (MPI_Request request)); MPI_CALL(XBT_PUBLIC int, MPI_Bcast, (void* buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm)); MPI_CALL(XBT_PUBLIC int, MPI_Barrier, (MPI_Comm comm)); MPI_CALL(XBT_PUBLIC int, MPI_Ibarrier, (MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Ibcast, (void* buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Igather, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, + MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Igatherv, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, + int* recvcounts, int* displs, MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Iallgather, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, + int recvcount, MPI_Datatype recvtype, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Iallgatherv, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, + int* recvcounts, int* displs, MPI_Datatype recvtype, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Iscatter, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, + int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Iscatterv, (void* sendbuf, int* sendcounts, int* displs, MPI_Datatype sendtype, + void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Ireduce, + (void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Iallreduce, + (void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Iscan, + (void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Iexscan, + (void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Ireduce_scatter, + (void* sendbuf, void* recvbuf, int* recvcounts, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Ireduce_scatter_block, + (void* sendbuf, void* recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Ialltoall, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, + int recvcount, MPI_Datatype recvtype, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Ialltoallv, + (void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype sendtype, void* recvbuf, int* recvcounts, + int* recvdisps, MPI_Datatype recvtype, MPI_Comm comm, MPI_Request *request)); +MPI_CALL(XBT_PUBLIC int, MPI_Ialltoallw, + (void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype* sendtypes, void* recvbuf, int* recvcounts, + int* recvdisps, MPI_Datatype* recvtypes, MPI_Comm comm, MPI_Request *request)); MPI_CALL(XBT_PUBLIC int, MPI_Gather, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)); MPI_CALL(XBT_PUBLIC int, MPI_Gatherv, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, @@ -599,6 +634,9 @@ MPI_CALL(XBT_PUBLIC int, MPI_Alltoall, (void* sendbuf, int sendcount, MPI_Dataty MPI_CALL(XBT_PUBLIC int, MPI_Alltoallv, (void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype sendtype, void* recvbuf, int* recvcounts, int* recvdisps, MPI_Datatype recvtype, MPI_Comm comm)); +MPI_CALL(XBT_PUBLIC int, MPI_Alltoallw, + (void* sendbuf, int* sendcnts, int* sdispls, MPI_Datatype* sendtypes, void* recvbuf, int* recvcnts, + int* rdispls, MPI_Datatype* recvtypes, MPI_Comm comm)); MPI_CALL(XBT_PUBLIC int, MPI_Reduce_local, (void* inbuf, void* inoutbuf, int count, MPI_Datatype datatype, MPI_Op op)); MPI_CALL(XBT_PUBLIC int, MPI_Info_create, (MPI_Info * info)); @@ -692,6 +730,13 @@ MPI_CALL(XBT_PUBLIC int, MPI_Cart_shift, (MPI_Comm comm, int direction, int disp MPI_CALL(XBT_PUBLIC int, MPI_Cart_sub, (MPI_Comm comm, int* remain_dims, MPI_Comm* comm_new)); MPI_CALL(XBT_PUBLIC int, MPI_Cartdim_get, (MPI_Comm comm, int* ndims)); MPI_CALL(XBT_PUBLIC int, MPI_Dims_create, (int nnodes, int ndims, int* dims)); +MPI_CALL(XBT_PUBLIC int, MPI_Request_get_status, (MPI_Request request, int* flag, MPI_Status* status)); +MPI_CALL(XBT_PUBLIC int, MPI_Grequest_start, + (MPI_Grequest_query_function * query_fn, MPI_Grequest_free_function* free_fn, + MPI_Grequest_cancel_function* cancel_fn, void* extra_state, MPI_Request* request)); +MPI_CALL(XBT_PUBLIC int, MPI_Grequest_complete, (MPI_Request request)); +MPI_CALL(XBT_PUBLIC int, MPI_Status_set_cancelled, (MPI_Status * status, int flag)); +MPI_CALL(XBT_PUBLIC int, MPI_Status_set_elements, (MPI_Status * status, MPI_Datatype datatype, int count)); //FIXME: these are not yet implemented @@ -724,9 +769,6 @@ typedef void* MPI_Errhandler; typedef void MPI_Comm_errhandler_function(MPI_Comm *, int *, ...); typedef void MPI_File_errhandler_function(MPI_File *, int *, ...); typedef void MPI_Win_errhandler_function(MPI_Win *, int *, ...); -typedef int MPI_Grequest_query_function(void *extra_state, MPI_Status *status); -typedef int MPI_Grequest_free_function(void *extra_state); -typedef int MPI_Grequest_cancel_function(void *extra_state, int complete); #define MPI_DUP_FN 1 #define MPI_WIN_DUP_FN ((MPI_Win_copy_attr_function*)MPI_DUP_FN) @@ -735,7 +777,7 @@ typedef int MPI_Grequest_cancel_function(void *extra_state, int complete); typedef MPI_Comm_errhandler_function MPI_Comm_errhandler_fn; typedef MPI_File_errhandler_function MPI_File_errhandler_fn; typedef MPI_Win_errhandler_function MPI_Win_errhandler_fn; -#define MPI_INFO_ENV 1 +#define MPI_INFO_ENV smpi_process_info_env() XBT_PUBLIC_DATA const MPI_Datatype MPI_PACKED; XBT_PUBLIC_DATA MPI_Errhandler* MPI_ERRORS_RETURN; XBT_PUBLIC_DATA MPI_Errhandler* MPI_ERRORS_ARE_FATAL; @@ -805,9 +847,6 @@ MPI_CALL(XBT_PUBLIC int, MPI_Type_create_subarray, (int ndims, int* array_of_sizes, int* array_of_subsizes, int* array_of_starts, int order, MPI_Datatype oldtype, MPI_Datatype* newtype)); MPI_CALL(XBT_PUBLIC int, MPI_Type_match_size, (int typeclass, int size, MPI_Datatype* datatype)); -MPI_CALL(XBT_PUBLIC int, MPI_Alltoallw, - (void* sendbuf, int* sendcnts, int* sdispls, MPI_Datatype* sendtypes, void* recvbuf, int* recvcnts, - int* rdispls, MPI_Datatype* recvtypes, MPI_Comm comm)); MPI_CALL(XBT_PUBLIC int, MPI_Comm_set_info, (MPI_Comm comm, MPI_Info info)); MPI_CALL(XBT_PUBLIC int, MPI_Comm_get_info, (MPI_Comm comm, MPI_Info* info)); MPI_CALL(XBT_PUBLIC int, MPI_Comm_dup_with_info, (MPI_Comm comm, MPI_Info info, MPI_Comm* newcomm)); @@ -815,13 +854,6 @@ MPI_CALL(XBT_PUBLIC int, MPI_Comm_split_type, (MPI_Comm comm, int split_type, int key, MPI_Info info, MPI_Comm* newcomm)); MPI_CALL(XBT_PUBLIC int, MPI_Comm_connect, (char* port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm* newcomm)); -MPI_CALL(XBT_PUBLIC int, MPI_Request_get_status, (MPI_Request request, int* flag, MPI_Status* status)); -MPI_CALL(XBT_PUBLIC int, MPI_Grequest_start, - (MPI_Grequest_query_function * query_fn, MPI_Grequest_free_function* free_fn, - MPI_Grequest_cancel_function* cancel_fn, void* extra_state, MPI_Request* request)); -MPI_CALL(XBT_PUBLIC int, MPI_Grequest_complete, (MPI_Request request)); -MPI_CALL(XBT_PUBLIC int, MPI_Status_set_cancelled, (MPI_Status * status, int flag)); -MPI_CALL(XBT_PUBLIC int, MPI_Status_set_elements, (MPI_Status * status, MPI_Datatype datatype, int count)); MPI_CALL(XBT_PUBLIC int, MPI_Unpublish_name, (char* service_name, MPI_Info info, char* port_name)); MPI_CALL(XBT_PUBLIC int, MPI_Publish_name, (char* service_name, MPI_Info info, char* port_name)); MPI_CALL(XBT_PUBLIC int, MPI_Lookup_name, (char* service_name, MPI_Info info, char* port_name)); @@ -933,6 +965,7 @@ MPI_CALL(XBT_PUBLIC int, MPI_File_sync, (MPI_File fh)); // smpi functions XBT_PUBLIC int smpi_global_size(); XBT_PUBLIC MPI_Comm smpi_process_comm_self(); +XBT_PUBLIC MPI_Info smpi_process_info_env(); XBT_PUBLIC void* smpi_process_get_user_data(); XBT_PUBLIC void smpi_process_set_user_data(void*); @@ -1022,68 +1055,6 @@ XBT_PUBLIC void SMPI_app_instance_register(const char* name, xbt_main_func_t cod XBT_PUBLIC void SMPI_init(); XBT_PUBLIC void SMPI_finalize(); -/* Manual global privatization fallback */ -XBT_PUBLIC void smpi_register_static(void* arg, void_f_pvoid_t free_fn); -XBT_PUBLIC void smpi_free_static(); - -#define SMPI_VARINIT_GLOBAL(name,type) \ -type *name = NULL; \ -static void __attribute__((constructor)) __preinit_##name(void) { \ - if(!name) \ - name = (type*)calloc(smpi_global_size(), sizeof(type)); \ -} \ -static void __attribute__((destructor)) __postfini_##name(void) { \ - free(name); \ - name = NULL; \ -} - -#define SMPI_VARINIT_GLOBAL_AND_SET(name,type,expr) \ -type *name = NULL; \ -static void __attribute__((constructor)) __preinit_##name(void) { \ - size_t size = smpi_global_size(); \ - size_t i; \ - type value = expr; \ - if(!name) { \ - name = (type*)malloc(size * sizeof(type)); \ - for(i = 0; i < size; i++) { \ - name[i] = value; \ - } \ - } \ -} \ -static void __attribute__((destructor)) __postfini_##name(void) { \ - free(name); \ - name = NULL; \ -} - -#define SMPI_VARGET_GLOBAL(name) name[SIMIX_process_self()->pid] - -/** - * This is used for the old privatization method, i.e., on old - * machines that do not yet support privatization via mmap - */ -#define SMPI_VARINIT_STATIC(name,type) \ -static type *name = NULL; \ -if(!name) { \ - name = (type*)calloc(smpi_global_size(), sizeof(type)); \ - smpi_register_static(name, xbt_free_f); \ -} - -#define SMPI_VARINIT_STATIC_AND_SET(name,type,expr) \ -static type *name = NULL; \ -if(!name) { \ - size_t size = smpi_global_size(); \ - size_t i; \ - type value = expr; \ - name = (type*)malloc(size * sizeof(type)); \ - for(i = 0; i < size; i++) { \ - name[i] = value; \ - } \ - smpi_register_static(name, xbt_free_f); \ -} - -#define SMPI_VARGET_STATIC(name) name[SIMIX_process_self()->pid] - - SG_END_DECL() /* C++ declarations for shared_malloc */