From 8d5905c455aca494c06497428761c6896906467f Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 4 Jan 2011 20:30:03 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5469 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/STUBS/mpi.cpp | 22 ++++++++++++++++++++++ src/STUBS/mpi.h | 5 ++++- src/min.cpp | 4 ++-- src/min.h | 3 ++- src/replicate.cpp | 1 - 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/STUBS/mpi.cpp b/src/STUBS/mpi.cpp index 6468619d3c..e4f8d82fa6 100644 --- a/src/STUBS/mpi.cpp +++ b/src/STUBS/mpi.cpp @@ -16,6 +16,7 @@ #include "stdlib.h" #include "string.h" #include "stdio.h" +#include "stdint.h" #include #include "mpi.h" @@ -90,6 +91,19 @@ double MPI_Wtime() /* ---------------------------------------------------------------------- */ +int MPI_Type_size(MPI_Datatype datatype, int *size) +{ + if (datatype == MPI_INT) *size = sizeof(int); + else if (datatype == MPI_FLOAT) *size = sizeof(float); + else if (datatype == MPI_DOUBLE) *size = sizeof(double); + else if (datatype == MPI_CHAR) *size = sizeof(char); + else if (datatype == MPI_BYTE) *size = sizeof(char); + else if (datatype == MPI_UNSIGNED_LONG) *size = sizeof(uint64_t); + else if (datatype == MPI_DOUBLE_INT) *size = sizeof(double_int); +} + +/* ---------------------------------------------------------------------- */ + int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) { @@ -247,6 +261,7 @@ int MPI_Allreduce(void *sendbuf, void *recvbuf, int count, else if (datatype == MPI_DOUBLE) n = count*sizeof(double); else if (datatype == MPI_CHAR) n = count*sizeof(char); else if (datatype == MPI_BYTE) n = count*sizeof(char); + else if (datatype == MPI_UNSIGNED_LONG) n = count*sizeof(uint64_t); else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int); memcpy(recvbuf,sendbuf,n); @@ -267,6 +282,7 @@ int MPI_Reduce(void *sendbuf, void *recvbuf, int count, else if (datatype == MPI_DOUBLE) n = count*sizeof(double); else if (datatype == MPI_CHAR) n = count*sizeof(char); else if (datatype == MPI_BYTE) n = count*sizeof(char); + else if (datatype == MPI_UNSIGNED_LONG) n = count*sizeof(uint64_t); else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int); memcpy(recvbuf,sendbuf,n); @@ -285,6 +301,7 @@ int MPI_Scan(void *sendbuf, void *recvbuf, int count, else if (datatype == MPI_DOUBLE) n = count*sizeof(double); else if (datatype == MPI_CHAR) n = count*sizeof(char); else if (datatype == MPI_BYTE) n = count*sizeof(char); + else if (datatype == MPI_UNSIGNED_LONG) n = count*sizeof(uint64_t); else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int); memcpy(recvbuf,sendbuf,n); @@ -305,6 +322,7 @@ int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, else if (sendtype == MPI_DOUBLE) n = sendcount*sizeof(double); else if (sendtype == MPI_CHAR) n = sendcount*sizeof(char); else if (sendtype == MPI_BYTE) n = sendcount*sizeof(char); + else if (sendtype == MPI_UNSIGNED_LONG) n = sendcount*sizeof(uint64_t); else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int); memcpy(recvbuf,sendbuf,n); @@ -325,6 +343,7 @@ int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, else if (sendtype == MPI_DOUBLE) n = sendcount*sizeof(double); else if (sendtype == MPI_CHAR) n = sendcount*sizeof(char); else if (sendtype == MPI_BYTE) n = sendcount*sizeof(char); + else if (sendtype == MPI_UNSIGNED_LONG) n = sendcount*sizeof(uint64_t); else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int); memcpy(recvbuf,sendbuf,n); @@ -344,6 +363,7 @@ int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, else if (datatype == MPI_DOUBLE) n = *recvcounts*sizeof(double); else if (datatype == MPI_CHAR) n = *recvcounts*sizeof(char); else if (datatype == MPI_BYTE) n = *recvcounts*sizeof(char); + else if (datatype == MPI_UNSIGNED_LONG) n = *recvcounts*sizeof(uint64_t); else if (datatype == MPI_DOUBLE_INT) n = *recvcounts*sizeof(double_int); memcpy(recvbuf,sendbuf,n); @@ -364,6 +384,7 @@ int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, else if (sendtype == MPI_DOUBLE) n = sendcount*sizeof(double); else if (sendtype == MPI_CHAR) n = sendcount*sizeof(char); else if (sendtype == MPI_BYTE) n = sendcount*sizeof(char); + else if (sendtype == MPI_UNSIGNED_LONG) n = sendcount*sizeof(uint64_t); else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int); memcpy(recvbuf,sendbuf,n); @@ -384,6 +405,7 @@ int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, else if (sendtype == MPI_DOUBLE) n = sendcount*sizeof(double); else if (sendtype == MPI_CHAR) n = sendcount*sizeof(char); else if (sendtype == MPI_BYTE) n = sendcount*sizeof(char); + else if (sendtype == MPI_UNSIGNED_LONG) n = sendcount*sizeof(uint64_t); else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int); memcpy(recvbuf,sendbuf,n); diff --git a/src/STUBS/mpi.h b/src/STUBS/mpi.h index 169c482416..d9874d79ec 100644 --- a/src/STUBS/mpi.h +++ b/src/STUBS/mpi.h @@ -25,7 +25,8 @@ #define MPI_DOUBLE 3 #define MPI_CHAR 4 #define MPI_BYTE 5 -#define MPI_DOUBLE_INT 6 +#define MPI_UNSIGNED_LONG 6 +#define MPI_DOUBLE_INT 7 #define MPI_SUM 1 #define MPI_MAX 2 @@ -57,6 +58,8 @@ int MPI_Abort(MPI_Comm comm, int errorcode); int MPI_Finalize(); double MPI_Wtime(); +int MPI_Type_size(int, int *); + int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm); int MPI_Rsend(void *buf, int count, MPI_Datatype datatype, diff --git a/src/min.cpp b/src/min.cpp index 2619cb979c..bbac6428e6 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -199,10 +199,10 @@ void Min::setup() // ndoftotal = total dof for entire minimization problem // dof for atoms, extra per-atom, extra global - double ndofme = 3.0*atom->nlocal; + bigint ndofme = 3*atom->nlocal; for (int m = 0; m < nextra_atom; m++) ndofme += extra_peratom[m]*atom->nlocal; - MPI_Allreduce(&ndofme,&ndoftotal,1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&ndofme,&ndoftotal,1,MPI_UNSIGNED_LONG,MPI_SUM,world); ndoftotal += nextra_global; // setup domain, communication and neighboring diff --git a/src/min.h b/src/min.h index 5b94bdeb5a..f4626514e8 100644 --- a/src/min.h +++ b/src/min.h @@ -15,6 +15,7 @@ #define LMP_MIN_H #include "pointers.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -70,7 +71,7 @@ class Min : protected Pointers { class Compute *pe_compute; // compute for potential energy double ecurrent; // current potential energy - double ndoftotal; // total dof for entire problem + bigint ndoftotal; // total dof for entire problem int nvec; // local atomic dof = length of xvec double *xvec; // variables for atomic dof, as 1d vector diff --git a/src/replicate.cpp b/src/replicate.cpp index 5033b21551..9798b0a09b 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -13,7 +13,6 @@ #include "stdlib.h" #include "string.h" -#include "stdint.h" #include "replicate.h" #include "lmptype.h" #include "atom.h"