Merge pull request #398 from stanmoore1/kokkos_changes

Kokkos changes
This commit is contained in:
sjplimp 2017-03-07 09:46:54 -07:00 committed by GitHub
commit c2aabdec22
2 changed files with 21 additions and 2 deletions

View File

@ -71,6 +71,10 @@ CommKokkos::CommKokkos(LAMMPS *lmp) : CommBrick(lmp)
maxsendlist[i] = BUFMIN;
}
memory->create_kokkos(k_sendlist,sendlist,maxswap,BUFMIN,"comm:sendlist");
max_buf_pair = 0;
k_buf_send_pair = DAT::tdual_xfloat_1d("comm:k_buf_send_pair",1);
k_buf_recv_pair = DAT::tdual_xfloat_1d("comm:k_recv_send_pair",1);
}
/* ---------------------------------------------------------------------- */
@ -300,9 +304,13 @@ void CommKokkos::forward_comm_pair_device(Pair *pair)
int nsize = pair->comm_forward;
for (iswap = 0; iswap < nswap; iswap++) {
int n = MAX(max_buf_pair,nsize*sendnum[iswap]);
n = MAX(n,nsize*recvnum[iswap]);
if (n > max_buf_pair)
grow_buf_pair(n);
}
DAT::tdual_xfloat_1d k_buf_send_pair = DAT::tdual_xfloat_1d("comm:k_buf_send_pair",nsize*sendnum[iswap]);
DAT::tdual_xfloat_1d k_buf_recv_pair = DAT::tdual_xfloat_1d("comm:k_recv_send_pair",nsize*recvnum[iswap]);
for (iswap = 0; iswap < nswap; iswap++) {
// pack buffer
@ -327,6 +335,12 @@ void CommKokkos::forward_comm_pair_device(Pair *pair)
}
}
void CommKokkos::grow_buf_pair(int n) {
max_buf_pair = n * BUFFACTOR;
k_buf_send_pair.resize(max_buf_pair);
k_buf_recv_pair.resize(max_buf_pair);
}
void CommKokkos::reverse_comm_pair(Pair *pair)
{
k_sendlist.sync<LMPHostType>();

View File

@ -59,6 +59,11 @@ class CommKokkos : public CommBrick {
//double *buf_send; // send buffer for all comm
//double *buf_recv; // recv buffer for all comm
int max_buf_pair;
DAT::tdual_xfloat_1d k_buf_send_pair;
DAT::tdual_xfloat_1d k_buf_recv_pair;
void grow_buf_pair(int);
void grow_send(int, int);
void grow_recv(int);
void grow_send_kokkos(int, int, ExecutionSpace space = Host);