Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
added code to allow for DO_ONCE loops. very preliminary.
[simgrid.git] / include / smpi / smpi.h
index 967fb64..1ab6b12 100644 (file)
@@ -8,6 +8,10 @@
 
 #define MPI_ANY_SOURCE -1
 
+#define MPI_ANY_TAG -1
+
+#define MPI_UNDEFINED -1
+
 // errorcodes
 #define MPI_SUCCESS     0
 #define MPI_ERR_COMM    1
 #define MPI_ERR_TAG     8
 
 // MPI_Comm
-typedef struct smpi_mpi_communicator_simdata *smpi_mpi_communicator_simdata_t;
-struct smpi_mpi_communicator_t {
-  int            size;
-  smpi_mpi_communicator_simdata_t simdata;
-};
-typedef struct smpi_mpi_communicator_t smpi_mpi_communicator_t;
-typedef smpi_mpi_communicator_t *MPI_Comm;
-
-// MPI_Status
-struct smpi_mpi_status_t {
-  int MPI_SOURCE;
-};
-typedef struct smpi_mpi_status_t smpi_mpi_status_t;
-typedef smpi_mpi_status_t MPI_Status;
+typedef struct smpi_mpi_communicator_t *smpi_mpi_communicator_t;
+typedef smpi_mpi_communicator_t MPI_Comm;
 
 // MPI_Datatype
-struct smpi_mpi_datatype_t {
-  size_t size;
-};
-typedef struct smpi_mpi_datatype_t smpi_mpi_datatype_t;
-typedef smpi_mpi_datatype_t *MPI_Datatype;
+typedef struct smpi_mpi_datatype_t *smpi_mpi_datatype_t;
+typedef smpi_mpi_datatype_t MPI_Datatype;
 
 // MPI_Request
-typedef struct smpi_mpi_request_simdata *smpi_mpi_request_simdata_t;
-struct smpi_mpi_request_t {
-       smpi_mpi_communicator_t *comm;
-       int src;
-       int dst;
-       int tag;
-
-       void *buf;
-       smpi_mpi_datatype_t *datatype;
-       int count;
-
-       short int completed :1;
-
-       smpi_mpi_request_simdata_t simdata;
-};
-typedef struct smpi_mpi_request_t smpi_mpi_request_t;
-typedef smpi_mpi_request_t *MPI_Request;
+typedef struct smpi_mpi_request_t *smpi_mpi_request_t;
+typedef smpi_mpi_request_t MPI_Request;
 
 // MPI_Op
-struct smpi_mpi_op_t {
-  void (*func)(void *x, void *y, void *z);
+typedef struct smpi_mpi_op_t *smpi_mpi_op_t;
+typedef smpi_mpi_op_t MPI_Op;
+
+// MPI_Status
+struct smpi_mpi_status_t {
+  int MPI_SOURCE;
+  int MPI_TAG;
+  int MPI_ERROR;
 };
-typedef struct smpi_mpi_op_t smpi_mpi_op_t;
-typedef smpi_mpi_op_t *MPI_Op;
+typedef struct smpi_mpi_status_t smpi_mpi_status_t;
+typedef smpi_mpi_status_t MPI_Status;
 
 // global SMPI data structure
-typedef struct SMPI_MPI_Global {
+typedef struct smpi_mpi_global_t {
 
-       smpi_mpi_communicator_t *mpi_comm_world;
+       smpi_mpi_communicator_t mpi_comm_world;
 
-       smpi_mpi_datatype_t     *mpi_byte;
-       smpi_mpi_datatype_t     *mpi_int;
-       smpi_mpi_datatype_t     *mpi_double;
+       smpi_mpi_datatype_t     mpi_byte;
+       smpi_mpi_datatype_t     mpi_int;
+       smpi_mpi_datatype_t     mpi_double;
 
-       smpi_mpi_op_t           *mpi_land;
-       smpi_mpi_op_t           *mpi_sum;
+       smpi_mpi_op_t           mpi_land;
+       smpi_mpi_op_t           mpi_sum;
 
-} s_SMPI_MPI_Global_t, *SMPI_MPI_Global_t;
-extern SMPI_MPI_Global_t smpi_mpi_global;
+} s_smpi_mpi_global_t;
+typedef struct smpi_mpi_global_t *smpi_mpi_global_t;
+extern smpi_mpi_global_t smpi_mpi_global;
 
 #define MPI_COMM_WORLD    (smpi_mpi_global->mpi_comm_world)
+#define MPI_COMM_NULL     NULL
 
 #define MPI_STATUS_IGNORE NULL
 
@@ -106,6 +88,8 @@ int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI
 int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status *status);
 int MPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request *request);
 int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
+int MPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm);
+int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *comm_out);
 
 // smpi functions
 XBT_IMPORT_NO_EXPORT(int) smpi_simulated_main(int argc, char **argv);
@@ -113,4 +97,9 @@ unsigned int smpi_sleep(unsigned int);
 void smpi_exit(int);
 int smpi_gettimeofday(struct timeval *tv, struct timezone *tz);
 
+void smpi_do_once_1(void);
+int  smpi_do_once_2(void);
+void smpi_do_once_3(void);
+#define DO_ONCE for (smpi_do_once_1(); smpi_do_once_2(); smpi_do_once_3())
+
 #endif