Fix bug in fix_nh_kokkos

This commit is contained in:
Stan Moore
2019-04-05 14:16:25 -06:00
parent ac7312caf1
commit 542d8aaf07

View File

@ -106,8 +106,8 @@ void FixNHKokkos<DeviceType>::setup(int vflag)
if (t0 == 0.0) { if (t0 == 0.0) {
atomKK->sync(temperature->execution_space,temperature->datamask_read); atomKK->sync(temperature->execution_space,temperature->datamask_read);
atomKK->modified(temperature->execution_space,temperature->datamask_modify);
t0 = temperature->compute_scalar(); t0 = temperature->compute_scalar();
atomKK->modified(temperature->execution_space,temperature->datamask_modify);
if (t0 == 0.0) { if (t0 == 0.0) {
if (strcmp(update->unit_style,"lj") == 0) t0 = 1.0; if (strcmp(update->unit_style,"lj") == 0) t0 = 1.0;
else t0 = 300.0; else t0 = 300.0;
@ -119,8 +119,8 @@ void FixNHKokkos<DeviceType>::setup(int vflag)
if (pstat_flag) compute_press_target(); if (pstat_flag) compute_press_target();
atomKK->sync(temperature->execution_space,temperature->datamask_read); atomKK->sync(temperature->execution_space,temperature->datamask_read);
atomKK->modified(temperature->execution_space,temperature->datamask_modify);
t_current = temperature->compute_scalar(); t_current = temperature->compute_scalar();
atomKK->modified(temperature->execution_space,temperature->datamask_modify);
tdof = temperature->dof; tdof = temperature->dof;
if (pstat_flag) { if (pstat_flag) {
@ -250,10 +250,11 @@ void FixNHKokkos<DeviceType>::final_integrate()
// per-atom values are invalid if reneigh/comm occurred // per-atom values are invalid if reneigh/comm occurred
// since temp->compute() in initial_integrate() // since temp->compute() in initial_integrate()
if (which == BIAS && neighbor->ago == 0) if (which == BIAS && neighbor->ago == 0) {
atomKK->sync(temperature->execution_space,temperature->datamask_read); atomKK->sync(temperature->execution_space,temperature->datamask_read);
atomKK->modified(temperature->execution_space,temperature->datamask_modify);
t_current = temperature->compute_scalar(); t_current = temperature->compute_scalar();
atomKK->modified(temperature->execution_space,temperature->datamask_modify);
}
if (pstat_flag) nh_v_press(); if (pstat_flag) nh_v_press();
@ -261,8 +262,8 @@ void FixNHKokkos<DeviceType>::final_integrate()
// compute appropriately coupled elements of mvv_current // compute appropriately coupled elements of mvv_current
atomKK->sync(temperature->execution_space,temperature->datamask_read); atomKK->sync(temperature->execution_space,temperature->datamask_read);
atomKK->modified(temperature->execution_space,temperature->datamask_modify);
t_current = temperature->compute_scalar(); t_current = temperature->compute_scalar();
atomKK->modified(temperature->execution_space,temperature->datamask_modify);
tdof = temperature->dof; tdof = temperature->dof;
if (pstat_flag) { if (pstat_flag) {
@ -476,8 +477,6 @@ void FixNHKokkos<DeviceType>::remap()
template<class DeviceType> template<class DeviceType>
void FixNHKokkos<DeviceType>::nh_v_press() void FixNHKokkos<DeviceType>::nh_v_press()
{ {
atomKK->sync(execution_space,V_MASK | MASK_MASK);
v = atomKK->k_v.view<DeviceType>(); v = atomKK->k_v.view<DeviceType>();
mask = atomKK->k_mask.view<DeviceType>(); mask = atomKK->k_mask.view<DeviceType>();
int nlocal = atomKK->nlocal; int nlocal = atomKK->nlocal;
@ -493,6 +492,8 @@ void FixNHKokkos<DeviceType>::nh_v_press()
atomKK->modified(temperature->execution_space,temperature->datamask_modify); atomKK->modified(temperature->execution_space,temperature->datamask_modify);
} }
atomKK->sync(execution_space,V_MASK | MASK_MASK);
copymode = 1; copymode = 1;
if (pstyle == TRICLINIC) if (pstyle == TRICLINIC)
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagFixNH_nh_v_press<1> >(0,nlocal),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagFixNH_nh_v_press<1> >(0,nlocal),*this);
@ -536,7 +537,6 @@ template<class DeviceType>
void FixNHKokkos<DeviceType>::nve_v() void FixNHKokkos<DeviceType>::nve_v()
{ {
atomKK->sync(execution_space,X_MASK | V_MASK | F_MASK | MASK_MASK | RMASS_MASK | TYPE_MASK); atomKK->sync(execution_space,X_MASK | V_MASK | F_MASK | MASK_MASK | RMASS_MASK | TYPE_MASK);
atomKK->modified(execution_space,V_MASK);
v = atomKK->k_v.view<DeviceType>(); v = atomKK->k_v.view<DeviceType>();
f = atomKK->k_f.view<DeviceType>(); f = atomKK->k_f.view<DeviceType>();
@ -553,6 +553,8 @@ void FixNHKokkos<DeviceType>::nve_v()
else else
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagFixNH_nve_v<0> >(0,nlocal),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagFixNH_nve_v<0> >(0,nlocal),*this);
copymode = 0; copymode = 0;
atomKK->modified(execution_space,V_MASK);
} }
template<class DeviceType> template<class DeviceType>
@ -616,8 +618,6 @@ void FixNHKokkos<DeviceType>::operator()(TagFixNH_nve_x, const int &i) const {
template<class DeviceType> template<class DeviceType>
void FixNHKokkos<DeviceType>::nh_v_temp() void FixNHKokkos<DeviceType>::nh_v_temp()
{ {
atomKK->sync(execution_space,V_MASK | MASK_MASK);
v = atomKK->k_v.view<DeviceType>(); v = atomKK->k_v.view<DeviceType>();
mask = atomKK->k_mask.view<DeviceType>(); mask = atomKK->k_mask.view<DeviceType>();
int nlocal = atomKK->nlocal; int nlocal = atomKK->nlocal;
@ -629,6 +629,8 @@ void FixNHKokkos<DeviceType>::nh_v_temp()
atomKK->modified(temperature->execution_space,temperature->datamask_modify); atomKK->modified(temperature->execution_space,temperature->datamask_modify);
} }
atomKK->sync(execution_space,V_MASK | MASK_MASK);
copymode = 1; copymode = 1;
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagFixNH_nh_v_temp>(0,nlocal),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagFixNH_nh_v_temp>(0,nlocal),*this);
copymode = 0; copymode = 0;