git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@4487 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2010-08-16 18:51:25 +00:00
parent c98147c8e9
commit 211e5f3c09
3 changed files with 132 additions and 103 deletions

View File

@ -38,32 +38,35 @@ struct {
/* MPI Functions */ /* MPI Functions */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Init(int *argc, char ***argv) {} int MPI_Init(int *argc, char ***argv) {return 0;}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Comm_rank(MPI_Comm comm, int *me) int MPI_Comm_rank(MPI_Comm comm, int *me)
{ {
*me = 0; *me = 0;
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Comm_size(MPI_Comm comm, int *nprocs) int MPI_Comm_size(MPI_Comm comm, int *nprocs)
{ {
*nprocs = 1; *nprocs = 1;
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Abort(MPI_Comm comm, int errorcode) int MPI_Abort(MPI_Comm comm, int errorcode)
{ {
exit(1); exit(1);
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Finalize() {} int MPI_Finalize() {return 0;}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -79,140 +82,155 @@ double MPI_Wtime()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Send(void *buf, int count, MPI_Datatype datatype, int MPI_Send(void *buf, int count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm) int dest, int tag, MPI_Comm comm)
{ {
printf("MPI Stub WARNING: Should not send message to self\n"); printf("MPI Stub WARNING: Should not send message to self\n");
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Rsend(void *buf, int count, MPI_Datatype datatype, int MPI_Rsend(void *buf, int count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm) int dest, int tag, MPI_Comm comm)
{ {
printf("MPI Stub WARNING: Should not rsend message to self\n"); printf("MPI Stub WARNING: Should not rsend message to self\n");
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Recv(void *buf, int count, MPI_Datatype datatype, int MPI_Recv(void *buf, int count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm, MPI_Status *status) int source, int tag, MPI_Comm comm, MPI_Status *status)
{ {
printf("MPI Stub WARNING: Should not recv message from self\n"); printf("MPI Stub WARNING: Should not recv message from self\n");
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int MPI_Irecv(void *buf, int count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm, MPI_Request *request) int source, int tag, MPI_Comm comm, MPI_Request *request)
{ {
printf("MPI Stub WARNING: Should not recv message from self\n"); printf("MPI Stub WARNING: Should not recv message from self\n");
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Wait(MPI_Request *request, MPI_Status *status) int MPI_Wait(MPI_Request *request, MPI_Status *status)
{ {
printf("MPI Stub WARNING: Should not wait on message from self\n"); printf("MPI Stub WARNING: Should not wait on message from self\n");
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Waitall(int n, MPI_Request *request, MPI_Status *status) int MPI_Waitall(int n, MPI_Request *request, MPI_Status *status)
{ {
printf("MPI Stub WARNING: Should not wait on message from self\n"); printf("MPI Stub WARNING: Should not wait on message from self\n");
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Waitany(int count, MPI_Request *request, int *index, int MPI_Waitany(int count, MPI_Request *request, int *index,
MPI_Status *status) MPI_Status *status)
{ {
printf("MPI Stub WARNING: Should not wait on message from self\n"); printf("MPI Stub WARNING: Should not wait on message from self\n");
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Sendrecv(void *sbuf, int scount, MPI_Datatype sdatatype, int MPI_Sendrecv(void *sbuf, int scount, MPI_Datatype sdatatype,
int dest, int stag, void *rbuf, int rcount, int dest, int stag, void *rbuf, int rcount,
MPI_Datatype rdatatype, int source, int rtag, MPI_Datatype rdatatype, int source, int rtag,
MPI_Comm comm, MPI_Status *status) MPI_Comm comm, MPI_Status *status)
{ {
printf("MPI Stub WARNING: Should not send message to self\n"); printf("MPI Stub WARNING: Should not send message to self\n");
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count) int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count)
{ {
printf("MPI Stub WARNING: Should not get count of message to self\n"); printf("MPI Stub WARNING: Should not get count of message to self\n");
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *comm_out) int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *comm_out)
{ {
*comm_out = comm; *comm_out = comm;
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Comm_dup(MPI_Comm comm, MPI_Comm *comm_out) int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *comm_out)
{ {
*comm_out = comm; *comm_out = comm;
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Comm_free(MPI_Comm *comm) { } int MPI_Comm_free(MPI_Comm *comm) {return 0;}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Cart_create(MPI_Comm comm_old, int ndims, int *dims, int *periods, int MPI_Cart_create(MPI_Comm comm_old, int ndims, int *dims, int *periods,
int reorder, MPI_Comm *comm_cart) int reorder, MPI_Comm *comm_cart)
{ {
*comm_cart = comm_old; *comm_cart = comm_old;
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Cart_get(MPI_Comm comm, int maxdims, int *dims, int *periods, int MPI_Cart_get(MPI_Comm comm, int maxdims, int *dims, int *periods,
int *coords) int *coords)
{ {
dims[0] = dims[1] = dims[2] = 1; dims[0] = dims[1] = dims[2] = 1;
periods[0] = periods[1] = periods[2] = 1; periods[0] = periods[1] = periods[2] = 1;
coords[0] = coords[1] = coords[2] = 0; coords[0] = coords[1] = coords[2] = 0;
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Cart_shift(MPI_Comm comm, int direction, int displ, int MPI_Cart_shift(MPI_Comm comm, int direction, int displ,
int *source, int *dest) int *source, int *dest)
{ {
*source = *dest = 0; *source = *dest = 0;
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Cart_rank(MPI_Comm comm, int *coords, int *rank) int MPI_Cart_rank(MPI_Comm comm, int *coords, int *rank)
{ {
*rank = 0; *rank = 0;
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Barrier(MPI_Comm comm) {} int MPI_Barrier(MPI_Comm comm) {return 0;}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Bcast(void *buf, int count, MPI_Datatype datatype, int MPI_Bcast(void *buf, int count, MPI_Datatype datatype,
int root, MPI_Comm comm) {} int root, MPI_Comm comm) {return 0;}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* copy values from data1 to data2 */ /* copy values from data1 to data2 */
void MPI_Allreduce(void *sendbuf, void *recvbuf, int count, int MPI_Allreduce(void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{ {
int n; int n;
@ -224,13 +242,14 @@ void MPI_Allreduce(void *sendbuf, void *recvbuf, int count,
else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int); else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int);
memcpy(recvbuf,sendbuf,n); memcpy(recvbuf,sendbuf,n);
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* copy values from data1 to data2 */ /* copy values from data1 to data2 */
void MPI_Reduce(void *sendbuf, void *recvbuf, int count, int MPI_Reduce(void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, MPI_Datatype datatype, MPI_Op op,
int root, MPI_Comm comm) int root, MPI_Comm comm)
{ {
@ -243,11 +262,13 @@ void MPI_Reduce(void *sendbuf, void *recvbuf, int count,
else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int); else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int);
memcpy(recvbuf,sendbuf,n); memcpy(recvbuf,sendbuf,n);
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void MPI_Scan(void *sendbuf, void *recvbuf, int count, int MPI_Scan(void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{ {
int n; int n;
@ -259,13 +280,14 @@ void MPI_Scan(void *sendbuf, void *recvbuf, int count,
else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int); else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int);
memcpy(recvbuf,sendbuf,n); memcpy(recvbuf,sendbuf,n);
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* copy values from data1 to data2 */ /* copy values from data1 to data2 */
void MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype, void *recvbuf, int recvcount, MPI_Datatype recvtype,
MPI_Comm comm) MPI_Comm comm)
{ {
@ -278,13 +300,14 @@ void MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int); else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int);
memcpy(recvbuf,sendbuf,n); memcpy(recvbuf,sendbuf,n);
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* copy values from data1 to data2 */ /* copy values from data1 to data2 */
void MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int *recvcounts, int *displs, void *recvbuf, int *recvcounts, int *displs,
MPI_Datatype recvtype, MPI_Comm comm) MPI_Datatype recvtype, MPI_Comm comm)
{ {
@ -297,13 +320,14 @@ void MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int); else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int);
memcpy(recvbuf,sendbuf,n); memcpy(recvbuf,sendbuf,n);
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* copy values from data1 to data2 */ /* copy values from data1 to data2 */
void MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{ {
int n; int n;
@ -315,13 +339,14 @@ void MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
else if (datatype == MPI_DOUBLE_INT) n = *recvcounts*sizeof(double_int); else if (datatype == MPI_DOUBLE_INT) n = *recvcounts*sizeof(double_int);
memcpy(recvbuf,sendbuf,n); memcpy(recvbuf,sendbuf,n);
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* copy values from data1 to data2 */ /* copy values from data1 to data2 */
void MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype, void *recvbuf, int recvcount, MPI_Datatype recvtype,
int root, MPI_Comm comm) int root, MPI_Comm comm)
{ {
@ -334,13 +359,14 @@ void MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int); else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int);
memcpy(recvbuf,sendbuf,n); memcpy(recvbuf,sendbuf,n);
return 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* copy values from data1 to data2 */ /* copy values from data1 to data2 */
void MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int *recvcounts, int *displs, void *recvbuf, int *recvcounts, int *displs,
MPI_Datatype recvtype, int root, MPI_Comm comm) MPI_Datatype recvtype, int root, MPI_Comm comm)
{ {
@ -353,4 +379,5 @@ void MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int); else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int);
memcpy(recvbuf,sendbuf,n); memcpy(recvbuf,sendbuf,n);
return 0;
} }

View File

@ -18,6 +18,8 @@
#define MPI_COMM_WORLD 0 #define MPI_COMM_WORLD 0
#define MPI_SUCCESS 0
#define MPI_INT 1 #define MPI_INT 1
#define MPI_FLOAT 2 #define MPI_FLOAT 2
#define MPI_DOUBLE 3 #define MPI_DOUBLE 3
@ -47,64 +49,64 @@ struct MPI_Status {
/* Function prototypes for MPI stubs */ /* Function prototypes for MPI stubs */
void MPI_Init(int *argc, char ***argv); int MPI_Init(int *argc, char ***argv);
void MPI_Comm_rank(MPI_Comm comm, int *me); int MPI_Comm_rank(MPI_Comm comm, int *me);
void MPI_Comm_size(MPI_Comm comm, int *nprocs); int MPI_Comm_size(MPI_Comm comm, int *nprocs);
void MPI_Abort(MPI_Comm comm, int errorcode); int MPI_Abort(MPI_Comm comm, int errorcode);
void MPI_Finalize(); int MPI_Finalize();
double MPI_Wtime(); double MPI_Wtime();
void MPI_Send(void *buf, int count, MPI_Datatype datatype, int MPI_Send(void *buf, int count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm); int dest, int tag, MPI_Comm comm);
void MPI_Rsend(void *buf, int count, MPI_Datatype datatype, int MPI_Rsend(void *buf, int count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm); int dest, int tag, MPI_Comm comm);
void MPI_Recv(void *buf, int count, MPI_Datatype datatype, int MPI_Recv(void *buf, int count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm, MPI_Status *status); int source, int tag, MPI_Comm comm, MPI_Status *status);
void MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int MPI_Irecv(void *buf, int count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm, MPI_Request *request); int source, int tag, MPI_Comm comm, MPI_Request *request);
void MPI_Wait(MPI_Request *request, MPI_Status *status); int MPI_Wait(MPI_Request *request, MPI_Status *status);
void MPI_Waitall(int n, MPI_Request *request, MPI_Status *status); int MPI_Waitall(int n, MPI_Request *request, MPI_Status *status);
void MPI_Waitany(int count, MPI_Request *request, int *index, int MPI_Waitany(int count, MPI_Request *request, int *index,
MPI_Status *status); MPI_Status *status);
void MPI_Sendrecv(void *sbuf, int scount, MPI_Datatype sdatatype, int MPI_Sendrecv(void *sbuf, int scount, MPI_Datatype sdatatype,
int dest, int stag, void *rbuf, int rcount, int dest, int stag, void *rbuf, int rcount,
MPI_Datatype rdatatype, int source, int rtag, MPI_Datatype rdatatype, int source, int rtag,
MPI_Comm comm, MPI_Status *status); MPI_Comm comm, MPI_Status *status);
void MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count); int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count);
void MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *comm_out); int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *comm_out);
void MPI_Comm_dup(MPI_Comm comm, MPI_Comm *comm_out); int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *comm_out);
void MPI_Comm_free(MPI_Comm *comm); int MPI_Comm_free(MPI_Comm *comm);
void MPI_Cart_create(MPI_Comm comm_old, int ndims, int *dims, int *periods, int MPI_Cart_create(MPI_Comm comm_old, int ndims, int *dims, int *periods,
int reorder, MPI_Comm *comm_cart); int reorder, MPI_Comm *comm_cart);
void MPI_Cart_get(MPI_Comm comm, int maxdims, int *dims, int *periods, int MPI_Cart_get(MPI_Comm comm, int maxdims, int *dims, int *periods,
int *coords); int *coords);
void MPI_Cart_shift(MPI_Comm comm, int direction, int displ, int MPI_Cart_shift(MPI_Comm comm, int direction, int displ,
int *source, int *dest); int *source, int *dest);
void MPI_Cart_rank(MPI_Comm comm, int *coords, int *rank); int MPI_Cart_rank(MPI_Comm comm, int *coords, int *rank);
void MPI_Barrier(MPI_Comm comm); int MPI_Barrier(MPI_Comm comm);
void MPI_Bcast(void *buf, int count, MPI_Datatype datatype, int MPI_Bcast(void *buf, int count, MPI_Datatype datatype,
int root, MPI_Comm comm); int root, MPI_Comm comm);
void MPI_Allreduce(void *sendbuf, void *recvbuf, int count, int MPI_Allreduce(void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
void MPI_Reduce(void *sendbuf, void *recvbuf, int count, int MPI_Reduce(void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm); MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm);
void MPI_Scan(void *sendbuf, void *recvbuf, int count, int MPI_Scan(void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
void MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype, void *recvbuf, int recvcount, MPI_Datatype recvtype,
MPI_Comm comm); MPI_Comm comm);
void MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int *recvcounts, int *displs, void *recvbuf, int *recvcounts, int *displs,
MPI_Datatype recvtype, MPI_Comm comm); MPI_Datatype recvtype, MPI_Comm comm);
void MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
void MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype, void *recvbuf, int recvcount, MPI_Datatype recvtype,
int root, MPI_Comm comm); int root, MPI_Comm comm);
void MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int *recvcounts, int *displs, void *recvbuf, int *recvcounts, int *displs,
MPI_Datatype recvtype, int root, MPI_Comm comm); MPI_Datatype recvtype, int root, MPI_Comm comm);