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

This commit is contained in:
sjplimp
2011-01-05 00:29:35 +00:00
parent c69f3aea57
commit 55e8b2bee6
18 changed files with 53 additions and 54 deletions

View File

@ -98,7 +98,7 @@ int MPI_Type_size(MPI_Datatype datatype, int *size)
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_UNSIGNED_LONG_LONG) *size = sizeof(uint64_t);
else if (datatype == MPI_DOUBLE_INT) *size = sizeof(double_int);
}
@ -261,7 +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_UNSIGNED_LONG_LONG) n = count*sizeof(uint64_t);
else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int);
memcpy(recvbuf,sendbuf,n);
@ -282,7 +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_UNSIGNED_LONG_LONG) n = count*sizeof(uint64_t);
else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int);
memcpy(recvbuf,sendbuf,n);
@ -301,7 +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_UNSIGNED_LONG_LONG) n = count*sizeof(uint64_t);
else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int);
memcpy(recvbuf,sendbuf,n);
@ -322,7 +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_UNSIGNED_LONG_LONG) n = sendcount*sizeof(uint64_t);
else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int);
memcpy(recvbuf,sendbuf,n);
@ -343,7 +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_UNSIGNED_LONG_LONG) n = sendcount*sizeof(uint64_t);
else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int);
memcpy(recvbuf,sendbuf,n);
@ -363,7 +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_UNSIGNED_LONG_LONG) n = *recvcounts*sizeof(uint64_t);
else if (datatype == MPI_DOUBLE_INT) n = *recvcounts*sizeof(double_int);
memcpy(recvbuf,sendbuf,n);
@ -384,7 +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_UNSIGNED_LONG_LONG) n = sendcount*sizeof(uint64_t);
else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int);
memcpy(recvbuf,sendbuf,n);
@ -405,7 +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_UNSIGNED_LONG_LONG) n = sendcount*sizeof(uint64_t);
else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int);
memcpy(recvbuf,sendbuf,n);

View File

@ -25,7 +25,7 @@
#define MPI_DOUBLE 3
#define MPI_CHAR 4
#define MPI_BYTE 5
#define MPI_UNSIGNED_LONG 6
#define MPI_UNSIGNED_LONG_LONG 6
#define MPI_DOUBLE_INT 7
#define MPI_SUM 1

View File

@ -604,7 +604,7 @@ bigint ComputeReduce::count(int m)
} else if (flavor[m] == LOCAL) {
bigint ncount = compute->size_local_rows;
bigint ncountall;
MPI_Allreduce(&ncount,&ncountall,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&ncount,&ncountall,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
return ncountall;
}
} else if (which[m] == FIX) {
@ -614,7 +614,7 @@ bigint ComputeReduce::count(int m)
} else if (flavor[m] == LOCAL) {
bigint ncount = fix->size_local_rows;
bigint ncountall;
MPI_Allreduce(&ncount,&ncountall,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&ncount,&ncountall,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
return ncountall;
}
} else if (which[m] == VARIABLE)

View File

@ -169,7 +169,7 @@ void CreateAtoms::command(int narg, char **arg)
// new total # of atoms
bigint nblocal = atom->nlocal;
MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
// print status

View File

