Merge pull request #679 from stanmoore1/kk_reax_comm

ReaxC optimizations
This commit is contained in:
Steve Plimpton
2017-10-05 17:08:17 -06:00
committed by GitHub
4 changed files with 16 additions and 13 deletions

View File

@ -63,6 +63,7 @@ FixQEqReaxKokkos(LAMMPS *lmp, int narg, char **arg) :
nmax = nmax = m_cap = 0;
allocated_flag = 0;
nprev = 4;
}
/* ---------------------------------------------------------------------- */
@ -158,15 +159,15 @@ void FixQEqReaxKokkos<DeviceType>::init_hist()
{
int i,j;
k_s_hist = DAT::tdual_ffloat_2d("qeq/kk:s_hist",atom->nmax,5);
k_s_hist = DAT::tdual_ffloat_2d("qeq/kk:s_hist",atom->nmax,nprev);
d_s_hist = k_s_hist.template view<DeviceType>();
h_s_hist = k_s_hist.h_view;
k_t_hist = DAT::tdual_ffloat_2d("qeq/kk:t_hist",atom->nmax,5);
k_t_hist = DAT::tdual_ffloat_2d("qeq/kk:t_hist",atom->nmax,nprev);
d_t_hist = k_t_hist.template view<DeviceType>();
h_t_hist = k_t_hist.h_view;
for( i = 0; i < atom->nmax; i++ )
for( j = 0; j < 5; j++ )
for( j = 0; j < nprev; j++ )
k_s_hist.h_view(i,j) = k_t_hist.h_view(i,j) = 0.0;
k_s_hist.template modify<LMPHostType>();
@ -334,11 +335,11 @@ void FixQEqReaxKokkos<DeviceType>::allocate_array()
d_d = k_d.template view<DeviceType>();
h_d = k_d.h_view;
k_s_hist = DAT::tdual_ffloat_2d("qeq/kk:s_hist",nmax,5);
k_s_hist = DAT::tdual_ffloat_2d("qeq/kk:s_hist",nmax,nprev);
d_s_hist = k_s_hist.template view<DeviceType>();
h_s_hist = k_s_hist.h_view;
k_t_hist = DAT::tdual_ffloat_2d("qeq/kk:t_hist",nmax,5);
k_t_hist = DAT::tdual_ffloat_2d("qeq/kk:t_hist",nmax,nprev);
d_t_hist = k_t_hist.template view<DeviceType>();
h_t_hist = k_t_hist.h_view;
}
@ -368,7 +369,7 @@ void FixQEqReaxKokkos<DeviceType>::zero_item(int ii) const
d_o[i] = 0.0;
d_r[i] = 0.0;
d_d[i] = 0.0;
//for( int j = 0; j < 5; j++ )
//for( int j = 0; j < nprev; j++ )
//d_s_hist(i,j) = d_t_hist(i,j) = 0.0;
}
@ -1087,7 +1088,7 @@ void FixQEqReaxKokkos<DeviceType>::calculate_q_item(int ii) const
if (mask[i] & groupbit) {
q(i) = d_s[i] - delta * d_t[i];
for (int k = 4; k > 0; --k) {
for (int k = nprev-1; k > 0; --k) {
d_s_hist(i,k) = d_s_hist(i,k-1);
d_t_hist(i,k) = d_t_hist(i,k-1);
}
@ -1173,7 +1174,7 @@ double FixQEqReaxKokkos<DeviceType>::memory_usage()
{
double bytes;
bytes = atom->nmax*5*2 * sizeof(F_FLOAT); // s_hist & t_hist
bytes = atom->nmax*nprev*2 * sizeof(F_FLOAT); // s_hist & t_hist
bytes += atom->nmax*8 * sizeof(F_FLOAT); // storage
bytes += n_cap*2 * sizeof(int); // matrix...
bytes += m_cap * sizeof(int);

View File

@ -131,6 +131,8 @@ template<class DeviceType>
void PairReaxCKokkos<DeviceType>::init_style()
{
PairReaxC::init_style();
if (fix_reax) modify->delete_fix("REAXC"); // not needed in the Kokkos version
fix_reax = NULL;
// irequest = neigh request made by parent class
@ -555,8 +557,8 @@ void PairReaxCKokkos<DeviceType>::Deallocate_Lookup_Tables()
ntypes = atom->ntypes;
for( i = 0; i < ntypes; ++i ) {
for( j = i; j < ntypes; ++j )
for( i = 0; i <= ntypes; ++i ) {
for( j = i; j <= ntypes; ++j )
if( LR[i][j].n ) {
sfree( LR[i][j].y, "LR[i,j].y" );
sfree( LR[i][j].H, "LR[i,j].H" );

View File

@ -703,7 +703,7 @@ void FixQEqReaxOMP::calculate_Q()
q[i] = s[i] - u * t[i];
// backup s & t
for (int k = 4; k > 0; --k) {
for (int k = nprev-1; k > 0; --k) {
s_hist[i][k] = s_hist[i][k-1];
t_hist[i][k] = t_hist[i][k-1];
}

View File

@ -95,7 +95,7 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) :
pack_flag = 0;
s = NULL;
t = NULL;
nprev = 5;
nprev = 4;
Hdia_inv = NULL;
b_s = NULL;
@ -817,7 +817,7 @@ void FixQEqReax::calculate_Q()
q[i] = s[i] - u * t[i];
/* backup s & t */
for (k = 4; k > 0; --k) {
for (k = nprev-1; k > 0; --k) {
s_hist[i][k] = s_hist[i][k-1];
t_hist[i][k] = t_hist[i][k-1];
}