From 09fc8b0bd731270b2b08b720e6bb023eae86e707 Mon Sep 17 00:00:00 2001 From: Dan Ibanez Date: Fri, 27 Jan 2017 08:21:57 -0700 Subject: [PATCH 1/2] kspace & dihedral can't do their own sync/modify because the verlet_kokkos system has a "clever" optimization which will alter the datamasks before calling sync/modify, so the datamask framework must be strictly obeyed for GPU correctness. (the optimization is to concurrently compute forces on the host and GPU, and add them up at the end of an iteration. calling your own sync will overwrite the partial GPU forces with the partial host forces). --- src/KOKKOS/dihedral_opls_kokkos.cpp | 3 --- src/KOKKOS/pppm_kokkos.cpp | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/KOKKOS/dihedral_opls_kokkos.cpp b/src/KOKKOS/dihedral_opls_kokkos.cpp index ff28391ec3..ed4a5b259c 100644 --- a/src/KOKKOS/dihedral_opls_kokkos.cpp +++ b/src/KOKKOS/dihedral_opls_kokkos.cpp @@ -85,13 +85,10 @@ void DihedralOPLSKokkos::compute(int eflag_in, int vflag_in) d_vatom = k_vatom.d_view; } - atomKK->sync(execution_space,datamask_read); k_k1.template sync(); k_k2.template sync(); k_k3.template sync(); k_k4.template sync(); - if (eflag || vflag) atomKK->modified(execution_space,datamask_modify); - else atomKK->modified(execution_space,F_MASK); x = atomKK->k_x.view(); f = atomKK->k_f.view(); diff --git a/src/KOKKOS/pppm_kokkos.cpp b/src/KOKKOS/pppm_kokkos.cpp index de9c0ae630..6f91d91e46 100644 --- a/src/KOKKOS/pppm_kokkos.cpp +++ b/src/KOKKOS/pppm_kokkos.cpp @@ -646,10 +646,7 @@ void PPPMKokkos::compute(int eflag, int vflag) x = atomKK->k_x.view(); f = atomKK->k_f.view(); q = atomKK->k_q.view(); - - atomKK->sync(execution_space,datamask_read); - atomKK->modified(execution_space,datamask_modify); - + //nlocal = atomKK->nlocal; //nall = atomKK->nlocal + atomKK->nghost; //newton_pair = force->newton_pair; From 2a6f5e651ce609a6f86dfef393a200b758fe31cf Mon Sep 17 00:00:00 2001 From: Dan Ibanez Date: Fri, 27 Jan 2017 09:17:48 -0700 Subject: [PATCH 2/2] more preference of datamask over custom sync see commit 09fc8b0 for details on why --- src/KOKKOS/angle_charmm_kokkos.cpp | 3 --- src/KOKKOS/bond_fene_kokkos.cpp | 3 --- src/KOKKOS/dihedral_charmm_kokkos.cpp | 5 ----- 3 files changed, 11 deletions(-) diff --git a/src/KOKKOS/angle_charmm_kokkos.cpp b/src/KOKKOS/angle_charmm_kokkos.cpp index 816c9f3105..dcd5d91e05 100644 --- a/src/KOKKOS/angle_charmm_kokkos.cpp +++ b/src/KOKKOS/angle_charmm_kokkos.cpp @@ -84,9 +84,6 @@ void AngleCharmmKokkos::compute(int eflag_in, int vflag_in) } } - if (eflag || vflag) atomKK->modified(execution_space,datamask_modify); - else atomKK->modified(execution_space,F_MASK); - x = atomKK->k_x.view(); f = atomKK->k_f.view(); neighborKK->k_anglelist.template sync(); diff --git a/src/KOKKOS/bond_fene_kokkos.cpp b/src/KOKKOS/bond_fene_kokkos.cpp index 7ff2e568d1..b8b0295182 100644 --- a/src/KOKKOS/bond_fene_kokkos.cpp +++ b/src/KOKKOS/bond_fene_kokkos.cpp @@ -85,13 +85,10 @@ void BondFENEKokkos::compute(int eflag_in, int vflag_in) d_vatom = k_vatom.d_view; } - atomKK->sync(execution_space,datamask_read); k_k.template sync(); k_r0.template sync(); k_epsilon.template sync(); k_sigma.template sync(); - if (eflag || vflag) atomKK->modified(execution_space,datamask_modify); - else atomKK->modified(execution_space,F_MASK); x = atomKK->k_x.view(); f = atomKK->k_f.view(); diff --git a/src/KOKKOS/dihedral_charmm_kokkos.cpp b/src/KOKKOS/dihedral_charmm_kokkos.cpp index 3ae37993c1..b0dd1a2172 100644 --- a/src/KOKKOS/dihedral_charmm_kokkos.cpp +++ b/src/KOKKOS/dihedral_charmm_kokkos.cpp @@ -98,11 +98,6 @@ void DihedralCharmmKokkos::compute(int eflag_in, int vflag_in) } } - - //atomKK->sync(execution_space,datamask_read); - if (eflag || vflag) atomKK->modified(execution_space,datamask_modify); - else atomKK->modified(execution_space,F_MASK); - x = atomKK->k_x.view(); f = atomKK->k_f.view(); q = atomKK->k_q.view();