#include <time.h>
#endif
+#include <simgrid/datatypes.h>
+#include <smpi/forward.hpp>
#include <stddef.h>
-#include <xbt/misc.h>
#include <xbt/function_types.h>
+#include <xbt/misc.h>
#ifdef _WIN32
#define MPI_CALL(type,name,args) \
#define MPI_TYPECLASS_INTEGER 1
#define MPI_TYPECLASS_COMPLEX 2
#define MPI_ROOT 0
-#define MPI_INFO_NULL NULL
+#define MPI_INFO_NULL ((MPI_Info)NULL)
#define MPI_COMM_TYPE_SHARED 1
#define MPI_WIN_NULL ((MPI_Win)NULL)
-#define MPI_VERSION 1
-#define MPI_SUBVERSION 1
+#define MPI_VERSION 2
+#define MPI_SUBVERSION 2
#define MPI_UNWEIGHTED (int *)0
#define MPI_ARGV_NULL (char **)0
#define MPI_ARGVS_NULL (char ***)0
#define MPI_SEEK_END 604
#define MPI_MAX_DATAREP_STRING 128
+#define MPI_WIN_BASE -1
+#define MPI_WIN_SIZE -2
+#define MPI_WIN_DISP_UNIT -3
+
// FIXME : used nowhere...
typedef enum MPIR_Combiner_enum{
MPI_COMBINER_NAMED,
MPI_COMBINER_HINDEXED_BLOCK
}MPIR_Combiner_enum;
-typedef enum MPIR_Topo_type {
- MPI_GRAPH=1,
- MPI_CART=2,
- MPI_DIST_GRAPH=3,
- MPI_INVALID_TOPO=-1
-} MPIR_Topo_type;
typedef ptrdiff_t MPI_Aint;
typedef long long MPI_Offset;
struct s_MPI_File;
typedef struct s_MPI_File *MPI_File;
-struct s_smpi_mpi_datatype;
-typedef struct s_smpi_mpi_datatype *MPI_Datatype;
+
+typedef SMPI_Datatype *MPI_Datatype;
typedef struct {
int MPI_SOURCE;
int count;
} MPI_Status;
-struct s_smpi_mpi_win;
-typedef struct s_smpi_mpi_win* MPI_Win;
-struct s_smpi_mpi_info;
-typedef struct s_smpi_mpi_info *MPI_Info;
+typedef SMPI_Win* MPI_Win;
+typedef SMPI_Info* MPI_Info;
#define MPI_STATUS_IGNORE ((MPI_Status*)NULL)
#define MPI_STATUSES_IGNORE ((MPI_Status*)NULL)
//defines for fortran compatibility
#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
- #define MPI_INTEGER MPI_INT
- #define MPI_2INTEGER MPI_2INT
- #define MPI_LOGICAL MPI_INT
+#define MPI_INTEGER MPI_INT
+#define MPI_2INTEGER MPI_2INT
+#define MPI_LOGICAL MPI_INT
#else
- #define MPI_INTEGER MPI_LONG
- #define MPI_2INTEGER MPI_2LONG
- #define MPI_LOGICAL MPI_LONG
+#define MPI_INTEGER MPI_LONG
+#define MPI_2INTEGER MPI_2LONG
+#define MPI_LOGICAL MPI_LONG
#endif
#define MPI_Fint int
#define MPI_2DOUBLE_PRECISION MPI_2DOUBLE
typedef void MPI_User_function(void *invec, void *inoutvec, int *len, MPI_Datatype * datatype);
-struct s_smpi_mpi_op;
-typedef struct s_smpi_mpi_op *MPI_Op;
+typedef SMPI_Op *MPI_Op;
#define MPI_OP_NULL ((MPI_Op)NULL)
XBT_PUBLIC_DATA( MPI_Op ) MPI_MAX;
//For accumulate
XBT_PUBLIC_DATA( MPI_Op ) MPI_REPLACE;
-struct s_smpi_mpi_topology;
-typedef struct s_smpi_mpi_topology *MPI_Topology;
-
-struct s_smpi_mpi_group;
-typedef struct s_smpi_mpi_group *MPI_Group;
+typedef SMPI_Group* MPI_Group;
#define MPI_GROUP_NULL ((MPI_Group)NULL)
XBT_PUBLIC_DATA( MPI_Group ) MPI_GROUP_EMPTY;
-struct s_smpi_mpi_communicator;
-typedef struct s_smpi_mpi_communicator *MPI_Comm;
+typedef SMPI_Comm *MPI_Comm;
#define MPI_COMM_NULL ((MPI_Comm)NULL)
XBT_PUBLIC_DATA( MPI_Comm ) MPI_COMM_WORLD;
#define MPI_COMM_SELF smpi_process_comm_self()
-struct s_smpi_mpi_request;
-typedef struct s_smpi_mpi_request *MPI_Request;
+typedef SMPI_Request *MPI_Request;
#define MPI_REQUEST_NULL ((MPI_Request)NULL)
#define MPI_FORTRAN_REQUEST_NULL -1
+typedef int MPI_Copy_function(MPI_Comm oldcomm, int keyval, void* extra_state, void* attribute_val_in,
+ void* attribute_val_out, int* flag);
+typedef int MPI_Delete_function(MPI_Comm comm, int keyval, void* attribute_val, void* extra_state);
+#define MPI_Comm_copy_attr_function MPI_Copy_function
+#define MPI_Comm_delete_attr_function MPI_Delete_function
+typedef int MPI_Type_copy_attr_function(MPI_Datatype type, int keyval, void* extra_state, void* attribute_val_in,
+ void* attribute_val_out, int* flag);
+typedef int MPI_Type_delete_attr_function(MPI_Datatype type, int keyval, void* attribute_val, void* extra_state);
+typedef int MPI_Win_copy_attr_function(MPI_Win win, int keyval, void* extra_state, void* attribute_val_in,
+ void* attribute_val_out, int* flag);
+typedef int MPI_Win_delete_attr_function(MPI_Win win, int keyval, void* attribute_val, void* extra_state);
+#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)
+#define MPI_TYPE_NULL_DELETE_FN ((MPI_Type_delete_attr_function*)0)
+#define MPI_WIN_NULL_COPY_FN ((MPI_Win_copy_attr_function*)0)
+#define MPI_WIN_NULL_DELETE_FN ((MPI_Win_delete_attr_function*)0)
+
+
MPI_CALL(XBT_PUBLIC(int), MPI_Init, (int *argc, char ***argv));
MPI_CALL(XBT_PUBLIC(int), MPI_Finalize, (void));
MPI_CALL(XBT_PUBLIC(int), MPI_Finalized, (int* flag));
MPI_CALL(XBT_PUBLIC(int), MPI_Get_address, (void *location, MPI_Aint * address));
MPI_CALL(XBT_PUBLIC(int), MPI_Type_free, (MPI_Datatype * datatype));
MPI_CALL(XBT_PUBLIC(int), MPI_Type_size, (MPI_Datatype datatype, int *size));
+MPI_CALL(XBT_PUBLIC(int), MPI_Type_size_x, (MPI_Datatype datatype, MPI_Count *size));
MPI_CALL(XBT_PUBLIC(int), MPI_Type_get_extent, (MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent));
MPI_CALL(XBT_PUBLIC(int), MPI_Type_get_true_extent, (MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent));
MPI_CALL(XBT_PUBLIC(int), MPI_Type_extent, (MPI_Datatype datatype, MPI_Aint * extent));
MPI_CALL(XBT_PUBLIC(int), MPI_Comm_compare, (MPI_Comm comm1, MPI_Comm comm2, int *result));
MPI_CALL(XBT_PUBLIC(int), MPI_Comm_create, (MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm));
+MPI_CALL(XBT_PUBLIC(int), MPI_Comm_create_group, (MPI_Comm comm, MPI_Group group, int tag, MPI_Comm * newcomm));
MPI_CALL(XBT_PUBLIC(int), MPI_Comm_free, (MPI_Comm * comm));
MPI_CALL(XBT_PUBLIC(int), MPI_Comm_disconnect, (MPI_Comm * comm));
MPI_CALL(XBT_PUBLIC(int), MPI_Comm_split, (MPI_Comm comm, int color, int key, MPI_Comm* comm_out));
MPI_CALL(XBT_PUBLIC(int), MPI_Win_get_name,(MPI_Win win, char * name, int* len));
MPI_CALL(XBT_PUBLIC(int), MPI_Win_get_group,(MPI_Win win, MPI_Group * group));
MPI_CALL(XBT_PUBLIC(int), MPI_Win_fence,( int assert, MPI_Win win));
+MPI_CALL(XBT_PUBLIC(int), MPI_Win_get_attr, (MPI_Win type, int type_keyval, void *attribute_val, int* flag));
+MPI_CALL(XBT_PUBLIC(int), MPI_Win_set_attr, (MPI_Win type, int type_keyval, void *att));
+MPI_CALL(XBT_PUBLIC(int), MPI_Win_delete_attr, (MPI_Win type, int comm_keyval));
+MPI_CALL(XBT_PUBLIC(int), MPI_Win_create_keyval,(MPI_Win_copy_attr_function* copy_fn,
+ MPI_Win_delete_attr_function* delete_fn, int* keyval, void* extra_state));
+MPI_CALL(XBT_PUBLIC(int), MPI_Win_free_keyval,(int* keyval));
+
MPI_CALL(XBT_PUBLIC(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));
typedef void* MPI_Errhandler;
-typedef int MPI_Copy_function(MPI_Comm oldcomm, int keyval, void* extra_state, void* attribute_val_in,
- void* attribute_val_out, int* flag);
-typedef int MPI_Delete_function(MPI_Comm comm, int keyval, void* attribute_val, void* extra_state);
-#define MPI_Comm_copy_attr_function MPI_Copy_function
-#define MPI_Comm_delete_attr_function MPI_Delete_function
-typedef int MPI_Type_copy_attr_function(MPI_Datatype type, int keyval, void* extra_state, void* attribute_val_in,
- void* attribute_val_out, int* flag);
-typedef int MPI_Type_delete_attr_function(MPI_Datatype type, int keyval, void* attribute_val, void* extra_state);
typedef void MPI_Comm_errhandler_function(MPI_Comm *, 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 MPI_Comm_dup
-#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_COMM_DUP_FN ((MPI_Comm_copy_attr_function *)MPI_DUP_FN)
-#define MPI_TYPE_NULL_COPY_FN ((MPI_Type_copy_attr_function*)0)
-#define MPI_TYPE_NULL_DELETE_FN ((MPI_Type_delete_attr_function*)0)
-#define MPI_TYPE_DUP_FN ((MPI_Type_copy_attr_function*)MPI_DUP_FN)
+#define MPI_WIN_DUP_FN ((MPI_Win_copy_attr_function*)MPI_DUP_FN)
+#define MPI_TYPE_DUP_FN ((MPI_Type_copy_attr_function*)MPI_DUP_FN)
+#define MPI_COMM_DUP_FN ((MPI_Comm_copy_attr_function *)MPI_DUP_FN)
typedef MPI_Comm_errhandler_function MPI_Comm_errhandler_fn;
#define MPI_INFO_ENV 1
XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_PACKED;
XBT_PUBLIC(int) smpi_sample_2(int global, const char *file, int line);
XBT_PUBLIC(void) smpi_sample_3(int global, const char *file, int line);
+/**
+ * Need a public setter for SMPI copy_callback function, so users can define
+ * their own while still using default SIMIX_copy_callback for MSG copies.
+ */
+XBT_PUBLIC(void) smpi_comm_set_copy_data_callback(void (*callback) (smx_activity_t, void*, size_t));
+
+
/**
* Functions for call location tracing. These functions will be
* called from the user's application! (With the __FILE__ and __LINE__ values