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

This commit is contained in:
sjplimp
2014-07-29 15:29:09 +00:00
parent e4915201df
commit 7cd0d58e85
3 changed files with 90 additions and 3 deletions

View File

@ -20,7 +20,7 @@
#include <sys/time.h>
#include "mpi.h"
/* lo-level data structure */
/* data structure for double/int */
struct _mpi_double_int {
double value;
@ -28,6 +28,15 @@ struct _mpi_double_int {
};
typedef struct _mpi_double_int double_int;
/* extra MPI_Datatypes registered by MPI_Type_contiguous */
#define MAXEXTRA_DATATYPE 16
int nextra_datatype;
MPI_Datatype *ptr_datatype[MAXEXTRA_DATATYPE];
int index_datatype[MAXEXTRA_DATATYPE];
int size_datatype[MAXEXTRA_DATATYPE];
/* ---------------------------------------------------------------------- */
/* MPI Functions */
/* ---------------------------------------------------------------------- */
@ -101,6 +110,8 @@ double MPI_Wtime()
/* ---------------------------------------------------------------------- */
/* include sizes of user defined datatypes, stored in extra lists */
static int stubtypesize(MPI_Datatype datatype)
{
if (datatype == MPI_INT) return sizeof(int);
@ -111,6 +122,12 @@ static int stubtypesize(MPI_Datatype datatype)
else if (datatype == MPI_LONG) return sizeof(long);
else if (datatype == MPI_LONG_LONG) return sizeof(uint64_t);
else if (datatype == MPI_DOUBLE_INT) return sizeof(double_int);
else {
int i;
for (i = 0; i < nextra_datatype; i++)
if (datatype == index_datatype[i]) return size_datatype[i];
}
return 0;
}
/* ---------------------------------------------------------------------- */
@ -305,6 +322,66 @@ int MPI_Cart_rank(MPI_Comm comm, int *coords, int *rank)
/* ---------------------------------------------------------------------- */
/* store size of user datatype in extra lists */
int MPI_Type_contiguous(int count, MPI_Datatype oldtype,
MPI_Datatype *newtype)
{
if (nextra_datatype = MAXEXTRA_DATATYPE) return -1;
ptr_datatype[nextra_datatype] = newtype;
index_datatype[nextra_datatype] = -(nextra_datatype + 1);
size_datatype[nextra_datatype] = count * stubtypesize(oldtype);
nextra_datatype++;
return 0;
}
/* ---------------------------------------------------------------------- */
/* set value of user datatype to internal negative index,
based on match of ptr */
int MPI_Type_commit(MPI_Datatype *datatype)
{
int i;
for (i = 0; i < nextra_datatype; i++)
if (datatype == ptr_datatype[i]) *datatype = index_datatype[i];
return 0;
}
/* ---------------------------------------------------------------------- */
/* remove user datatype from extra lists */
int MPI_Type_free(MPI_Datatype *datatype)
{
int i;
for (i = 0; i < nextra_datatype; i++)
if (datatype == ptr_datatype[i]) {
ptr_datatype[i] = ptr_datatype[nextra_datatype-1];
index_datatype[i] = index_datatype[nextra_datatype-1];
size_datatype[i] = size_datatype[nextra_datatype-1];
nextra_datatype--;
break;
}
return 0;
}
/* ---------------------------------------------------------------------- */
int MPI_Op_create(MPI_User_function *function, int commute, MPI_Op *op)
{
return 0;
}
/* ---------------------------------------------------------------------- */
int MPI_Op_free(MPI_Op *op)
{
return 0;
}
/* ---------------------------------------------------------------------- */
int MPI_Barrier(MPI_Comm comm) {return 0;}
/* ---------------------------------------------------------------------- */

View File

@ -64,6 +64,9 @@ extern "C" {
#define MPI_MAX_PROCESSOR_NAME 128
typedef void MPI_User_function(void *invec, void *inoutvec,
int *len, MPI_Datatype *datatype);
/* MPI data structs */
struct _MPI_Status {
@ -122,6 +125,13 @@ int MPI_Cart_shift(MPI_Comm comm, int direction, int displ,
int *source, int *dest);
int MPI_Cart_rank(MPI_Comm comm, int *coords, int *rank);
int MPI_Type_contiguous(int count, MPI_Datatype oldtype,
MPI_Datatype *newtype);
int MPI_Type_commit(MPI_Datatype *datatype);
int MPI_Type_free(MPI_Datatype *datatype);
int MPI_Op_create(MPI_User_function *function, int commute, MPI_Op *op);
int MPI_Op_free(MPI_Op *op);
int MPI_Barrier(MPI_Comm comm);
int MPI_Bcast(void *buf, int count, MPI_Datatype datatype,

View File

@ -101,8 +101,8 @@ RCB::~RCB()
sets noriginal,nfinal,nkeep,recvproc,recvindex,lo,hi
all proc particles will be inside or on surface of 3-d box
defined by final lo/hi
// NOTE: worry about re-use of data structs for fix balance
// NOTE: should I get rid of wt all together, will it be used?
// NOTE: worry about re-use of data structs for fix balance?
// NOTE: could get rid of wt all together, will it be used?
------------------------------------------------------------------------- */
void RCB::compute(int dimension, int n, double **x, double *wt,