From 4c297a50a7e906706a4c769bfd7d9adfc888ac01 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 11 Feb 2014 16:29:28 +0000 Subject: [PATCH 01/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11523 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/read_data.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/read_data.cpp b/src/read_data.cpp index 4c4a6ad995..44def025df 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -173,6 +173,15 @@ void ReadData::command(int narg, char **arg) domain->box_exist = 1; update->ntimestep = 0; + // insure extra settings are applied before grow(), + // even if no topology in file + // if topology is in file, realloc and another grow() is done below + + atom->bond_per_atom = atom->extra_bond_per_atom; + atom->angle_per_atom = atom->extra_angle_per_atom; + atom->dihedral_per_atom = atom->extra_dihedral_per_atom; + atom->improper_per_atom = atom->extra_improper_per_atom; + int n; if (comm->nprocs == 1) n = static_cast (atom->natoms); else n = static_cast (LB_FACTOR * atom->natoms / comm->nprocs); @@ -437,7 +446,7 @@ void ReadData::command(int narg, char **arg) memory->destroy(atom->bond_atom); atom->bond_type = NULL; atom->bond_atom = NULL; - } else atom->bond_per_atom = atom->extra_bond_per_atom; + } if (angleflag) { memory->destroy(atom->angle_type); @@ -446,7 +455,7 @@ void ReadData::command(int narg, char **arg) memory->destroy(atom->angle_atom3); atom->angle_type = NULL; atom->angle_atom1 = atom->angle_atom2 = atom->angle_atom3 = NULL; - } else atom->angle_per_atom = atom->extra_angle_per_atom; + } if (dihedralflag) { memory->destroy(atom->dihedral_type); @@ -457,7 +466,7 @@ void ReadData::command(int narg, char **arg) atom->dihedral_type = NULL; atom->dihedral_atom1 = atom->dihedral_atom2 = atom->dihedral_atom3 = atom->dihedral_atom4 = NULL; - } else atom->dihedral_per_atom = atom->extra_dihedral_per_atom; + } if (improperflag) { memory->destroy(atom->improper_type); @@ -468,7 +477,7 @@ void ReadData::command(int narg, char **arg) atom->improper_type = NULL; atom->improper_atom1 = atom->improper_atom2 = atom->improper_atom3 = atom->improper_atom4 = NULL; - } else atom->improper_per_atom = atom->extra_improper_per_atom; + } atom->avec->grow(atom->nmax); } From 9ddbac1dd8e5909ae8d5f4c8ad9c1ab40e5b3553 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 00:32:51 +0000 Subject: [PATCH 02/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11526 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/atom_masks.h | 62 +++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/src/atom_masks.h b/src/atom_masks.h index 21c5e0bb97..82e460c301 100644 --- a/src/atom_masks.h +++ b/src/atom_masks.h @@ -18,7 +18,7 @@ #define EMPTY_MASK 0x00000000 #define ALL_MASK 0xffffffff -#define SAMETAG_MASK 0x01000000 +#define SAMETAG_MASK 0x40000000 #define EXTENDED_MASK 0x80000000 // standard @@ -39,49 +39,51 @@ #define IMPROPER_MASK 0x00002000 #define SPECIAL_MASK 0x00004000 #define MAP_MASK 0x00008000 +#define ENERGY_MASK 0x00010000 +#define VIRIAL_MASK 0x00020000 // granular -#define RADIUS_MASK 0x00010000 -#define DENSITY_MASK 0x00020000 -#define OMEGA_MASK 0x00040000 -#define TORQUE_MASK 0x00080000 -#define ANGMOM_MASK 0x00100000 -#define GRANULAR_MASK 0x001f0000 +#define RADIUS_MASK 0x00100000 +#define DENSITY_MASK 0x00200000 +#define OMEGA_MASK 0x00400000 +#define TORQUE_MASK 0x00800000 +#define ANGMOM_MASK 0x01000000 +#define GRANULAR_MASK 0x01f00000 // peridynamics -#define VFRAC_MASK 0x00200000 -#define S0_MASK 0x00400000 -#define X0_MASK 0x00800000 -#define PERI_MASK 0x00e00000 +#define VFRAC_MASK 0x00000001 +#define S0_MASK 0x00000002 +#define X0_MASK 0x00000004 +#define PERI_MASK 0x00000007 -#define ELLIPSOID_MASK 0x00000001 -#define LINE_MASK 0x00000002 -#define TRI_MASK 0x00000004 +#define ELLIPSOID_MASK 0x00000008 +#define LINE_MASK 0x00000010 +#define TRI_MASK 0x00000020 // electron -#define SPIN_MASK 0x00000010 -#define ERADIUS_MASK 0x00000020 -#define ERVEL_MASK 0x00000040 -#define ERFORCE_MASK 0x00000080 -#define ERVELFORCE_MASK 0x00000100 +#define SPIN_MASK 0x00000100 +#define ERADIUS_MASK 0x00000200 +#define ERVEL_MASK 0x00000400 +#define ERFORCE_MASK 0x00000800 +#define ERVELFORCE_MASK 0x00001000 -#define CS_MASK 0x00000200 -#define CSFORCE_MASK 0x00000400 -#define VFORCE_MASK 0x00000800 +#define CS_MASK 0x00002000 +#define CSFORCE_MASK 0x00004000 +#define VFORCE_MASK 0x00008000 -#define ELECTRON_MASK 0x00000f00 +#define ELECTRON_MASK 0x0000ff00 // SPH -#define ETAG_MASK 0x00001000 -#define RHO_MASK 0x00002000 -#define DRHO_MASK 0x00004000 -#define E_MASK 0x00008000 -#define DE_MASK 0x00010000 -#define VEST_MASK 0x00020000 -#define CV_MASK 0x00040000 +#define ETAG_MASK 0x00010000 +#define RHO_MASK 0x00020000 +#define DRHO_MASK 0x00040000 +#define E_MASK 0x00080000 +#define DE_MASK 0x00100000 +#define VEST_MASK 0x00200000 +#define CV_MASK 0x00400000 #endif From 001514ada269ac7d877eef170658400e015d6fe4 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 00:32:58 +0000 Subject: [PATCH 03/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11527 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/accelerator_kokkos.h | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/accelerator_kokkos.h b/src/accelerator_kokkos.h index 5d7124e15a..2b2ba1a957 100644 --- a/src/accelerator_kokkos.h +++ b/src/accelerator_kokkos.h @@ -20,16 +20,15 @@ #ifdef LMP_KOKKOS #include "kokkos.h" +#include "atom_kokkos.h" +#include "comm_kokkos.h" +#include "modify_kokkos.h" #else // dummy interface to KOKKOS // needed for compiling when KOKKOS is not installed -//#include "comm.h" -//#include "modify.h" -//#include "verlet.h" - namespace LAMMPS_NS { class KokkosLMP { @@ -41,18 +40,18 @@ class KokkosLMP { void accelerator(int, char **) {} }; +class AtomKokkos : public Atom { + public: + AtomKokkos(class LAMMPS *lmp) : Atom(lmp) {} + ~AtomKokkos() {} +}; + class CommKokkos : public Comm { public: CommKokkos(class LAMMPS *lmp) : Comm(lmp) {} ~CommKokkos() {} }; -class DomainKokkos : public Domain { - public: - DomainKokkos(class LAMMPS *lmp) : Domain(lmp) {} - ~DomainKokkos() {} -}; - class NeighborKokkos : public Neighbor { public: NeighborKokkos(class LAMMPS *lmp) : Neighbor(lmp) {} @@ -65,12 +64,6 @@ class ModifyKokkos : public Modify { ~ModifyKokkos() {} }; -class VerletKokkos : public Verlet { - public: - VerletKokkos(class LAMMPS *lmp, int narg, char **arg) : Verlet(lmp,narg,arg) {} - ~VerletKokkos() {} -}; - } #endif From 17a0a5eeb6191ef933e3754dc4bd7f3f52bc378a Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 00:33:05 +0000 Subject: [PATCH 04/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11528 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/atom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atom.h b/src/atom.h index fae87653cd..0056ecee55 100644 --- a/src/atom.h +++ b/src/atom.h @@ -237,7 +237,7 @@ class Atom : protected Pointers { void map_delete(); int map_find_hash(tagint); - private: + protected: // global to local ID mapping From 148140df27c0dc799b72b2367980e5ed360bfb27 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 00:33:16 +0000 Subject: [PATCH 05/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11529 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/atom_vec.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/atom_vec.h b/src/atom_vec.h index 30bfae919d..f08709503e 100644 --- a/src/atom_vec.h +++ b/src/atom_vec.h @@ -43,6 +43,7 @@ class AtomVec : protected Pointers { int nset; // # of molecules in list int cudable; // 1 if atom style is CUDA-enabled + int kokkosable; // 1 if atom style is KOKKOS-enabled int *maxsend; // CUDA-specific variable int nargcopy; // copy of command-line args for atom_style command From afe7343b378033aacf9bd019315381bbdd274da1 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 00:34:26 +0000 Subject: [PATCH 06/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11530 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/lmptype.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lmptype.h b/src/lmptype.h index 29301058b8..1390d32477 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -48,6 +48,10 @@ namespace LAMMPS_NS { +// enum used for KOKKOS host/device flag + +enum ExecutionSpace{Host,Device}; + // reserve 2 hi bits in molecular system neigh list for special bonds flag // max local + ghost atoms per processor = 2^30 - 1 From b28ce4b3bb9f4520125b6744039a70805e35d6ca Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 00:34:30 +0000 Subject: [PATCH 07/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11531 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/lammps.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lammps.cpp b/src/lammps.cpp index 2fa3f7e4f8..af59f405b6 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -418,6 +418,11 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) error->all(FLERR,"Small to big integers are not sized correctly"); #endif + // error check on accelerator packages + + if (cudaflag && kokkosflag) + error->all(FLERR,"Cannot use -cuda on and -kokkos on"); + // create Cuda class if USER-CUDA installed, unless explicitly switched off // instantiation creates dummy Cuda class if USER-CUDA is not installed @@ -544,6 +549,7 @@ void LAMMPS::create() // so that nthreads is defined when create_avec invokes grow() if (cuda) comm = new CommCuda(this); + else if (kokkos) comm = new CommKokkos(this); else comm = new Comm(this); if (cuda) neighbor = new NeighborCuda(this); @@ -556,13 +562,15 @@ void LAMMPS::create() else domain = new Domain(this); #endif - atom = new Atom(this); + if (kokkos) atom = new AtomKokkos(this); + else atom = new Atom(this); atom->create_avec("atomic",0,NULL,suffix); group = new Group(this); force = new Force(this); // must be after group, to create temperature if (cuda) modify = new ModifyCuda(this); + else if (kokkos) modify = new ModifyKokkos(this); else modify = new Modify(this); output = new Output(this); // must be after group, so "all" exists From 82833b729f2848aa3f40c0fd888dfeed1bab58e6 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 00:34:52 +0000 Subject: [PATCH 08/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11532 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/memory.h | 734 ++++++++++++++++++++++++++------------------------- 1 file changed, 373 insertions(+), 361 deletions(-) diff --git a/src/memory.h b/src/memory.h index c7ae9cd32a..48b7c8f3aa 100644 --- a/src/memory.h +++ b/src/memory.h @@ -16,6 +16,9 @@ #include "lmptype.h" #include "pointers.h" +#ifdef LMP_KOKKOS +#include "kokkos_type.h" +#endif namespace LAMMPS_NS { @@ -28,10 +31,17 @@ class Memory : protected Pointers { void sfree(void *); void fail(const char *); + // Kokkos memory allocation functions + +#ifdef LMP_KOKKOS +#include "memory_kokkos.h" +#endif + /* ---------------------------------------------------------------------- create/grow/destroy vecs and multidim arrays with contiguous memory blocks only use with primitive data types, e.g. 1d vec of ints, 2d array of doubles - cannot use with pointers, e.g. 1d vec of int*, due to mismatched destroy + fail() prevents use with pointers, + e.g. 1d vec of int*, due to mismatched destroy avoid use with non-primitive data types to avoid code bloat for these other cases, use smalloc/srealloc/sfree directly ------------------------------------------------------------------------- */ @@ -41,42 +51,42 @@ class Memory : protected Pointers { ------------------------------------------------------------------------- */ template - TYPE *create(TYPE *&array, int n, const char *name) - { - bigint nbytes = ((bigint) sizeof(TYPE)) * n; - array = (TYPE *) smalloc(nbytes,name); - return array; - } + TYPE *create(TYPE *&array, int n, const char *name) + { + bigint nbytes = ((bigint) sizeof(TYPE)) * n; + array = (TYPE *) smalloc(nbytes,name); + return array; + } template - TYPE **create(TYPE **&array, int n, const char *name) {fail(name);} + TYPE **create(TYPE **&array, int n, const char *name) + {fail(name); return NULL;} /* ---------------------------------------------------------------------- grow or shrink 1d array ------------------------------------------------------------------------- */ template - TYPE *grow(TYPE *&array, int n, const char *name) - { - if (array == NULL) return create(array,n,name); + TYPE *grow(TYPE *&array, int n, const char *name) + { + if (array == NULL) return create(array,n,name); - bigint nbytes = ((bigint) sizeof(TYPE)) * n; - array = (TYPE *) srealloc(array,nbytes,name); - return array; - } + bigint nbytes = ((bigint) sizeof(TYPE)) * n; + array = (TYPE *) srealloc(array,nbytes,name); + return array; + } template - TYPE **grow(TYPE **&array, int n, const char *name) {fail(name);} + TYPE **grow(TYPE **&array, int n, const char *name) + {fail(name); return NULL;} /* ---------------------------------------------------------------------- destroy a 1d array ------------------------------------------------------------------------- */ template - void destroy(TYPE *array) - { - sfree(array); - } + void destroy(TYPE *array) + {sfree(array);} /* ---------------------------------------------------------------------- create a 1d array with index from nlo to nhi inclusive @@ -84,51 +94,51 @@ class Memory : protected Pointers { ------------------------------------------------------------------------- */ template - TYPE *create1d_offset(TYPE *&array, int nlo, int nhi, const char *name) - { - bigint nbytes = ((bigint) sizeof(TYPE)) * (nhi-nlo+1); - array = (TYPE *) smalloc(nbytes,name); - array -= nlo; - return array; - } + TYPE *create1d_offset(TYPE *&array, int nlo, int nhi, const char *name) + { + bigint nbytes = ((bigint) sizeof(TYPE)) * (nhi-nlo+1); + array = (TYPE *) smalloc(nbytes,name); + array -= nlo; + return array; + } template - TYPE **create1d_offset(TYPE **&array, int nlo, int nhi, const char *name) - {fail(name);} + TYPE **create1d_offset(TYPE **&array, int nlo, int nhi, const char *name) + {fail(name); return NULL;} /* ---------------------------------------------------------------------- destroy a 1d array with index offset ------------------------------------------------------------------------- */ template - void destroy1d_offset(TYPE *array, int offset) - { - if (array) sfree(&array[offset]); - } + void destroy1d_offset(TYPE *array, int offset) + { + if (array) sfree(&array[offset]); + } /* ---------------------------------------------------------------------- create a 2d array ------------------------------------------------------------------------- */ template - TYPE **create(TYPE **&array, int n1, int n2, const char *name) - { - bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2; - TYPE *data = (TYPE *) smalloc(nbytes,name); - nbytes = ((bigint) sizeof(TYPE *)) * n1; - array = (TYPE **) smalloc(nbytes,name); - - bigint n = 0; - for (int i = 0; i < n1; i++) { - array[i] = &data[n]; - n += n2; - } - return array; + TYPE **create(TYPE **&array, int n1, int n2, const char *name) + { + bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2; + TYPE *data = (TYPE *) smalloc(nbytes,name); + nbytes = ((bigint) sizeof(TYPE *)) * n1; + array = (TYPE **) smalloc(nbytes,name); + + bigint n = 0; + for (int i = 0; i < n1; i++) { + array[i] = &data[n]; + n += n2; } + return array; + } template - TYPE ***create(TYPE ***&array, int n1, int n2, const char *name) - {fail(name);} + TYPE ***create(TYPE ***&array, int n1, int n2, const char *name) + {fail(name); return NULL;} /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 2d array @@ -136,128 +146,128 @@ class Memory : protected Pointers { ------------------------------------------------------------------------- */ template - TYPE **grow(TYPE **&array, int n1, int n2, const char *name) - { - if (array == NULL) return create(array,n1,n2,name); - - bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2; - TYPE *data = (TYPE *) srealloc(array[0],nbytes,name); - nbytes = ((bigint) sizeof(TYPE *)) * n1; - array = (TYPE **) srealloc(array,nbytes,name); - - bigint n = 0; - for (int i = 0; i < n1; i++) { - array[i] = &data[n]; - n += n2; - } - return array; + TYPE **grow(TYPE **&array, int n1, int n2, const char *name) + { + if (array == NULL) return create(array,n1,n2,name); + + bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2; + TYPE *data = (TYPE *) srealloc(array[0],nbytes,name); + nbytes = ((bigint) sizeof(TYPE *)) * n1; + array = (TYPE **) srealloc(array,nbytes,name); + + bigint n = 0; + for (int i = 0; i < n1; i++) { + array[i] = &data[n]; + n += n2; } - + return array; + } + template - TYPE ***grow(TYPE ***&array, int n1, int n2, const char *name) - {fail(name);} - + TYPE ***grow(TYPE ***&array, int n1, int n2, const char *name) + {fail(name); return NULL;} + /* ---------------------------------------------------------------------- destroy a 2d array ------------------------------------------------------------------------- */ template - void destroy(TYPE **array) - { - if (array == NULL) return; - sfree(array[0]); - sfree(array); - } + void destroy(TYPE **array) + { + if (array == NULL) return; + sfree(array[0]); + sfree(array); + } /* ---------------------------------------------------------------------- create a 2d array with a ragged 2nd dimension ------------------------------------------------------------------------- */ template - TYPE **create_ragged(TYPE **&array, int n1, int *n2, const char *name) - { - bigint n2sum = 0; - for (int i = 0; i < n1; i++) n2sum += n2[i]; - - bigint nbytes = ((bigint) sizeof(TYPE)) * n2sum; - TYPE *data = (TYPE *) smalloc(nbytes,name); - nbytes = ((bigint) sizeof(TYPE *)) * n1; - array = (TYPE **) smalloc(nbytes,name); - - bigint n = 0; - for (int i = 0; i < n1; i++) { - array[i] = &data[n]; - n += n2[i]; - } - return array; + TYPE **create_ragged(TYPE **&array, int n1, int *n2, const char *name) + { + bigint n2sum = 0; + for (int i = 0; i < n1; i++) n2sum += n2[i]; + + bigint nbytes = ((bigint) sizeof(TYPE)) * n2sum; + TYPE *data = (TYPE *) smalloc(nbytes,name); + nbytes = ((bigint) sizeof(TYPE *)) * n1; + array = (TYPE **) smalloc(nbytes,name); + + bigint n = 0; + for (int i = 0; i < n1; i++) { + array[i] = &data[n]; + n += n2[i]; } - + return array; + } + template - TYPE ***create_ragged(TYPE ***&array, int n1, int *n2, const char *name) - {fail(name);} - + TYPE ***create_ragged(TYPE ***&array, int n1, int *n2, const char *name) + {fail(name); return NULL;} + /* ---------------------------------------------------------------------- create a 2d array with 2nd index from n2lo to n2hi inclusive cannot grow it ------------------------------------------------------------------------- */ template - TYPE **create2d_offset(TYPE **&array, int n1, int n2lo, int n2hi, - const char *name) - { - int n2 = n2hi - n2lo + 1; - create(array,n1,n2,name); - for (int i = 0; i < n1; i++) array[i] -= n2lo; - return array; - } - + TYPE **create2d_offset(TYPE **&array, int n1, int n2lo, int n2hi, + const char *name) + { + int n2 = n2hi - n2lo + 1; + create(array,n1,n2,name); + for (int i = 0; i < n1; i++) array[i] -= n2lo; + return array; + } + template - TYPE ***create2d_offset(TYPE ***&array, int n1, int n2lo, int n2hi, - const char *name) {fail(name);} - + TYPE ***create2d_offset(TYPE ***&array, int n1, int n2lo, int n2hi, + const char *name) {fail(name); return NULL;} + /* ---------------------------------------------------------------------- destroy a 2d array with 2nd index offset ------------------------------------------------------------------------- */ - + template - void destroy2d_offset(TYPE **array, int offset) - { - if (array == NULL) return; - sfree(&array[0][offset]); - sfree(array); - } - + void destroy2d_offset(TYPE **array, int offset) + { + if (array == NULL) return; + sfree(&array[0][offset]); + sfree(array); + } + /* ---------------------------------------------------------------------- create a 3d array ------------------------------------------------------------------------- */ template - TYPE ***create(TYPE ***&array, int n1, int n2, int n3, const char *name) - { - bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3; - TYPE *data = (TYPE *) smalloc(nbytes,name); - nbytes = ((bigint) sizeof(TYPE *)) * n1*n2; - TYPE **plane = (TYPE **) smalloc(nbytes,name); - nbytes = ((bigint) sizeof(TYPE **)) * n1; - array = (TYPE ***) smalloc(nbytes,name); - - int i,j; - bigint m; - bigint n = 0; - for (i = 0; i < n1; i++) { - m = ((bigint) i) * n2; - array[i] = &plane[m]; - for (j = 0; j < n2; j++) { - plane[m+j] = &data[n]; - n += n3; - } + TYPE ***create(TYPE ***&array, int n1, int n2, int n3, const char *name) + { + bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3; + TYPE *data = (TYPE *) smalloc(nbytes,name); + nbytes = ((bigint) sizeof(TYPE *)) * n1*n2; + TYPE **plane = (TYPE **) smalloc(nbytes,name); + nbytes = ((bigint) sizeof(TYPE **)) * n1; + array = (TYPE ***) smalloc(nbytes,name); + + int i,j; + bigint m; + bigint n = 0; + for (i = 0; i < n1; i++) { + m = ((bigint) i) * n2; + array[i] = &plane[m]; + for (j = 0; j < n2; j++) { + plane[m+j] = &data[n]; + n += n3; } - return array; } + return array; + } template - TYPE ****create(TYPE ****&array, int n1, int n2, int n3, const char *name) - {fail(name);} + TYPE ****create(TYPE ****&array, int n1, int n2, int n3, const char *name) + {fail(name); return NULL;} /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 3d array @@ -265,47 +275,47 @@ class Memory : protected Pointers { ------------------------------------------------------------------------- */ template - TYPE ***grow(TYPE ***&array, int n1, int n2, int n3, const char *name) - { - if (array == NULL) return create(array,n1,n2,n3,name); - - bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3; - TYPE *data = (TYPE *) srealloc(array[0][0],nbytes,name); - nbytes = ((bigint) sizeof(TYPE *)) * n1*n2; - TYPE **plane = (TYPE **) srealloc(array[0],nbytes,name); - nbytes = ((bigint) sizeof(TYPE **)) * n1; - array = (TYPE ***) srealloc(array,nbytes,name); - - int i,j; - bigint m; - bigint n = 0; - for (i = 0; i < n1; i++) { - m = ((bigint) i) * n2; - array[i] = &plane[m]; - for (j = 0; j < n2; j++) { - plane[m+j] = &data[n]; - n += n3; - } + TYPE ***grow(TYPE ***&array, int n1, int n2, int n3, const char *name) + { + if (array == NULL) return create(array,n1,n2,n3,name); + + bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3; + TYPE *data = (TYPE *) srealloc(array[0][0],nbytes,name); + nbytes = ((bigint) sizeof(TYPE *)) * n1*n2; + TYPE **plane = (TYPE **) srealloc(array[0],nbytes,name); + nbytes = ((bigint) sizeof(TYPE **)) * n1; + array = (TYPE ***) srealloc(array,nbytes,name); + + int i,j; + bigint m; + bigint n = 0; + for (i = 0; i < n1; i++) { + m = ((bigint) i) * n2; + array[i] = &plane[m]; + for (j = 0; j < n2; j++) { + plane[m+j] = &data[n]; + n += n3; } - return array; } - + return array; + } + template - TYPE ****grow(TYPE ****&array, int n1, int n2, int n3, const char *name) - {fail(name);} + TYPE ****grow(TYPE ****&array, int n1, int n2, int n3, const char *name) + {fail(name); return NULL;} /* ---------------------------------------------------------------------- destroy a 3d array ------------------------------------------------------------------------- */ template - void destroy(TYPE ***array) - { - if (array == NULL) return; - sfree(array[0][0]); - sfree(array[0]); - sfree(array); - } + void destroy(TYPE ***array) + { + if (array == NULL) return; + sfree(array[0][0]); + sfree(array[0]); + sfree(array); + } /* ---------------------------------------------------------------------- create a 3d array with 1st index from n1lo to n1hi inclusive @@ -313,29 +323,29 @@ class Memory : protected Pointers { ------------------------------------------------------------------------- */ template - TYPE ***create3d_offset(TYPE ***&array, int n1lo, int n1hi, - int n2, int n3, const char *name) - { - int n1 = n1hi - n1lo + 1; - create(array,n1,n2,n3,name); - array -= n1lo; - return array; - } - + TYPE ***create3d_offset(TYPE ***&array, int n1lo, int n1hi, + int n2, int n3, const char *name) + { + int n1 = n1hi - n1lo + 1; + create(array,n1,n2,n3,name); + array -= n1lo; + return array; + } + template - TYPE ****create3d_offset(TYPE ****&array, int n1lo, int n1hi, - int n2, int n3, const char *name) - {fail(name);} + TYPE ****create3d_offset(TYPE ****&array, int n1lo, int n1hi, + int n2, int n3, const char *name) + {fail(name); return NULL;} /* ---------------------------------------------------------------------- free a 3d array with 1st index offset ------------------------------------------------------------------------- */ template - void destroy3d_offset(TYPE ***array, int offset) - { - if (array) destroy(&array[offset]); - } + void destroy3d_offset(TYPE ***array, int offset) + { + if (array) destroy(&array[offset]); + } /* ---------------------------------------------------------------------- create a 3d array with @@ -346,97 +356,97 @@ class Memory : protected Pointers { ------------------------------------------------------------------------- */ template - TYPE ***create3d_offset(TYPE ***&array, int n1lo, int n1hi, - int n2lo, int n2hi, int n3lo, int n3hi, - const char *name) - { - int n1 = n1hi - n1lo + 1; - int n2 = n2hi - n2lo + 1; - int n3 = n3hi - n3lo + 1; - create(array,n1,n2,n3,name); - - bigint m = ((bigint) n1) * n2; - for (bigint i = 0; i < m; i++) array[0][i] -= n3lo; - for (int i = 0; i < n1; i++) array[i] -= n2lo; - array -= n1lo; - return array; - } - + TYPE ***create3d_offset(TYPE ***&array, int n1lo, int n1hi, + int n2lo, int n2hi, int n3lo, int n3hi, + const char *name) + { + int n1 = n1hi - n1lo + 1; + int n2 = n2hi - n2lo + 1; + int n3 = n3hi - n3lo + 1; + create(array,n1,n2,n3,name); + + bigint m = ((bigint) n1) * n2; + for (bigint i = 0; i < m; i++) array[0][i] -= n3lo; + for (int i = 0; i < n1; i++) array[i] -= n2lo; + array -= n1lo; + return array; + } + template - TYPE ****create3d_offset(TYPE ****&array, int n1lo, int n1hi, - int n2lo, int n2hi, int n3lo, int n3hi, - const char *name) - {fail(name);} + TYPE ****create3d_offset(TYPE ****&array, int n1lo, int n1hi, + int n2lo, int n2hi, int n3lo, int n3hi, + const char *name) + {fail(name); return NULL;} /* ---------------------------------------------------------------------- free a 3d array with all 3 indices offset ------------------------------------------------------------------------- */ template - void destroy3d_offset(TYPE ***array, - int n1_offset, int n2_offset, int n3_offset) - { - if (array == NULL) return; - sfree(&array[n1_offset][n2_offset][n3_offset]); - sfree(&array[n1_offset][n2_offset]); - sfree(&array[n1_offset]); - } - + void destroy3d_offset(TYPE ***array, + int n1_offset, int n2_offset, int n3_offset) + { + if (array == NULL) return; + sfree(&array[n1_offset][n2_offset][n3_offset]); + sfree(&array[n1_offset][n2_offset]); + sfree(&array[n1_offset]); + } + /* ---------------------------------------------------------------------- create a 4d array ------------------------------------------------------------------------- */ template - TYPE ****create(TYPE ****&array, int n1, int n2, int n3, int n4, - const char *name) - { - bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3*n4; - TYPE *data = (TYPE *) smalloc(nbytes,name); - nbytes = ((bigint) sizeof(TYPE *)) * n1*n2*n3; - TYPE **cube = (TYPE **) smalloc(nbytes,name); - nbytes = ((bigint) sizeof(TYPE **)) * n1*n2; - TYPE ***plane = (TYPE ***) smalloc(nbytes,name); - nbytes = ((bigint) sizeof(TYPE ***)) * n1; - array = (TYPE ****) smalloc(nbytes,name); - - int i,j,k; - bigint m1,m2,m3; - bigint n = 0; - for (i = 0; i < n1; i++) { - m2 = ((bigint) i) * n2; - array[i] = &plane[m2]; - for (j = 0; j < n2; j++) { - m1 = ((bigint) i) * n2 + j; - m2 = ((bigint) i) * n2*n3 + j*n3; - plane[m1] = &cube[m2]; - for (k = 0; k < n3; k++) { - m1 = ((bigint) i) * n2*n3 + j*n3 + k; - cube[m1] = &data[n]; - n += n4; - } + TYPE ****create(TYPE ****&array, int n1, int n2, int n3, int n4, + const char *name) + { + bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3*n4; + TYPE *data = (TYPE *) smalloc(nbytes,name); + nbytes = ((bigint) sizeof(TYPE *)) * n1*n2*n3; + TYPE **cube = (TYPE **) smalloc(nbytes,name); + nbytes = ((bigint) sizeof(TYPE **)) * n1*n2; + TYPE ***plane = (TYPE ***) smalloc(nbytes,name); + nbytes = ((bigint) sizeof(TYPE ***)) * n1; + array = (TYPE ****) smalloc(nbytes,name); + + int i,j,k; + bigint m1,m2,m3; + bigint n = 0; + for (i = 0; i < n1; i++) { + m2 = ((bigint) i) * n2; + array[i] = &plane[m2]; + for (j = 0; j < n2; j++) { + m1 = ((bigint) i) * n2 + j; + m2 = ((bigint) i) * n2*n3 + j*n3; + plane[m1] = &cube[m2]; + for (k = 0; k < n3; k++) { + m1 = ((bigint) i) * n2*n3 + j*n3 + k; + cube[m1] = &data[n]; + n += n4; } } - return array; } - + return array; + } + template - TYPE *****create(TYPE *****&array, int n1, int n2, int n3, int n4, - const char *name) - {fail(name);} + TYPE *****create(TYPE *****&array, int n1, int n2, int n3, int n4, + const char *name) + {fail(name); return NULL;} /* ---------------------------------------------------------------------- destroy a 4d array ------------------------------------------------------------------------- */ template - void destroy(TYPE ****array) - { - if (array == NULL) return; - sfree(array[0][0][0]); - sfree(array[0][0]); - sfree(array[0]); - sfree(array); - } + void destroy(TYPE ****array) + { + if (array == NULL) return; + sfree(array[0][0][0]); + sfree(array[0][0]); + sfree(array[0]); + sfree(array); + } /* ---------------------------------------------------------------------- create a 4d array with indices @@ -447,145 +457,147 @@ class Memory : protected Pointers { ------------------------------------------------------------------------- */ template - TYPE ****create4d_offset(TYPE ****&array, int n1, int n2lo, int n2hi, - int n3lo, int n3hi, int n4lo, int n4hi, - const char *name) - { - int n2 = n2hi - n2lo + 1; - int n3 = n3hi - n3lo + 1; - int n4 = n4hi - n4lo + 1; - create(array,n1,n2,n3,n4,name); - - bigint m = ((bigint) n1) * n2 * n3; - for (bigint i = 0; i < m; i++) array[0][0][i] -= n4lo; - m = ((bigint) n1) * n2; - for (bigint i = 0; i < m; i++) array [0][i] -= n3lo; - for (int i = 0; i < n1; i++) array[i] -= n2lo; - return array; - } - + TYPE ****create4d_offset(TYPE ****&array, int n1, int n2lo, int n2hi, + int n3lo, int n3hi, int n4lo, int n4hi, + const char *name) + { + int n2 = n2hi - n2lo + 1; + int n3 = n3hi - n3lo + 1; + int n4 = n4hi - n4lo + 1; + create(array,n1,n2,n3,n4,name); + + bigint m = ((bigint) n1) * n2 * n3; + for (bigint i = 0; i < m; i++) array[0][0][i] -= n4lo; + m = ((bigint) n1) * n2; + for (bigint i = 0; i < m; i++) array [0][i] -= n3lo; + for (int i = 0; i < n1; i++) array[i] -= n2lo; + return array; + } + template - TYPE ****create4d_offset(TYPE *****&array, int n1, int n2lo, int n2hi, - int n3lo, int n3hi, int n4lo, int n4hi, - const char *name) - {fail(name);} - + TYPE ****create4d_offset(TYPE *****&array, int n1, int n2lo, int n2hi, + int n3lo, int n3hi, int n4lo, int n4hi, + const char *name) + {fail(name); return NULL;} + /* ---------------------------------------------------------------------- free a 4d array with indices 2,3, and 4 offset ------------------------------------------------------------------------- */ + template - void destroy4d_offset(TYPE ****array, int n2_offset, int n3_offset, int n4_offset) - { - if (array == NULL) return; - sfree(&array[0][n2_offset][n3_offset][n4_offset]); - sfree(&array[0][n2_offset][n3_offset]); - sfree(&array[0][n2_offset]); - sfree(array); - } + void destroy4d_offset(TYPE ****array, + int n2_offset, int n3_offset, int n4_offset) + { + if (array == NULL) return; + sfree(&array[0][n2_offset][n3_offset][n4_offset]); + sfree(&array[0][n2_offset][n3_offset]); + sfree(&array[0][n2_offset]); + sfree(array); + } /* ---------------------------------------------------------------------- create a 5d array ------------------------------------------------------------------------- */ template - TYPE *****create(TYPE *****&array, int n1, int n2, int n3, int n4, - int n5, const char *name) - { - bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3*n4*n5; - TYPE *data = (TYPE *) smalloc(nbytes,name); - nbytes = ((bigint) sizeof(TYPE *)) * n1*n2*n3*n4; - TYPE **level4 = (TYPE **) smalloc(nbytes,name); - nbytes = ((bigint) sizeof(TYPE **)) * n1*n2*n3; - TYPE ***level3 = (TYPE ***) smalloc(nbytes,name); - nbytes = ((bigint) sizeof(TYPE ***)) * n1*n2; - TYPE ****level2 = (TYPE ****) smalloc(nbytes,name); - nbytes = ((bigint) sizeof(TYPE ****)) * n1; - array = (TYPE *****) smalloc(nbytes,name); - - int i,j,k,l; - bigint m1,m2,m3,m4,m5; - bigint n = 0; - for (i = 0; i < n1; i++) { - m2 = ((bigint) i) * n2; - array[i] = &level2[m2]; - for (j = 0; j < n2; j++) { - m1 = ((bigint) i) * n2 + j; - m2 = ((bigint) i) * n2*n3 + ((bigint) j) * n3; - level2[m1] = &level3[m2]; - for (k = 0; k < n3; k++) { - m1 = ((bigint) i) * n2*n3 + ((bigint) j) * n3 + k; - m2 = ((bigint) i) * n2*n3*n4 + - ((bigint) j) * n3*n4 + ((bigint) k) * n4; - level3[m1] = &level4[m2]; - for (l = 0; l < n4; l++) { - m1 = ((bigint) i) * n2*n3*n4 + - ((bigint) j) * n3*n4 + ((bigint) k) * n4 + l; - level4[m1] = &data[n]; - n += n5; - } + TYPE *****create(TYPE *****&array, int n1, int n2, int n3, int n4, + int n5, const char *name) + { + bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3*n4*n5; + TYPE *data = (TYPE *) smalloc(nbytes,name); + nbytes = ((bigint) sizeof(TYPE *)) * n1*n2*n3*n4; + TYPE **level4 = (TYPE **) smalloc(nbytes,name); + nbytes = ((bigint) sizeof(TYPE **)) * n1*n2*n3; + TYPE ***level3 = (TYPE ***) smalloc(nbytes,name); + nbytes = ((bigint) sizeof(TYPE ***)) * n1*n2; + TYPE ****level2 = (TYPE ****) smalloc(nbytes,name); + nbytes = ((bigint) sizeof(TYPE ****)) * n1; + array = (TYPE *****) smalloc(nbytes,name); + + int i,j,k,l; + bigint m1,m2,m3,m4,m5; + bigint n = 0; + for (i = 0; i < n1; i++) { + m2 = ((bigint) i) * n2; + array[i] = &level2[m2]; + for (j = 0; j < n2; j++) { + m1 = ((bigint) i) * n2 + j; + m2 = ((bigint) i) * n2*n3 + ((bigint) j) * n3; + level2[m1] = &level3[m2]; + for (k = 0; k < n3; k++) { + m1 = ((bigint) i) * n2*n3 + ((bigint) j) * n3 + k; + m2 = ((bigint) i) * n2*n3*n4 + + ((bigint) j) * n3*n4 + ((bigint) k) * n4; + level3[m1] = &level4[m2]; + for (l = 0; l < n4; l++) { + m1 = ((bigint) i) * n2*n3*n4 + + ((bigint) j) * n3*n4 + ((bigint) k) * n4 + l; + level4[m1] = &data[n]; + n += n5; } } } - return array; } - + return array; + } + template - TYPE ******create(TYPE ******&array, int n1, int n2, int n3, int n4, - int n5, const char *name) - {fail(name);} + TYPE ******create(TYPE ******&array, int n1, int n2, int n3, int n4, + int n5, const char *name) + {fail(name); return NULL;} /* ---------------------------------------------------------------------- destroy a 5d array ------------------------------------------------------------------------- */ template - void destroy(TYPE *****array) - { - if (array == NULL) return; - sfree(array[0][0][0][0]); - sfree(array[0][0][0]); - sfree(array[0][0]); - sfree(array[0]); - sfree(array); - } - + void destroy(TYPE *****array) + { + if (array == NULL) return; + sfree(array[0][0][0][0]); + sfree(array[0][0][0]); + sfree(array[0][0]); + sfree(array[0]); + sfree(array); + } + /* ---------------------------------------------------------------------- memory usage of arrays, including pointers ------------------------------------------------------------------------- */ template - bigint usage(TYPE *array, int n) - { - bigint bytes = ((bigint) sizeof(TYPE)) * n; - return bytes; - } - + bigint usage(TYPE *array, int n) + { + bigint bytes = ((bigint) sizeof(TYPE)) * n; + return bytes; + } + template - bigint usage(TYPE **array, int n1, int n2) - { - bigint bytes = ((bigint) sizeof(TYPE)) * n1*n2; - bytes += ((bigint) sizeof(TYPE *)) * n1; - return bytes; - } - + bigint usage(TYPE **array, int n1, int n2) + { + bigint bytes = ((bigint) sizeof(TYPE)) * n1*n2; + bytes += ((bigint) sizeof(TYPE *)) * n1; + return bytes; + } + template - bigint usage(TYPE ***array, int n1, int n2, int n3) - { - bigint bytes = ((bigint) sizeof(TYPE)) * n1*n2*n3; - bytes += ((bigint) sizeof(TYPE *)) * n1*n2; - bytes += ((bigint) sizeof(TYPE **)) * n1; - return bytes; - } - + bigint usage(TYPE ***array, int n1, int n2, int n3) + { + bigint bytes = ((bigint) sizeof(TYPE)) * n1*n2*n3; + bytes += ((bigint) sizeof(TYPE *)) * n1*n2; + bytes += ((bigint) sizeof(TYPE **)) * n1; + return bytes; + } + template - bigint usage(TYPE ****array, int n1, int n2, int n3, int n4) - { - bigint bytes = ((bigint) sizeof(TYPE)) * n1*n2*n3*n4; - bytes += ((bigint) sizeof(TYPE *)) * n1*n2*n3; - bytes += ((bigint) sizeof(TYPE **)) * n1*n2; - bytes += ((bigint) sizeof(TYPE ***)) * n1; - return bytes; - } + bigint usage(TYPE ****array, int n1, int n2, int n3, int n4) + { + bigint bytes = ((bigint) sizeof(TYPE)) * n1*n2*n3*n4; + bytes += ((bigint) sizeof(TYPE *)) * n1*n2*n3; + bytes += ((bigint) sizeof(TYPE **)) * n1*n2; + bytes += ((bigint) sizeof(TYPE ***)) * n1; + return bytes; + } }; } From 45224e6d89b4dda21faddeeea335b8bd0b017b51 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 00:35:10 +0000 Subject: [PATCH 09/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11533 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/modify.h | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/modify.h b/src/modify.h index 987026df2d..9761af5200 100644 --- a/src/modify.h +++ b/src/modify.h @@ -51,7 +51,6 @@ class Modify : protected Pointers { virtual void setup_pre_force(int); virtual void initial_integrate(int); virtual void post_integrate(); - void pre_decide(); virtual void pre_exchange(); virtual void pre_neighbor(); virtual void pre_force(int); @@ -61,27 +60,27 @@ class Modify : protected Pointers { virtual double thermo_energy(); virtual void post_run(); - void setup_pre_force_respa(int, int); - void initial_integrate_respa(int, int, int); - void post_integrate_respa(int, int); - void pre_force_respa(int, int, int); - void post_force_respa(int, int, int); - void final_integrate_respa(int, int); + virtual void setup_pre_force_respa(int, int); + virtual void initial_integrate_respa(int, int, int); + virtual void post_integrate_respa(int, int); + virtual void pre_force_respa(int, int, int); + virtual void post_force_respa(int, int, int); + virtual void final_integrate_respa(int, int); - void min_pre_exchange(); - void min_pre_neighbor(); - void min_pre_force(int); - void min_post_force(int); + virtual void min_pre_exchange(); + virtual void min_pre_neighbor(); + virtual void min_pre_force(int); + virtual void min_post_force(int); - double min_energy(double *); - void min_store(); - void min_step(double, double *); - void min_clearstore(); - void min_pushstore(); - void min_popstore(); - int min_reset_ref(); - double max_alpha(double *); - int min_dof(); + virtual double min_energy(double *); + virtual void min_store(); + virtual void min_step(double, double *); + virtual void min_clearstore(); + virtual void min_pushstore(); + virtual void min_popstore(); + virtual double max_alpha(double *); + virtual int min_dof(); + virtual int min_reset_ref(); void add_fix(int, char **, char *suffix = NULL); void modify_fix(int, char **); From 2da4b3a85fdcc3769394778a9e8b3dce3861faf1 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 00:35:28 +0000 Subject: [PATCH 10/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11534 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/verlet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/verlet.h b/src/verlet.h index 1f3bb1767b..970d9b1c1d 100644 --- a/src/verlet.h +++ b/src/verlet.h @@ -39,7 +39,7 @@ class Verlet : public Integrate { int torqueflag,erforceflag; int e_flag,rho_flag; - void force_clear(); + virtual void force_clear(); }; } From aa0f65b373e647d9d8103e47501897351a5374e0 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 00:35:44 +0000 Subject: [PATCH 11/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11535 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/atom_vec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index b381845e46..24e9e2d713 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -29,7 +29,7 @@ AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp) bonds_allow = angles_allow = dihedrals_allow = impropers_allow = 0; mass_type = dipole_type = 0; size_data_bonus = 0; - cudable = false; + cudable = kokkosable = 0; nargcopy = 0; argcopy = NULL; From cb23c438fc95f2bcbad33ec167a90c291157d5f9 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 00:35:59 +0000 Subject: [PATCH 12/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11536 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/fix.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/fix.h b/src/fix.h index 6f11272be6..bf2aa7e46a 100644 --- a/src/fix.h +++ b/src/fix.h @@ -83,6 +83,15 @@ class Fix : protected Pointers { double **vatom; // accumulated per-atom virial int restart_reset; // 1 if restart just re-initialized fix + + // KOKKOS host/device flag and per-fix data masks + + ExecutionSpace execution_space; + unsigned int datamask_read, datamask_read_ext; + unsigned int datamask_modify, datamask_modify_ext; + + // USER-CUDA per-fix data masks + unsigned int datamask; unsigned int datamask_ext; From 9c33209b2df10e0b0f58e01ae44ccdda4390fad5 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 00:36:16 +0000 Subject: [PATCH 13/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11537 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/fix.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/fix.cpp b/src/fix.cpp index fc9786d060..2a794fe8ae 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -70,13 +70,17 @@ Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) // however, each fix that uses these values should explicitly set them nevery = 1; - maxvatom = 0; vatom = NULL; + // CUDA and KOKKOS per-fix data masks + datamask = ALL_MASK; datamask_ext = ALL_MASK; + + datamask_read = datamask_read_ext = ALL_MASK; + datamask_modify = datamask_modify_ext = ALL_MASK; } /* ---------------------------------------------------------------------- */ From 4cb42cb26b4d31e5e25d79c161b5075488796948 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 00:59:21 +0000 Subject: [PATCH 14/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11538 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/lammps.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lammps.cpp b/src/lammps.cpp index af59f405b6..b69cd7bf3c 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -420,7 +420,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) // error check on accelerator packages - if (cudaflag && kokkosflag) + if (cudaflag == 1 && kokkosflag == 1) error->all(FLERR,"Cannot use -cuda on and -kokkos on"); // create Cuda class if USER-CUDA installed, unless explicitly switched off From 958a442bebbe7f9a053db3472dfa0476919ea7b7 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Feb 2014 01:07:55 +0000 Subject: [PATCH 15/15] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11539 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/BODY/body_nparticle.h | 8 ++++---- src/DIPOLE/atom_vec_dipole.h | 2 +- src/KSPACE/pppm_disp.cpp | 10 ++++++---- src/MISC/fix_efield.h | 1 - src/MISC/fix_orient_fcc.cpp | 2 +- src/PERI/atom_vec_peri.h | 2 +- src/USER-LB/fix_lb_fluid.cpp | 2 +- src/USER-OMP/dihedral_class2_omp.cpp | 4 +++- src/USER-OMP/dihedral_fourier_omp.cpp | 4 +++- src/USER-OMP/dihedral_helix_omp.cpp | 4 +++- src/USER-OMP/dihedral_nharmonic_omp.cpp | 4 +++- src/USER-OMP/dihedral_quadratic_omp.cpp | 4 +++- src/USER-OMP/improper_class2_omp.cpp | 5 +++-- src/USER-OMP/improper_cvff_omp.cpp | 5 ++++- src/USER-OMP/improper_harmonic_omp.cpp | 4 +++- src/USER-REAXC/fix_reaxc_bonds.cpp | 2 +- src/USER-REAXC/fix_reaxc_species.h | 1 - src/fix_nve_limit.h | 2 +- src/fix_property_atom.cpp | 8 ++++---- 19 files changed, 45 insertions(+), 29 deletions(-) diff --git a/src/BODY/body_nparticle.h b/src/BODY/body_nparticle.h index 22f15ee4fa..90897cb2f6 100644 --- a/src/BODY/body_nparticle.h +++ b/src/BODY/body_nparticle.h @@ -29,11 +29,11 @@ class BodyNparticle : public Body { public: BodyNparticle(class LAMMPS *, int, char **); ~BodyNparticle(); - int nsub(class AtomVecBody::Bonus *); - double *coords(class AtomVecBody::Bonus *); + int nsub(struct AtomVecBody::Bonus *); + double *coords(struct AtomVecBody::Bonus *); - int pack_border_body(class AtomVecBody::Bonus *, double *); - int unpack_border_body(class AtomVecBody::Bonus *, double *); + int pack_border_body(struct AtomVecBody::Bonus *, double *); + int unpack_border_body(struct AtomVecBody::Bonus *, double *); void data_body(int, int, int, char **, char **); int noutrow(int); diff --git a/src/DIPOLE/atom_vec_dipole.h b/src/DIPOLE/atom_vec_dipole.h index abe7db9899..a8126a8723 100644 --- a/src/DIPOLE/atom_vec_dipole.h +++ b/src/DIPOLE/atom_vec_dipole.h @@ -63,7 +63,7 @@ class AtomVecDipole : public AtomVec { int *type,*mask; imageint *image; double **x,**v,**f; - double *q,**mu,**omega,**torque; + double *q,**mu; }; } diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 250f26c3a1..6d8d604f5c 100755 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -263,7 +263,7 @@ void PPPMDisp::init() memset(function, 0, EWALD_FUNCS*sizeof(int)); for (int i=0; i<=EWALD_MAXORDER; ++i) // transcribe order if (ewald_order&(1< 1.0e-4) { char str[128]; - sprintf(str,"Error in splitting of dispersion coeffs is estimated %g%",err); + sprintf(str,"Error in splitting of dispersion coeffs is estimated %g",err); error->warning(FLERR, str); } // set B @@ -3986,7 +3986,8 @@ void PPPMDisp::compute_sf_coeff() sf_coeff[2] += sf_precoeff3[n]*greensfn[n]; sf_coeff[3] += sf_precoeff4[n]*greensfn[n]; sf_coeff[4] += sf_precoeff5[n]*greensfn[n]; - sf_coeff[5] += sf_precoeff6[n]*greensfn[n++]; + sf_coeff[5] += sf_precoeff6[n]*greensfn[n]; + ++n; } } } @@ -4042,7 +4043,8 @@ void PPPMDisp::compute_sf_coeff_6() sf_coeff_6[2] += sf_precoeff3_6[n]*greensfn_6[n]; sf_coeff_6[3] += sf_precoeff4_6[n]*greensfn_6[n]; sf_coeff_6[4] += sf_precoeff5_6[n]*greensfn_6[n]; - sf_coeff_6[5] += sf_precoeff6_6[n]*greensfn_6[n++]; + sf_coeff_6[5] += sf_precoeff6_6[n]*greensfn_6[n]; + ++n; } } } diff --git a/src/MISC/fix_efield.h b/src/MISC/fix_efield.h index 66f6074cf1..5bd1863019 100644 --- a/src/MISC/fix_efield.h +++ b/src/MISC/fix_efield.h @@ -47,7 +47,6 @@ class FixEfield : public Fix { int xvar,yvar,zvar,evar,xstyle,ystyle,zstyle,estyle; int nlevels_respa; double qe2f; - double fdotx; int qflag,muflag; int maxatom; diff --git a/src/MISC/fix_orient_fcc.cpp b/src/MISC/fix_orient_fcc.cpp index 722dc04854..bdf5cb4e05 100644 --- a/src/MISC/fix_orient_fcc.cpp +++ b/src/MISC/fix_orient_fcc.cpp @@ -495,7 +495,7 @@ int FixOrientFCC::pack_comm(int n, int *list, double *buf, buf[m++] = nbr[k].duxi; for (j = 0; j < num; j++) { - if (use_xismooth) buf[m++] = nbr[m].xismooth[j]; + if (use_xismooth) buf[m++] = nbr[k].xismooth[j]; buf[m++] = nbr[k].dxi[j][0]; buf[m++] = nbr[k].dxi[j][1]; buf[m++] = nbr[k].dxi[j][2]; diff --git a/src/PERI/atom_vec_peri.h b/src/PERI/atom_vec_peri.h index c3a1252d1a..d33d99d4fb 100755 --- a/src/PERI/atom_vec_peri.h +++ b/src/PERI/atom_vec_peri.h @@ -63,7 +63,7 @@ class AtomVecPeri : public AtomVec { int *type,*mask; imageint *image; double **x,**v,**f; - double *vfrac,*density,*rmass,*s0,**x0; + double *vfrac,*rmass,*s0,**x0; }; } diff --git a/src/USER-LB/fix_lb_fluid.cpp b/src/USER-LB/fix_lb_fluid.cpp index e587c502e4..e5680ccf1e 100755 --- a/src/USER-LB/fix_lb_fluid.cpp +++ b/src/USER-LB/fix_lb_fluid.cpp @@ -1290,7 +1290,7 @@ void FixLbFluid::write_restartfile(void) char *hfile; hfile = new char[32]; - sprintf(hfile,"FluidRestart_%d.dat",update->ntimestep); + sprintf(hfile,"FluidRestart_" BIGINT_FORMAT ".dat",update->ntimestep); MPI_File_open(world,hfile,MPI_MODE_WRONLY | MPI_MODE_CREATE, MPI_INFO_NULL,&fh); diff --git a/src/USER-OMP/dihedral_class2_omp.cpp b/src/USER-OMP/dihedral_class2_omp.cpp index bc559ac36b..701f8720cc 100644 --- a/src/USER-OMP/dihedral_class2_omp.cpp +++ b/src/USER-OMP/dihedral_class2_omp.cpp @@ -184,7 +184,9 @@ void DihedralClass2OMP::eval(int nfrom, int nto, ThrData * const thr) if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d/%d " BIGINT_FORMAT " %d %d %d %d", + sprintf(str,"Dihedral problem: %d/%d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT, me,thr->get_tid(),update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); diff --git a/src/USER-OMP/dihedral_fourier_omp.cpp b/src/USER-OMP/dihedral_fourier_omp.cpp index 04b9784942..ef43313856 100644 --- a/src/USER-OMP/dihedral_fourier_omp.cpp +++ b/src/USER-OMP/dihedral_fourier_omp.cpp @@ -156,7 +156,9 @@ void DihedralFourierOMP::eval(int nfrom, int nto, ThrData * const thr) if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d/%d " BIGINT_FORMAT " %d %d %d %d", + sprintf(str,"Dihedral problem: %d/%d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT, me,thr->get_tid(),update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); diff --git a/src/USER-OMP/dihedral_helix_omp.cpp b/src/USER-OMP/dihedral_helix_omp.cpp index 2252d577c6..fdffeecdce 100644 --- a/src/USER-OMP/dihedral_helix_omp.cpp +++ b/src/USER-OMP/dihedral_helix_omp.cpp @@ -190,7 +190,9 @@ void DihedralHelixOMP::eval(int nfrom, int nto, ThrData * const thr) if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d/%d " BIGINT_FORMAT " %d %d %d %d", + sprintf(str,"Dihedral problem: %d/%d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT, me,thr->get_tid(),update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); diff --git a/src/USER-OMP/dihedral_nharmonic_omp.cpp b/src/USER-OMP/dihedral_nharmonic_omp.cpp index b924673855..51a3f1b752 100644 --- a/src/USER-OMP/dihedral_nharmonic_omp.cpp +++ b/src/USER-OMP/dihedral_nharmonic_omp.cpp @@ -180,7 +180,9 @@ void DihedralNHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d/%d " BIGINT_FORMAT " %d %d %d %d", + sprintf(str,"Dihedral problem: %d/%d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT, me,thr->get_tid(),update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); diff --git a/src/USER-OMP/dihedral_quadratic_omp.cpp b/src/USER-OMP/dihedral_quadratic_omp.cpp index d50a891def..067b7bf4e2 100644 --- a/src/USER-OMP/dihedral_quadratic_omp.cpp +++ b/src/USER-OMP/dihedral_quadratic_omp.cpp @@ -187,7 +187,9 @@ void DihedralQuadraticOMP::eval(int nfrom, int nto, ThrData * const thr) if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d/%d " BIGINT_FORMAT " %d %d %d %d", + sprintf(str,"Dihedral problem: %d/%d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT, me,thr->get_tid(),update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); diff --git a/src/USER-OMP/improper_class2_omp.cpp b/src/USER-OMP/improper_class2_omp.cpp index 82f7f841f7..d9e90218c0 100644 --- a/src/USER-OMP/improper_class2_omp.cpp +++ b/src/USER-OMP/improper_class2_omp.cpp @@ -168,8 +168,9 @@ void ImproperClass2OMP::eval(int nfrom, int nto, ThrData * const thr) int me = comm->me; if (screen) { char str[128]; - sprintf(str, - "Improper problem: %d/%d " BIGINT_FORMAT " %d %d %d %d", + sprintf(str,"Improper problem: %d/%d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT, me, thr->get_tid(),update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); diff --git a/src/USER-OMP/improper_cvff_omp.cpp b/src/USER-OMP/improper_cvff_omp.cpp index 25d349c079..a082a0d7bc 100644 --- a/src/USER-OMP/improper_cvff_omp.cpp +++ b/src/USER-OMP/improper_cvff_omp.cpp @@ -177,9 +177,12 @@ void ImproperCvffOMP::eval(int nfrom, int nto, ThrData * const thr) if (screen) { char str[128]; - sprintf(str,"Improper problem: %d/%d " BIGINT_FORMAT " %d %d %d %d", + sprintf(str,"Improper problem: %d/%d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT, me,thr->get_tid(),update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); + error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", me,x[i1].x,x[i1].y,x[i1].z); diff --git a/src/USER-OMP/improper_harmonic_omp.cpp b/src/USER-OMP/improper_harmonic_omp.cpp index 047de25c07..3104322ca8 100644 --- a/src/USER-OMP/improper_harmonic_omp.cpp +++ b/src/USER-OMP/improper_harmonic_omp.cpp @@ -150,7 +150,9 @@ void ImproperHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) if (screen) { char str[128]; - sprintf(str,"Improper problem: %d/%d " BIGINT_FORMAT " %d %d %d %d", + sprintf(str,"Improper problem: %d/%d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT, me,thr->get_tid(),update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index 8d8818a49b..4d67378153 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -294,7 +294,7 @@ void FixReaxCBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, for (k = 5; k < 5+numbonds; k++) { jtag = static_cast (buf[j+k]); - fprintf(fp," %d",jtag); + fprintf(fp," " TAGINT_FORMAT,jtag); } j += (5+numbonds); diff --git a/src/USER-REAXC/fix_reaxc_species.h b/src/USER-REAXC/fix_reaxc_species.h index 12c0aa98c5..6690f4be83 100644 --- a/src/USER-REAXC/fix_reaxc_species.h +++ b/src/USER-REAXC/fix_reaxc_species.h @@ -48,7 +48,6 @@ class FixReaxCSpecies : public Fix { private: int me, nprocs, nmax, nlocal, ntypes, ntotal; - bigint natoms; int nrepeat, nfreq, posfreq; int Nmoltype, vector_nmole, vector_nspec; int *Name, *MolName, *NMol, *nd, *MolType, *molmap; diff --git a/src/fix_nve_limit.h b/src/fix_nve_limit.h index aea1718f39..0269d49b9d 100644 --- a/src/fix_nve_limit.h +++ b/src/fix_nve_limit.h @@ -39,7 +39,7 @@ class FixNVELimit : public Fix { private: double dtv,dtf; double *step_respa; - int mass_require,ncount; + int ncount; double xlimit,vlimitsq; }; diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 115750e271..0c573fba10 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -525,8 +525,8 @@ int FixPropertyAtom::pack_restart(int i, double *buf) for (int j = 0; j < nvalue; j++) { if (style[j] == MOLECULE) buf[m++] = ubuf(atom->molecule[i]).d; else if (style[j] == CHARGE) buf[m++] = atom->q[i]; - else if (style[j] == INTEGER) buf[m++] = ubuf(atom->ivector[index[m]][i]).d; - else if (style[j] == DOUBLE) buf[m++] = atom->dvector[index[m]][i]; + else if (style[j] == INTEGER) buf[m++] = ubuf(atom->ivector[index[j]][i]).d; + else if (style[j] == DOUBLE) buf[m++] = atom->dvector[index[j]][i]; } return nvalue+1; @@ -552,9 +552,9 @@ void FixPropertyAtom::unpack_restart(int nlocal, int nth) else if (style[i] == CHARGE) atom->q[nlocal] = extra[nlocal][m++]; else if (style[i] == INTEGER) - atom->ivector[index[m]][nlocal] = (int) ubuf(extra[nlocal][m++]).i; + atom->ivector[index[i]][nlocal] = (int) ubuf(extra[nlocal][m++]).i; else if (style[i] == DOUBLE) - atom->dvector[index[m]][nlocal] = extra[nlocal][m++]; + atom->dvector[index[i]][nlocal] = extra[nlocal][m++]; } }