Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
publicly exported smpi data structures.
authormarkls <markls@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 24 Aug 2007 00:45:10 +0000 (00:45 +0000)
committermarkls <markls@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 24 Aug 2007 00:45:10 +0000 (00:45 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4110 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/smpi/smpi.h [new file with mode: 0644]

diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h
new file mode 100644 (file)
index 0000000..967fb64
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef SMPI_H
+#define SMPI_H
+
+#include <sys/time.h>
+#include <xbt/function_types.h>
+
+#define SMPI_RAND_SEED 5
+
+#define MPI_ANY_SOURCE -1
+
+// errorcodes
+#define MPI_SUCCESS     0
+#define MPI_ERR_COMM    1
+#define MPI_ERR_ARG     2
+#define MPI_ERR_TYPE    3
+#define MPI_ERR_REQUEST 4
+#define MPI_ERR_INTERN  5
+#define MPI_ERR_COUNT   6
+#define MPI_ERR_RANK    7
+#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;
+
+// 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;
+
+// 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;
+
+// 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;
+
+// global SMPI data structure
+typedef struct SMPI_MPI_Global {
+
+       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_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;
+
+#define MPI_COMM_WORLD    (smpi_mpi_global->mpi_comm_world)
+
+#define MPI_STATUS_IGNORE NULL
+
+#define MPI_BYTE          (smpi_mpi_global->mpi_byte)
+#define MPI_DOUBLE        (smpi_mpi_global->mpi_double)
+#define MPI_INT           (smpi_mpi_global->mpi_int)
+
+#define MPI_LAND          (smpi_mpi_global->mpi_land)
+#define MPI_SUM           (smpi_mpi_glboal->mpi_sum)
+
+// MPI Functions
+int MPI_Init(int *argc, char ***argv);
+int MPI_Finalize(void);
+int MPI_Abort(MPI_Comm comm, int errorcode);
+int MPI_Comm_size(MPI_Comm comm, int *size);
+int MPI_Comm_rank(MPI_Comm comm, int *rank);
+int MPI_Type_size(MPI_Datatype datatype, size_t *size);
+int MPI_Barrier(MPI_Comm comm);
+int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request *request);
+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);
+
+// smpi functions
+XBT_IMPORT_NO_EXPORT(int) smpi_simulated_main(int argc, char **argv);
+unsigned int smpi_sleep(unsigned int);
+void smpi_exit(int);
+int smpi_gettimeofday(struct timeval *tv, struct timezone *tz);
+
+#endif