recover non-labelmap functionality with Kokkos. Error out when maps are used with Kokkos

This commit is contained in:
Axel Kohlmeyer
2022-09-10 12:50:45 -04:00
parent 44e983f641
commit 9b172d66f8
26 changed files with 41 additions and 36 deletions

View File

@ -86,6 +86,8 @@ This command must come after the simulation box is defined by a
:doc:`read_data <read_data>`, :doc:`read_restart <read_restart>`, or
:doc:`create_box <create_box>` command.
Labelmaps are currently not supported when using the KOKKOS package.
Related commands
""""""""""""""""

View File

@ -1519,11 +1519,14 @@ To read gzipped data files, you must compile LAMMPS with the
-DLAMMPS_GZIP option. See the :doc:`Build settings <Build_settings>`
doc page for details.
Labelmaps are currently not supported when using the KOKKOS package.
Related commands
""""""""""""""""
:doc:`read_dump <read_dump>`, :doc:`read_restart <read_restart>`,
:doc:`create_atoms <create_atoms>`, :doc:`write_data <write_data>`
:doc:`create_atoms <create_atoms>`, :doc:`write_data <write_data>`,
:doc:`labelmap <labelmap>`
Default
"""""""

View File

@ -1633,7 +1633,7 @@ void AtomVecAngleKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecAngleKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
const std::vector<std::string> &values, std::string &extract)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
@ -1642,6 +1642,7 @@ void AtomVecAngleKokkos::data_atom(double *coord, imageint imagetmp,
h_tag(nlocal) = utils::inumeric(FLERR,values[0],true,lmp);
h_molecule(nlocal) = utils::inumeric(FLERR,values[1],true,lmp);
h_type(nlocal) = utils::inumeric(FLERR,values[2],true,lmp);
extract = values[2];
if (h_type(nlocal) <= 0 || h_type(nlocal) > atom->ntypes)
error->one(FLERR,"Invalid atom type in Atoms section of data file");

View File

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

View File

@ -824,13 +824,14 @@ void AtomVecAtomicKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecAtomicKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
const std::vector<std::string> &values, std::string &extract)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
h_tag[nlocal] = utils::inumeric(FLERR,values[0],true,lmp);
h_type[nlocal] = utils::inumeric(FLERR,values[1],true,lmp);
extract = values[1];
if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes)
error->one(FLERR,"Invalid atom type in Atoms section of data file");

View File

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

View File

@ -1059,7 +1059,7 @@ void AtomVecBondKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecBondKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
const std::vector<std::string> &values, std::string &extract)
{
int nlocal = atomKK->nlocal;
if (nlocal == nmax) grow(0);
@ -1068,6 +1068,7 @@ void AtomVecBondKokkos::data_atom(double *coord, imageint imagetmp,
h_tag(nlocal) = utils::inumeric(FLERR,values[0],true,lmp);
h_molecule(nlocal) = utils::inumeric(FLERR,values[1],true,lmp);
h_type(nlocal) = utils::inumeric(FLERR,values[2],true,lmp);
extract = values[2];
if (h_type(nlocal) <= 0 || h_type(nlocal) > atom->ntypes)
error->one(FLERR,"Invalid atom type in Atoms section of data file");

View File

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

View File

@ -957,13 +957,14 @@ void AtomVecChargeKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecChargeKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
const std::vector<std::string> &values, std::string &extract)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
h_tag[nlocal] = utils::inumeric(FLERR,values[0],true,lmp);
h_type[nlocal] = utils::inumeric(FLERR,values[1],true,lmp);
extract = values[1];
if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes)
error->one(FLERR,"Invalid atom type in Atoms section of data file");

View File

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

View File

@ -1719,13 +1719,14 @@ void AtomVecDPDKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecDPDKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
const std::vector<std::string> &values, std::string &extract)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
h_tag[nlocal] = utils::tnumeric(FLERR,values[0],true,lmp);
h_type[nlocal] = utils::inumeric(FLERR,values[1],true,lmp);
extract = values[1];
if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes)
error->one(FLERR,"Invalid atom type in Atoms section of data file");

View File

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

View File

