Add method to copy Kokkos neighbor list to CPU list

This commit is contained in:
Stan Moore
2020-02-26 14:26:46 -07:00
parent a828facbd8
commit eb80fd3031
10 changed files with 133 additions and 33 deletions

View File

@ -849,7 +849,8 @@ int Neighbor::init_pair()
// allocate initial pages for each list, except if copy flag set
for (i = 0; i < nlist; i++) {
if (lists[i]->copy) continue;
if (lists[i]->copy && !lists[i]->kk2cpu)
continue;
lists[i]->setup_pages(pgsize,oneatom);
}
@ -860,8 +861,10 @@ int Neighbor::init_pair()
// also Kokkos list initialization
int maxatom = atom->nmax;
for (i = 0; i < nlist; i++)
if (neigh_pair[i] && !lists[i]->copy) lists[i]->grow(maxatom,maxatom);
for (i = 0; i < nlist; i++) {
if (neigh_pair[i] && (!lists[i]->copy || lists[i]->kk2cpu))
lists[i]->grow(maxatom,maxatom);
}
// plist = indices of perpetual NPair classes
// perpetual = non-occasional, re-built at every reneighboring
@ -1257,8 +1260,8 @@ void Neighbor::morph_copy()
if (irq->history != jrq->history) continue;
if (irq->bond != jrq->bond) continue;
if (irq->intel != jrq->intel) continue;
if (irq->kokkos_host != jrq->kokkos_host) continue;
if (irq->kokkos_device != jrq->kokkos_device) continue;
if (irq->kokkos_host && !jrq->kokkos_host) continue;
if (irq->kokkos_device && !jrq->kokkos_device) continue;
if (irq->ssa != jrq->ssa) continue;
if (irq->cut != jrq->cut) continue;
if (irq->cutoff != jrq->cutoff) continue;
@ -1789,8 +1792,12 @@ int Neighbor::choose_pair(NeighRequest *rq)
if (rq->copy) {
if (!(mask & NP_COPY)) continue;
if (!rq->kokkos_device != !(mask & NP_KOKKOS_DEVICE)) continue;
if (!rq->kokkos_host != !(mask & NP_KOKKOS_HOST)) continue;
if (rq->kokkos_device || rq->kokkos_host) {
if (!rq->kokkos_device != !(mask & NP_KOKKOS_DEVICE)) continue;
if (!rq->kokkos_host != !(mask & NP_KOKKOS_HOST)) continue;
}
if (!requests[rq->copylist]->kokkos_device != !(mask & NP_KOKKOS_DEVICE)) continue;
if (!requests[rq->copylist]->kokkos_host != !(mask & NP_KOKKOS_HOST)) continue;
return i+1;
}
@ -2102,7 +2109,8 @@ void Neighbor::build(int topoflag)
for (i = 0; i < npair_perpetual; i++) {
m = plist[i];
if (!lists[m]->copy) lists[m]->grow(nlocal,nall);
if (!lists[i]->copy || lists[i]->kk2cpu)
lists[m]->grow(nlocal,nall);
neigh_pair[m]->build_setup();
neigh_pair[m]->build(lists[m]);
}
@ -2191,7 +2199,8 @@ void Neighbor::build_one(class NeighList *mylist, int preflag)
// build the list
if (!mylist->copy) mylist->grow(atom->nlocal,atom->nlocal+atom->nghost);
if (!mylist->copy || mylist->kk2cpu)
mylist->grow(atom->nlocal,atom->nlocal+atom->nghost);
np->build_setup();
np->build(mylist);
}