@ -93,7 +93,7 @@ void DeleteAtoms::command(int narg, char **arg)
// set nghost to 0 so old ghosts of deleted atoms won't be mapped
bigint nblocal = atom->nlocal;
MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
if (atom->map_style) {
atom->nghost = 0;
atom->map_init();

View File

@ -341,14 +341,14 @@ void DeleteBonds::command(int narg, char **arg)
if (atom->avec->bonds_allow) {
bigint nbonds = 0;
for (i = 0; i < nlocal; i++) nbonds += atom->num_bond[i];
MPI_Allreduce(&nbonds,&atom->nbonds,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&nbonds,&atom->nbonds,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
if (force->newton_bond == 0) atom->nbonds /= 2;
}
if (atom->avec->angles_allow) {
bigint nangles = 0;
for (i = 0; i < nlocal; i++) nangles += atom->num_angle[i];
MPI_Allreduce(&nangles,&atom->nangles,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&nangles,&atom->nangles,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
if (force->newton_bond == 0) atom->nangles /= 3;
}
@ -356,7 +356,7 @@ void DeleteBonds::command(int narg, char **arg)
bigint ndihedrals = 0;
for (i = 0; i < nlocal; i++) ndihedrals += atom->num_dihedral[i];
MPI_Allreduce(&ndihedrals,&atom->ndihedrals,
1,MPI_UNSIGNED_LONG,MPI_SUM,world);
1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
if (force->newton_bond == 0) atom->ndihedrals /= 4;
}
@ -364,7 +364,7 @@ void DeleteBonds::command(int narg, char **arg)
bigint nimpropers = 0;
for (i = 0; i < nlocal; i++) nimpropers += atom->num_improper[i];
MPI_Allreduce(&nimpropers,&atom->nimpropers,
1,MPI_UNSIGNED_LONG,MPI_SUM,world);
1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
if (force->newton_bond == 0) atom->nimpropers /= 4;
}
@ -384,9 +384,9 @@ void DeleteBonds::command(int narg, char **arg)
for (m = 0; m < atom->num_bond[i]; m++)
if (atom->bond_type[i][m] > 0) bond_on++;
else bond_off++;
MPI_Allreduce(&bond_on,&tmp,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&bond_on,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
bond_on = tmp;
MPI_Allreduce(&bond_off,&tmp,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&bond_off,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
bond_off = tmp;
if (force->newton_bond == 0) {
bond_on /= 2;
@ -400,9 +400,9 @@ void DeleteBonds::command(int narg, char **arg)
for (m = 0; m < atom->num_angle[i]; m++)
if (atom->angle_type[i][m] > 0) angle_on++;
else angle_off++;
MPI_Allreduce(&angle_on,&tmp,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&angle_on,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
angle_on = tmp;
MPI_Allreduce(&angle_off,&tmp,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&angle_off,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
angle_off = tmp;
if (force->newton_bond == 0) {
angle_on /= 3;
@ -416,9 +416,9 @@ void DeleteBonds::command(int narg, char **arg)
for (m = 0; m < atom->num_dihedral[i]; m++)
if (atom->dihedral_type[i][m] > 0) dihedral_on++;
else dihedral_off++;
MPI_Allreduce(&dihedral_on,&tmp,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&dihedral_on,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
dihedral_on = tmp;
MPI_Allreduce(&dihedral_off,&tmp,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&dihedral_off,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
dihedral_off = tmp;
if (force->newton_bond == 0) {
dihedral_on /= 4;
@ -432,9 +432,9 @@ void DeleteBonds::command(int narg, char **arg)
for (m = 0; m < atom->num_improper[i]; m++)
if (atom->improper_type[i][m] > 0) improper_on++;
else improper_off++;
MPI_Allreduce(&improper_on,&tmp,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&improper_on,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
improper_on = tmp;
MPI_Allreduce(&improper_off,&tmp,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&improper_off,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
improper_off = tmp;
if (force->newton_bond == 0) {
improper_on /= 4;

View File

@ -213,7 +213,7 @@ void DisplaceAtoms::command(int narg, char **arg)
bigint natoms;
bigint nblocal = atom->nlocal;
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
if (natoms != atom->natoms) {
char str[128];
sprintf(str,"Lost atoms via displace_atoms: original %lu current %lu",

View File

@ -379,7 +379,7 @@ void DisplaceBox::command(int narg, char **arg)
bigint natoms;
bigint nblocal = atom->nlocal;
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
if (natoms != atom->natoms) {
char str[128];
sprintf(str,"Lost atoms via displace_box: original %lu current %lu",

View File

@ -87,7 +87,7 @@ void Finish::end(int flag)
// use actual natoms, in case atoms were lost
bigint nblocal = atom->nlocal;
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
if (me == 0) {
if (screen)

View File

@ -497,7 +497,7 @@ bigint Group::count(int igroup)
bigint nsingle = n;
bigint nall;
MPI_Allreduce(&nsingle,&nall,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&nsingle,&nall,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
return nall;
}
@ -520,7 +520,7 @@ bigint Group::count(int igroup, int iregion)
bigint nsingle = n;
bigint nall;
MPI_Allreduce(&nsingle,&nall,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&nsingle,&nall,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
return nall;
}

View File

@ -241,6 +241,16 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
}
}
// check datatype sizes
if (sizeof(bigint) != 8)
error->all("No support for 8-byte unsigned integers");
int mpisize;
MPI_Type_size(MPI_UNSIGNED_LONG_LONG,&mpisize);
if (mpisize != 8)
error->all("MPI_UNSIGNED_LONG_LONG is not 8-byte data type");
// allocate input class now that MPI is fully setup
input = new Input(this,narg,arg);

View File

@ -23,18 +23,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
Memory::Memory(LAMMPS *lmp) : Pointers(lmp)
{
// check datatype sizes
if (sizeof(bigint) != 8)
error->all("No support for 8-byte unsigned integers");
int mpisize;
MPI_Type_size(MPI_UNSIGNED_LONG,&mpisize);
if (mpisize != 8)
error->all("MPI_UNSIGNED_LONG is not 8-byte data type");
}
Memory::Memory(LAMMPS *lmp) : Pointers(lmp) {}
/* ----------------------------------------------------------------------
safe malloc

View File

@ -202,7 +202,7 @@ void Min::setup()
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_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&ndofme,&ndoftotal,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
ndoftotal += nextra_global;
// setup domain, communication and neighboring

View File

@ -435,7 +435,7 @@ void ReadData::atoms()
// check that all atoms were assigned correctly
bigint tmp = atom->nlocal;
MPI_Allreduce(&tmp,&natoms,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&tmp,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
if (me == 0) {
if (screen) fprintf(screen," %lu atoms\n",natoms);
@ -568,7 +568,7 @@ void ReadData::bonds()
bigint sum;
bigint n = 0;
for (i = 0; i < nlocal; i++) n += atom->num_bond[i];
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
int factor = 1;
if (!force->newton_bond) factor = 2;
@ -613,7 +613,7 @@ void ReadData::angles()
bigint sum;
bigint n = 0;
for (i = 0; i < nlocal; i++) n += atom->num_angle[i];
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
int factor = 1;
if (!force->newton_bond) factor = 3;
@ -658,7 +658,7 @@ void ReadData::dihedrals()
bigint sum;
bigint n = 0;
for (i = 0; i < nlocal; i++) n += atom->num_dihedral[i];
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
int factor = 1;
if (!force->newton_bond) factor = 4;
@ -704,7 +704,7 @@ void ReadData::impropers()
bigint sum;
bigint n = 0;
for (i = 0; i < nlocal; i++) n += atom->num_improper[i];
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
int factor = 1;
if (!force->newton_bond) factor = 4;

View File

@ -293,7 +293,7 @@ void ReadRestart::command(int narg, char **arg)
bigint natoms;
bigint nblocal = atom->nlocal;
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
if (me == 0) {
if (screen) fprintf(screen," %lu atoms\n",natoms);
@ -819,6 +819,6 @@ bigint ReadRestart::read_bigint()
{
bigint value;
if (me == 0) fread(&value,sizeof(bigint),1,fp);
MPI_Bcast(&value,1,MPI_UNSIGNED_LONG,0,world);
MPI_Bcast(&value,1,MPI_UNSIGNED_LONG_LONG,0,world);
return value;
}

View File

@ -365,7 +365,7 @@ void Replicate::command(int narg, char **arg)
bigint natoms;
bigint nblocal = atom->nlocal;
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
if (me == 0) {
if (screen) fprintf(screen," %lu atoms\n",natoms);

View File

@ -353,7 +353,7 @@ bigint Thermo::lost_check()
bigint ntotal;
bigint nblocal = atom->nlocal;
MPI_Allreduce(&nblocal,&ntotal,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&nblocal,&ntotal,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
if (ntotal == atom->natoms) return ntotal;
// if not checking or already warned, just return

View File

@ -122,7 +122,7 @@ void WriteRestart::write(char *file)
// if unequal and thermo lostflag is "error", don't write restart file
bigint nblocal = atom->nlocal;
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
if (natoms != atom->natoms && output->thermo->lostflag == ERROR)
error->all("Atom count is inconsistent, cannot write restart file");