X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0b8e893d1b242673966bee6dbf894541288478d9..dae0945417b60dd56b2d01d3190873f1c7eee08d:/include/smpi/smpi.h diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index eaf101bc36..dd0942760c 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -9,11 +9,16 @@ #include #include +#if _POSIX_TIMERS +#include +#endif #include #include #include +#include "simgrid/datatypes.h" +#include "include/smpi/forward.hpp" #ifdef _WIN32 #define MPI_CALL(type,name,args) \ @@ -169,18 +174,34 @@ SG_BEGIN_DECL() #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_LOCK_EXCLUSIVE 1 #define MPI_LOCK_SHARED 2 +#define MPI_MODE_RDONLY 2 +#define MPI_MODE_RDWR 8 +#define MPI_MODE_WRONLY 4 +#define MPI_MODE_CREATE 1 +#define MPI_MODE_EXCL 64 +#define MPI_MODE_DELETE_ON_CLOSE 16 +#define MPI_MODE_UNIQUE_OPEN 32 +#define MPI_MODE_APPEND 128 +#define MPI_MODE_SEQUENTIAL 256 +#define MPI_FILE_NULL ((MPI_File) 0) +#define MPI_DISPLACEMENT_CURRENT -54278278 +#define MPI_SEEK_SET 600 +#define MPI_SEEK_CUR 602 +#define MPI_SEEK_END 604 +#define MPI_MAX_DATAREP_STRING 128 + // FIXME : used nowhere... typedef enum MPIR_Combiner_enum{ MPI_COMBINER_NAMED, @@ -204,12 +225,6 @@ typedef enum MPIR_Combiner_enum{ 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; @@ -217,8 +232,8 @@ 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; @@ -227,10 +242,8 @@ typedef struct { 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) @@ -323,8 +336,7 @@ XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_INTEGER16; #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; @@ -342,25 +354,21 @@ XBT_PUBLIC_DATA( MPI_Op ) MPI_BXOR; //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_Topology *MPI_Topology; + +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 @@ -378,6 +386,7 @@ MPI_CALL(XBT_PUBLIC(int), MPI_Address, (void *location, MPI_Aint * address)); 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)); @@ -435,6 +444,7 @@ MPI_CALL(XBT_PUBLIC(int), MPI_Comm_group, (MPI_Comm comm, MPI_Group * group)); 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)); @@ -727,34 +737,101 @@ MPI_CALL(XBT_PUBLIC(int), MPI_Win_test,(MPI_Win win, int *flag)); MPI_CALL(XBT_PUBLIC(int), MPI_Win_unlock,(int rank, MPI_Win win)); MPI_CALL(XBT_PUBLIC(int), MPI_Win_wait,(MPI_Win win)); + +MPI_CALL(XBT_PUBLIC(int), MPI_File_get_errhandler , (MPI_File file, MPI_Errhandler *errhandler)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_set_errhandler, (MPI_File file, MPI_Errhandler errhandler)); + +MPI_CALL(XBT_PUBLIC(int), MPI_File_open,(MPI_Comm comm, const char *filename, int amode, MPI_Info info, MPI_File *fh)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_close,(MPI_File *fh)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_delete,(const char *filename, MPI_Info info)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_set_size,(MPI_File fh, MPI_Offset size)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_get_size,(MPI_File fh, MPI_Offset *size)); + +MPI_CALL(XBT_PUBLIC(int), MPI_File_set_view,(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, + const char *datarep, MPI_Info info)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_get_view,(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype, MPI_Datatype *filetype, + char *datarep)); + +MPI_CALL(XBT_PUBLIC(int), MPI_File_read_at,(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, + MPI_Status *status)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_read_at_all,(MPI_File fh, MPI_Offset offset, void * buf, int count, + MPI_Datatype datatype, MPI_Status *status)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_read,(MPI_File fh, void * buf, int count, + MPI_Datatype datatype, MPI_Status *status)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_write,(MPI_File fh, const void * buf, int count, + MPI_Datatype datatype, MPI_Status *status)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_write_at,(MPI_File fh, MPI_Offset offset, const void * buf, int count, + MPI_Datatype datatype, MPI_Status *status)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_write_at_all,(MPI_File fh, MPI_Offset offset, const void *buf, int count, + MPI_Datatype datatype, MPI_Status *status)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_set_atomicity,(MPI_File fh, int flag)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_get_atomicity,(MPI_File fh, int *flag)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_sync,(MPI_File fh)); + +MPI_CALL(XBT_PUBLIC(int), MPI_File_read_at_all_begin,(MPI_File fh, MPI_Offset offset, void *buf, int count, + MPI_Datatype datatype)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_read_at_all_end,(MPI_File fh, void *buf, MPI_Status *status)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_write_at_all_begin,(MPI_File fh, MPI_Offset offset, const void *buf, int count,MPI_Datatype datatype)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_write_at_all_end,(MPI_File fh, const void *buf, MPI_Status *status)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_read_all_begin,(MPI_File fh, void *buf, int count, MPI_Datatype datatype)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_read_all_end,(MPI_File fh, void *buf, MPI_Status *status)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_write_all_begin,(MPI_File fh, const void *buf, int count, MPI_Datatype datatype)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_write_all_end,(MPI_File fh, const void *buf, MPI_Status *status)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_read_ordered_begin,(MPI_File fh, void *buf, int count, MPI_Datatype datatype)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_read_ordered_end,(MPI_File fh, void *buf, MPI_Status *status)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_write_ordered_begin,(MPI_File fh, const void *buf, int count, MPI_Datatype datatype)); +MPI_CALL(XBT_PUBLIC(int), MPI_File_write_ordered_end,(MPI_File fh, const void *buf, MPI_Status *status)); + //FIXME: End of all the not yet implemented stuff // smpi functions -XBT_PUBLIC(int) smpi_global_size(void); -XBT_PUBLIC(MPI_Comm) smpi_process_comm_self(void); -XBT_PUBLIC(void*) smpi_process_get_user_data(void); +XBT_PUBLIC(int) smpi_global_size(); +XBT_PUBLIC(MPI_Comm) smpi_process_comm_self(); +XBT_PUBLIC(void*) smpi_process_get_user_data(); XBT_PUBLIC(void) smpi_process_set_user_data(void *); XBT_PUBLIC(void) smpi_execute_flops(double flops); XBT_PUBLIC(void) smpi_execute(double duration); XBT_PUBLIC(double) smpi_get_host_power_peak_at(int pstate_index); -XBT_PUBLIC(double) smpi_get_host_current_power_peak(void); -XBT_PUBLIC(int) smpi_get_host_nb_pstates(void); +XBT_PUBLIC(double) smpi_get_host_current_power_peak(); +XBT_PUBLIC(int) smpi_get_host_nb_pstates(); XBT_PUBLIC(void) smpi_set_host_pstate(int pstate_index); -XBT_PUBLIC(int) smpi_get_host_pstate(void); +XBT_PUBLIC(int) smpi_get_host_pstate(); -XBT_PUBLIC(double) smpi_get_host_consumed_energy(void); +XBT_PUBLIC(double) smpi_get_host_consumed_energy(); XBT_PUBLIC(int) smpi_usleep(useconds_t usecs); +#if _POSIX_TIMERS > 0 +XBT_PUBLIC(int) smpi_nanosleep(const struct timespec *tp, struct timespec * t); +XBT_PUBLIC(int) smpi_clock_gettime(clockid_t clk_id, struct timespec *tp); +#endif XBT_PUBLIC(unsigned int) smpi_sleep(unsigned int secs); XBT_PUBLIC(int) smpi_gettimeofday(struct timeval *tv, void* tz); -XBT_PUBLIC(unsigned long long) smpi_rastro_resolution (void); -XBT_PUBLIC(unsigned long long) smpi_rastro_timestamp (void); +XBT_PUBLIC(unsigned long long) smpi_rastro_resolution (); +XBT_PUBLIC(unsigned long long) smpi_rastro_timestamp (); XBT_PUBLIC(void) smpi_sample_1(int global, const char *file, int line, int iters, double threshold); 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 + * passed as parameters.) + */ +XBT_PUBLIC(void) smpi_trace_set_call_location(const char *file, int line); +/** Fortran binding **/ +XBT_PUBLIC(void) smpi_trace_set_call_location_(const char *file, int* line); +/** Fortran binding + -fsecond-underscore **/ +XBT_PUBLIC(void) smpi_trace_set_call_location__(const char *file, int* line); + #define SMPI_SAMPLE_LOCAL(iters,thres) for(smpi_sample_1(0, __FILE__, __LINE__, iters, thres); \ smpi_sample_2(0, __FILE__, __LINE__); \ smpi_sample_3(0, __FILE__, __LINE__)) @@ -782,22 +859,22 @@ XBT_PUBLIC(void*) smpi_shared_set_call(const char* func, const char* input, void /* Fortran specific stuff */ XBT_PUBLIC(int) __attribute__((weak)) smpi_simulated_main_(int argc, char** argv); -XBT_PUBLIC(int) __attribute__((weak)) MAIN__(void); +XBT_PUBLIC(int) __attribute__((weak)) MAIN__(); XBT_PUBLIC(int) smpi_main(int (*realmain) (int argc, char *argv[]),int argc, char *argv[]); -XBT_PUBLIC(void) __attribute__((weak)) user_main_(void); -XBT_PUBLIC(int) smpi_process_index(void); +XBT_PUBLIC(void) __attribute__((weak)) user_main_(); +XBT_PUBLIC(int) smpi_process_index(); XBT_PUBLIC(void) smpi_process_init(int *argc, char ***argv); /* Trace replay specific stuff */ XBT_PUBLIC(void) smpi_replay_run(int *argc, char***argv); XBT_PUBLIC(void) SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_processes); -XBT_PUBLIC(void) SMPI_init(void); -XBT_PUBLIC(void) SMPI_finalize(void); +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(void); +XBT_PUBLIC(void) smpi_free_static(); #define SMPI_VARINIT_GLOBAL(name,type) \ type *name = NULL; \ @@ -830,6 +907,10 @@ static void __attribute__((destructor)) __postfini_##name(void) { \ #define SMPI_VARGET_GLOBAL(name) name[smpi_process_index()] +/** + * 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) { \ @@ -852,5 +933,6 @@ if(!name) { \ #define SMPI_VARGET_STATIC(name) name[smpi_process_index()] + SG_END_DECL() #endif