@ -1491,7 +1491,7 @@ void AtomVecFullKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecFullKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
const std::vector<std::string> &values, std::string &extract)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
@ -1500,6 +1500,7 @@ void AtomVecFullKokkos::data_atom(double *coord, imageint imagetmp,
h_tag(nlocal) = utils::inumeric(FLERR,values[0],true,lmp);
h_molecule(nlocal) = utils::inumeric(FLERR,values[1],true,lmp);
h_type(nlocal) = utils::inumeric(FLERR,values[2],true,lmp);
extract = values[2];
if (h_type(nlocal) <= 0 || h_type(nlocal) > atom->ntypes)
error->one(FLERR,"Invalid atom type in Atoms section of data file");

View File

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

View File

@ -971,7 +971,7 @@ void AtomVecHybridKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecHybridKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
const std::vector<std::string> &values, std::string &extract)
{
atomKK->sync(Host,X_MASK|TAG_MASK|TYPE_MASK|IMAGE_MASK|MASK_MASK|V_MASK|OMEGA_MASK/*|ANGMOM_MASK*/);
@ -980,6 +980,7 @@ void AtomVecHybridKokkos::data_atom(double *coord, imageint imagetmp,
h_tag[nlocal] = utils::tnumeric(FLERR,values[0],true,lmp);
h_type[nlocal] = utils::inumeric(FLERR,values[1],true,lmp);
extract = values[1];
if (h_type[nlocal] <= 0 || h_type[nlocal] > atom->ntypes)
error->one(FLERR,"Invalid atom h_type in Atoms section of data file");

View File

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

View File

@ -1892,7 +1892,7 @@ void AtomVecMolecularKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecMolecularKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
const std::vector<std::string> &values, std::string &extract)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
@ -1901,6 +1901,7 @@ void AtomVecMolecularKokkos::data_atom(double *coord, imageint imagetmp,
h_tag(nlocal) = utils::inumeric(FLERR,values[0],true,lmp);
h_molecule(nlocal) = utils::inumeric(FLERR,values[1],true,lmp);
h_type(nlocal) = utils::inumeric(FLERR,values[2],true,lmp);
extract = values[2];
if (h_type(nlocal) <= 0 || h_type(nlocal) > atom->ntypes)
error->one(FLERR,"Invalid atom type in Atoms section of data file");

View File

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

View File

@ -2546,13 +2546,14 @@ void AtomVecSphereKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecSphereKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
const std::vector<std::string> &values, std::string &extract)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
tag[nlocal] = utils::tnumeric(FLERR,values[0],true,lmp);
type[nlocal] = utils::inumeric(FLERR,values[1],true,lmp);
extract = values[1];
if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes)
error->one(FLERR,"Invalid atom type in Atoms section of data file");

View File

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

View File

@ -1058,13 +1058,14 @@ void AtomVecSpinKokkos::create_atom(int itype, double *coord)
------------------------------------------------------------------------- */
void AtomVecSpinKokkos::data_atom(double *coord, imageint imagetmp,
const std::vector<std::string> &values)
const std::vector<std::string> &values, std::string &extract)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
h_tag[nlocal] = utils::inumeric(FLERR,values[0],true,lmp);
h_type[nlocal] = utils::inumeric(FLERR,values[1],true,lmp);
extract = values[1];
if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes)
error->one(FLERR,"Invalid atom type in Atoms section of data file");

View File

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

View File

@ -1200,7 +1200,7 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
break;
}
case 1: { // type label
if (!atom->labelmapflag)
if (!labelmapflag)
error->one(FLERR, "Invalid line in {}: {}", location, utils::trim(buf));
type[nlocal - 1] = lmap->find(typestr, Atom::ATOM);
if (type[nlocal - 1] == -1)
@ -2195,6 +2195,8 @@ void Atom::add_molecule_atom(Molecule *onemol, int iatom, int ilocal, tagint off
void Atom::add_label_map()
{
if (lmp->kokkos)
error->all(FLERR, "Label maps are currently not supported with Kokkos");
labelmapflag = 1;
lmap = new LabelMap(lmp,ntypes,nbondtypes,nangletypes,ndihedraltypes,nimpropertypes);
}

View File

@ -1650,17 +1650,6 @@ void AtomVec::create_atom(int itype, double *coord)
atom->nlocal++;
}
/* ----------------------------------------------------------------------
version of data_atom without extract option
temporary fix for Kokkos compilation
------------------------------------------------------------------------- */
void AtomVec::data_atom(double *coord, imageint imagetmp, const std::vector<std::string> &values)
{
std::string strtmp;
data_atom(coord, imagetmp, values, strtmp);
}
/* ----------------------------------------------------------------------
unpack one line from Atoms section of data file
initialize other peratom quantities

View File

@ -123,7 +123,6 @@ class AtomVec : protected Pointers {
virtual void create_atom(int, double *);
virtual void create_atom_post(int) {}
virtual void data_atom(double *, imageint, const std::vector<std::string> &);
virtual void data_atom(double *, imageint, const std::vector<std::string> &, std::string &);
virtual void data_atom_post(int) {}
virtual void data_atom_bonus(int, const std::vector<std::string> &) {}

View File

@ -857,10 +857,10 @@ void Special::combine()
utils::logmesg(lmp,"{:>6} = max # of special neighbors\n",atom->maxspecial);
if (lmp->kokkos) {
auto atomKK = dynamic_cast<AtomKokkos*>( atom);
auto atomKK = dynamic_cast<AtomKokkos*>(atom);
atomKK->modified(Host,SPECIAL_MASK);
atomKK->sync(Device,SPECIAL_MASK);
auto memoryKK = dynamic_cast<MemoryKokkos*>( memory);
auto memoryKK = dynamic_cast<MemoryKokkos*>(memory);
memoryKK->grow_kokkos(atomKK->k_special,atom->special,
atom->nmax,atom->maxspecial,"atom:special");
atomKK->modified(Device,SPECIAL_MASK);