Fix execution space issues in comm_kokkos

This commit is contained in:
Stan Moore
2017-07-28 10:44:08 -06:00
parent 8e834d8be1
commit 7edb294b44

View File

@ -472,8 +472,6 @@ void CommKokkos::exchange_device()
subhi = domain->subhi_lamda; subhi = domain->subhi_lamda;
} }
atomKK->sync(ExecutionSpaceFromDevice<DeviceType>::space,ALL_MASK);
// loop over dimensions // loop over dimensions
for (int dim = 0; dim < 3; dim++) { for (int dim = 0; dim < 3; dim++) {
@ -602,8 +600,6 @@ void CommKokkos::exchange_device()
} }
atomKK->modified(ExecutionSpaceFromDevice<DeviceType>::space,ALL_MASK);
if (atom->firstgroupname) { if (atom->firstgroupname) {
/* this is not yet implemented with Kokkos */ /* this is not yet implemented with Kokkos */
atomKK->sync(Host,ALL_MASK); atomKK->sync(Host,ALL_MASK);
@ -704,8 +700,8 @@ void CommKokkos::borders_device() {
AtomVecKokkos *avec = (AtomVecKokkos *) atom->avec; AtomVecKokkos *avec = (AtomVecKokkos *) atom->avec;
ExecutionSpace exec_space = ExecutionSpaceFromDevice<DeviceType>::space; ExecutionSpace exec_space = ExecutionSpaceFromDevice<DeviceType>::space;
k_sendlist.modify<DeviceType>(); k_sendlist.sync<DeviceType>();
atomKK->sync(exec_space,ALL_MASK); atomKK->sync(exec_space,X_MASK);
// do swaps over all 3 dimensions // do swaps over all 3 dimensions
@ -754,12 +750,10 @@ void CommKokkos::borders_device() {
if (sendflag) { if (sendflag) {
if (!bordergroup || ineed >= 2) { if (!bordergroup || ineed >= 2) {
if (style == SINGLE) { if (style == SINGLE) {
typename ArrayTypes<DeviceType>::tdual_int_1d total_send("TS",1); DAT::tdual_int_1d total_send("TS",1);
total_send.h_view(0) = 0; total_send.h_view(0) = 0;
if(exec_space == Device) { total_send.template modify<LMPHostType>();
total_send.template modify<DeviceType>(); total_send.template sync<DeviceType>();
total_send.template sync<LMPDeviceType>();
}
BuildBorderListFunctor<DeviceType> f(atomKK->k_x,k_sendlist, BuildBorderListFunctor<DeviceType> f(atomKK->k_x,k_sendlist,
total_send,nfirst,nlast,dim,lo,hi,iswap,maxsendlist[iswap]); total_send,nfirst,nlast,dim,lo,hi,iswap,maxsendlist[iswap]);
@ -773,16 +767,17 @@ void CommKokkos::borders_device() {
if(total_send.h_view(0) >= maxsendlist[iswap]) { if(total_send.h_view(0) >= maxsendlist[iswap]) {
grow_list(iswap,total_send.h_view(0)); grow_list(iswap,total_send.h_view(0));
k_sendlist.modify<DeviceType>(); k_sendlist.modify<DeviceType>();
total_send.h_view(0) = 0; total_send.h_view(0) = 0;
if(exec_space == Device) { total_send.template modify<LMPHostType>();
total_send.template modify<LMPHostType>(); total_send.template sync<DeviceType>();
total_send.template sync<LMPDeviceType>();
}
BuildBorderListFunctor<DeviceType> f(atomKK->k_x,k_sendlist, BuildBorderListFunctor<DeviceType> f(atomKK->k_x,k_sendlist,
total_send,nfirst,nlast,dim,lo,hi,iswap,maxsendlist[iswap]); total_send,nfirst,nlast,dim,lo,hi,iswap,maxsendlist[iswap]);
Kokkos::TeamPolicy<DeviceType> config((nlast-nfirst+127)/128,128); Kokkos::TeamPolicy<DeviceType> config((nlast-nfirst+127)/128,128);
Kokkos::parallel_for(config,f); Kokkos::parallel_for(config,f);
DeviceType::fence(); DeviceType::fence();
total_send.template modify<DeviceType>(); total_send.template modify<DeviceType>();
total_send.template sync<LMPHostType>(); total_send.template sync<LMPHostType>();
} }
@ -909,9 +904,7 @@ void CommKokkos::borders_device() {
// reset global->local map // reset global->local map
if (exec_space == Host) k_sendlist.sync<LMPDeviceType>(); k_sendlist.template modify<DeviceType>();
atomKK->modified(exec_space,ALL_MASK);
DeviceType::fence();
atomKK->sync(Host,TAG_MASK); atomKK->sync(Host,TAG_MASK);
if (map_style) atom->map_set(); if (map_style) atom->map_set();
} }