port data_atom() changes to KOKKOS

This commit is contained in:
Axel Kohlmeyer
2021-12-30 18:31:15 -05:00
parent 7f2b505df3
commit def1072f0f
21 changed files with 64 additions and 54 deletions

View File

@ -1630,7 +1630,7 @@ void AtomVecAngleKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecAngleKokkos::data_atom(double *coord, imageint imagetmp,
char **values)
const std::vector<std::string> &values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
@ -1663,9 +1663,10 @@ void AtomVecAngleKokkos::data_atom(double *coord, imageint imagetmp,
initialize other atom quantities for this sub-style
------------------------------------------------------------------------- */
int AtomVecAngleKokkos::data_atom_hybrid(int nlocal, char **values)
int AtomVecAngleKokkos::data_atom_hybrid(int nlocal, const std::vector<std::string> &values,
int offset)
{
h_molecule(nlocal) = utils::inumeric(FLERR,values[0],true,lmp);
h_molecule(nlocal) = utils::inumeric(FLERR,values[offset],true,lmp);
h_num_bond(nlocal) = 0;
h_num_angle(nlocal) = 0;
return 1;

View File

@ -51,8 +51,8 @@ class AtomVecAngleKokkos : public AtomVecKokkos {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void data_atom(double *, imageint, const std::vector<std::string> &);
int data_atom_hybrid(int, const std::vector<std::string> &, int);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);

View File

@ -821,8 +821,8 @@ void AtomVecAtomicKokkos::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecAtomicKokkos::data_atom(double *coord, tagint imagetmp,
char **values)
void AtomVecAtomicKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);

View File

@ -44,7 +44,7 @@ class AtomVecAtomicKokkos : public AtomVecKokkos {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, tagint, char **);
void data_atom(double *, imageint, const std::vector<std::string> &);
void pack_data(double **);
void write_data(FILE *, int, double **);
double memory_usage();

View File

@ -1056,7 +1056,7 @@ void AtomVecBondKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecBondKokkos::data_atom(double *coord, imageint imagetmp,
char **values)
const std::vector<std::string> &values)
{
int nlocal = atomKK->nlocal;
if (nlocal == nmax) grow(0);
@ -1088,9 +1088,10 @@ void AtomVecBondKokkos::data_atom(double *coord, imageint imagetmp,
initialize other atom quantities for this sub-style
------------------------------------------------------------------------- */
int AtomVecBondKokkos::data_atom_hybrid(int nlocal, char **values)
int AtomVecBondKokkos::data_atom_hybrid(int nlocal, const std::vector<std::string> &values,
int offset)
{
h_molecule(nlocal) = utils::inumeric(FLERR,values[0],true,lmp);
h_molecule(nlocal) = utils::inumeric(FLERR,values[offset],true,lmp);
h_num_bond(nlocal) = 0;
return 1;
}

View File

@ -45,8 +45,8 @@ class AtomVecBondKokkos : public AtomVecKokkos {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void data_atom(double *, imageint, const std::vector<std::string> &);
int data_atom_hybrid(int, const std::vector<std::string> &, int);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);

View File

@ -955,7 +955,7 @@ void AtomVecChargeKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecChargeKokkos::data_atom(double *coord, imageint imagetmp,
char **values)
const std::vector<std::string> &values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
@ -987,9 +987,10 @@ void AtomVecChargeKokkos::data_atom(double *coord, imageint imagetmp,
initialize other atom quantities for this sub-style
------------------------------------------------------------------------- */
int AtomVecChargeKokkos::data_atom_hybrid(int nlocal, char **values)
int AtomVecChargeKokkos::data_atom_hybrid(int nlocal, const std::vector<std::string> &values,
int offset)
{
h_q[nlocal] = utils::numeric(FLERR,values[0],true,lmp);
h_q[nlocal] = utils::numeric(FLERR,values[offset],true,lmp);
return 1;
}

View File

@ -46,8 +46,8 @@ class AtomVecChargeKokkos : public AtomVecKokkos {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int , char **);
void data_atom(double *, imageint, const std::vector<std::string> &);
int data_atom_hybrid(int , const std::vector<std::string> &, int);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);

View File

@ -1716,8 +1716,8 @@ void AtomVecDPDKokkos::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecDPDKokkos::data_atom(double *coord, tagint imagetmp,
char **values)
void AtomVecDPDKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
@ -1759,9 +1759,10 @@ void AtomVecDPDKokkos::data_atom(double *coord, tagint imagetmp,
initialize other atom quantities for this sub-style
------------------------------------------------------------------------- */
int AtomVecDPDKokkos::data_atom_hybrid(int nlocal, char **values)
int AtomVecDPDKokkos::data_atom_hybrid(int nlocal, const std::vector<std::string> &values,
int offset)
{
h_dpdTheta(nlocal) = utils::numeric(FLERR,values[0],true,lmp);
h_dpdTheta(nlocal) = utils::numeric(FLERR,values[offset],true,lmp);
atomKK->modified(Host,DPDTHETA_MASK);

View File

@ -54,8 +54,8 @@ class AtomVecDPDKokkos : public AtomVecKokkos {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void data_atom(double *, imageint, const std::vector<std::string> &);
int data_atom_hybrid(int, const std::vector<std::string> &, int);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);

View File

@ -1488,7 +1488,7 @@ void AtomVecFullKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecFullKokkos::data_atom(double *coord, imageint imagetmp,
char **values)
const std::vector<std::string> &values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
@ -1525,10 +1525,11 @@ void AtomVecFullKokkos::data_atom(double *coord, imageint imagetmp,
initialize other atom quantities for this sub-style
------------------------------------------------------------------------- */
int AtomVecFullKokkos::data_atom_hybrid(int nlocal, char **values)
int AtomVecFullKokkos::data_atom_hybrid(int nlocal, const std::vector<std::string> &values,
int offset)
{
h_molecule(nlocal) = utils::inumeric(FLERR,values[0],true,lmp);
h_q(nlocal) = utils::numeric(FLERR,values[1],true,lmp);
h_molecule(nlocal) = utils::inumeric(FLERR,values[offset],true,lmp);
h_q(nlocal) = utils::numeric(FLERR,values[offset+1],true,lmp);
h_num_bond(nlocal) = 0;
h_num_angle(nlocal) = 0;
h_num_dihedral(nlocal) = 0;

View File

@ -45,8 +45,8 @@ class AtomVecFullKokkos : public AtomVecKokkos {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void data_atom(double *, imageint, const std::vector<std::string> &);
int data_atom_hybrid(int, const std::vector<std::string> &, int);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);

View File

@ -970,7 +970,8 @@ void AtomVecHybridKokkos::create_atom(int itype, double *coord)
grow() occurs here so arrays for all sub-styles are grown
------------------------------------------------------------------------- */
void AtomVecHybridKokkos::data_atom(double *coord, imageint imagetmp, char **values)
void AtomVecHybridKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
{
atomKK->sync(Host,X_MASK|TAG_MASK|TYPE_MASK|IMAGE_MASK|MASK_MASK|V_MASK|OMEGA_MASK/*|ANGMOM_MASK*/);
@ -1009,7 +1010,7 @@ void AtomVecHybridKokkos::data_atom(double *coord, imageint imagetmp, char **val
int m = 5;
for (int k = 0; k < nstyles; k++)
m += styles[k]->data_atom_hybrid(nlocal,&values[m]);
m += styles[k]->data_atom_hybrid(nlocal,values,m);
atom->nlocal++;
}

View File

@ -57,8 +57,8 @@ class AtomVecHybridKokkos : public AtomVecKokkos {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, imageint, char **);
int data_atom_hybrid(int, char **) {return 0;}
void data_atom(double *, imageint, const std::vector<std::string> &);
int data_atom_hybrid(int, const std::vector<std::string> &, int) {return 0;}
void data_vel(int, char **);
void pack_data(double **);
void write_data(FILE *, int, double **);

View File

@ -1889,7 +1889,7 @@ void AtomVecMolecularKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecMolecularKokkos::data_atom(double *coord, imageint imagetmp,
char **values)
const std::vector<std::string> &values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
@ -1924,9 +1924,10 @@ void AtomVecMolecularKokkos::data_atom(double *coord, imageint imagetmp,
initialize other atom quantities for this sub-style
------------------------------------------------------------------------- */
int AtomVecMolecularKokkos::data_atom_hybrid(int nlocal, char **values)
int AtomVecMolecularKokkos::data_atom_hybrid(int nlocal, const std::vector<std::string> &values,
int offset)
{
h_molecule(nlocal) = utils::inumeric(FLERR,values[0],true,lmp);
h_molecule(nlocal) = utils::inumeric(FLERR,values[offset],true,lmp);
h_num_bond(nlocal) = 0;
h_num_angle(nlocal) = 0;
h_num_dihedral(nlocal) = 0;

View File

@ -51,8 +51,8 @@ class AtomVecMolecularKokkos : public AtomVecKokkos {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void data_atom(double *, imageint, const std::vector<std::string> &);
int data_atom_hybrid(int, const std::vector<std::string> &, int);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);

View File

@ -2543,7 +2543,8 @@ void AtomVecSphereKokkos::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecSphereKokkos::data_atom(double *coord, imageint imagetmp, char **values)
void AtomVecSphereKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
@ -2590,13 +2591,14 @@ void AtomVecSphereKokkos::data_atom(double *coord, imageint imagetmp, char **val
initialize other atom quantities for this sub-style
------------------------------------------------------------------------- */
int AtomVecSphereKokkos::data_atom_hybrid(int nlocal, char **values)
int AtomVecSphereKokkos::data_atom_hybrid(int nlocal, const std::vector<std::string> &values,
int offset)
{
radius[nlocal] = 0.5 * utils::numeric(FLERR,values[0],true,lmp);
radius[nlocal] = 0.5 * utils::numeric(FLERR,values[offset],true,lmp);
if (radius[nlocal] < 0.0)
error->one(FLERR,"Invalid radius in Atoms section of data file");
double density = utils::numeric(FLERR,values[1],true,lmp);
double density = utils::numeric(FLERR,values[offset+1],true,lmp);
if (density <= 0.0)
error->one(FLERR,"Invalid density in Atoms section of data file");

View File

@ -58,8 +58,8 @@ class AtomVecSphereKokkos : public AtomVecKokkos {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, imageint, char **);
int data_atom_hybrid(int, char **);
void data_atom(double *, imageint, const std::vector<std::string> &);
int data_atom_hybrid(int, const std::vector<std::string> &, int);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
void pack_data(double **);

View File

@ -1056,7 +1056,7 @@ void AtomVecSpinKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecSpinKokkos::data_atom(double *coord, imageint imagetmp,
char **values)
const std::vector<std::string> &values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
@ -1098,12 +1098,13 @@ void AtomVecSpinKokkos::data_atom(double *coord, imageint imagetmp,
initialize other atom quantities for this sub-style
------------------------------------------------------------------------- */
int AtomVecSpinKokkos::data_atom_hybrid(int nlocal, char **values)
int AtomVecSpinKokkos::data_atom_hybrid(int nlocal, const std::vector<std::string> &values,
int offset)
{
h_sp(nlocal,3) = utils::numeric(FLERR,values[0],true,lmp);
h_sp(nlocal,0) = utils::numeric(FLERR,values[1],true,lmp);
h_sp(nlocal,1) = utils::numeric(FLERR,values[2],true,lmp);
h_sp(nlocal,2) = utils::numeric(FLERR,values[3],true,lmp);
h_sp(nlocal,3) = utils::numeric(FLERR,values[offset],true,lmp);
h_sp(nlocal,0) = utils::numeric(FLERR,values[offset+1],true,lmp);
h_sp(nlocal,1) = utils::numeric(FLERR,values[offset+2],true,lmp);
h_sp(nlocal,2) = utils::numeric(FLERR,values[offset+3],true,lmp);
double inorm = 1.0/sqrt(sp[nlocal][0]*sp[nlocal][0] +
sp[nlocal][1]*sp[nlocal][1] +
sp[nlocal][2]*sp[nlocal][2]);

View File

@ -45,8 +45,8 @@ class AtomVecSpinKokkos : public AtomVecKokkos {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, imageint, char **);
int data_atom_hybrid(int, char **);
void data_atom(double *, imageint, const std::vector<std::string> &);
int data_atom_hybrid(int, const std::vector<std::string> &, int);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);

View File

@ -166,7 +166,7 @@ class AtomVec : protected Pointers {
virtual int unpack_reverse_hybrid(int, int *, double *) { return 0; }
virtual int pack_border_hybrid(int, int *, double *) { return 0; }
virtual int unpack_border_hybrid(int, int, double *) { return 0; }
virtual int data_atom_hybrid(int, char **) { return 0; }
virtual int data_atom_hybrid(int, const std::vector<std::string> &, int) { return 0; }
virtual int data_vel_hybrid(int, char **) { return 0; }
virtual int pack_data_hybrid(int, double *) { return 0; }
virtual int write_data_hybrid(FILE *, double *) { return 0; }