Gradually cleaned up and removed redundancy in amoeba and hippo
This commit is contained in:
@ -245,8 +245,8 @@ inline int BaseAmoebaT::build_nbor_list(const int inum, const int host_inum,
|
||||
// ---------------------------------------------------------------------------
|
||||
template <class numtyp, class acctyp>
|
||||
void BaseAmoebaT::compute_polar_real_host_nbor(const int f_ago, const int inum_full,
|
||||
const int nall, double **host_x, int *host_type, int *host_amtype,
|
||||
int *host_amgroup, double **host_rpole,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
int *host_amtype, int *host_amgroup, double **host_rpole,
|
||||
double **host_uind, double **host_uinp,
|
||||
int *ilist, int *numj, int **firstneigh,
|
||||
const bool eflag_in, const bool vflag_in,
|
||||
@ -353,7 +353,6 @@ int** BaseAmoebaT::precompute(const int ago, const int inum_full, const int nall
|
||||
bool &success, double *host_q, double *boxlo,
|
||||
double *prd) {
|
||||
acc_timers();
|
||||
//int eflag, vflag;
|
||||
if (eatom) _eflag=2;
|
||||
else if (eflag_in) _eflag=1;
|
||||
else _eflag=0;
|
||||
@ -401,12 +400,10 @@ int** BaseAmoebaT::precompute(const int ago, const int inum_full, const int nall
|
||||
if (!success)
|
||||
return nullptr;
|
||||
atom->cast_q_data(host_q);
|
||||
//cast_extra_data(host_amtype, host_amgroup, host_rpole, host_uind, host_uinp, host_pval);
|
||||
hd_balancer.start_timer();
|
||||
} else {
|
||||
atom->cast_x_data(host_x,host_type);
|
||||
atom->cast_q_data(host_q);
|
||||
//cast_extra_data(host_amtype, host_amgroup, host_rpole, host_uind, host_uinp, host_pval);
|
||||
hd_balancer.start_timer();
|
||||
atom->add_x_data(host_x,host_type);
|
||||
}
|
||||
@ -444,23 +441,6 @@ int** BaseAmoebaT::compute_multipole_real(const int ago, const int inum_full,
|
||||
const double aewald, const double felec,
|
||||
const double off2_mpole, double *host_q,
|
||||
double *boxlo, double *prd, void **tep_ptr) {
|
||||
/*
|
||||
acc_timers();
|
||||
int eflag, vflag;
|
||||
if (eatom) eflag=2;
|
||||
else if (eflag_in) eflag=1;
|
||||
else eflag=0;
|
||||
if (vatom) vflag=2;
|
||||
else if (vflag_in) vflag=1;
|
||||
else vflag=0;
|
||||
|
||||
#ifdef LAL_NO_BLOCK_REDUCE
|
||||
if (eflag) eflag=2;
|
||||
if (vflag) vflag=2;
|
||||
#endif
|
||||
|
||||
set_kernel(eflag,vflag);
|
||||
*/
|
||||
// reallocate per-atom arrays, transfer data from the host
|
||||
// and build the neighbor lists if needed
|
||||
// NOTE:
|
||||
@ -499,13 +479,7 @@ int** BaseAmoebaT::compute_multipole_real(const int ago, const int inum_full,
|
||||
// copy tep from device to host
|
||||
|
||||
_tep.update_host(_max_tep_size*4,false);
|
||||
/*
|
||||
printf("GPU lib: tep size = %d: max tep size = %d\n", this->_tep.cols(), _max_tep_size);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
numtyp4* p = (numtyp4*)(&this->_tep[4*i]);
|
||||
printf("i = %d; tep = %f %f %f\n", i, p->x, p->y, p->z);
|
||||
}
|
||||
*/
|
||||
|
||||
return firstneigh; // nbor->host_jlist.begin()-host_start;
|
||||
}
|
||||
|
||||
@ -529,36 +503,11 @@ int** BaseAmoebaT::compute_udirect2b(const int ago, const int inum_full,
|
||||
const double aewald, const double off2_polar,
|
||||
double *host_q, double *boxlo, double *prd,
|
||||
void** fieldp_ptr) {
|
||||
/*
|
||||
acc_timers();
|
||||
int eflag, vflag;
|
||||
if (eatom) eflag=2;
|
||||
else if (eflag_in) eflag=1;
|
||||
else eflag=0;
|
||||
if (vatom) vflag=2;
|
||||
else if (vflag_in) vflag=1;
|
||||
else vflag=0;
|
||||
|
||||
#ifdef LAL_NO_BLOCK_REDUCE
|
||||
if (eflag) eflag=2;
|
||||
if (vflag) vflag=2;
|
||||
#endif
|
||||
|
||||
set_kernel(eflag,vflag);
|
||||
*/
|
||||
// reallocate per-atom arrays, transfer data from the host
|
||||
// and build the neighbor lists if needed
|
||||
|
||||
int** firstneigh = nullptr;
|
||||
/*
|
||||
firstneigh = precompute(ago, inum_full, nall, host_x, host_type,
|
||||
host_amtype, host_amgroup, host_rpole,
|
||||
host_uind, host_uinp, nullptr, sublo, subhi, tag,
|
||||
nspecial, special, nspecial15, special15,
|
||||
eflag_in, vflag_in, eatom, vatom,
|
||||
host_start, ilist, jnum, cpu_time,
|
||||
success, host_q, boxlo, prd);
|
||||
*/
|
||||
|
||||
cast_extra_data(host_amtype, host_amgroup, host_rpole, host_uind, host_uinp, host_pval);
|
||||
atom->add_extra_data();
|
||||
|
||||
@ -577,14 +526,7 @@ int** BaseAmoebaT::compute_udirect2b(const int ago, const int inum_full,
|
||||
// copy field and fieldp from device to host (_fieldp store both arrays, one after another)
|
||||
|
||||
_fieldp.update_host(_max_fieldp_size*8,false);
|
||||
/*
|
||||
printf("GPU lib: _fieldp size = %d: max fieldp size = %d\n",
|
||||
this->_fieldp.cols(), _max_fieldp_size);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
numtyp4* p = (numtyp4*)(&this->_fieldp[4*i]);
|
||||
printf("i = %d; field = %f %f %f\n", i, p->x, p->y, p->z);
|
||||
}
|
||||
*/
|
||||
|
||||
return firstneigh; //nbor->host_jlist.begin()-host_start;
|
||||
}
|
||||
|
||||
@ -608,36 +550,11 @@ int** BaseAmoebaT::compute_umutual2b(const int ago, const int inum_full,
|
||||
const double aewald, const double off2_polar,
|
||||
double *host_q, double *boxlo, double *prd,
|
||||
void** fieldp_ptr) {
|
||||
/*
|
||||
acc_timers();
|
||||
int eflag, vflag;
|
||||
if (eatom) eflag=2;
|
||||
else if (eflag_in) eflag=1;
|
||||
else eflag=0;
|
||||
if (vatom) vflag=2;
|
||||
else if (vflag_in) vflag=1;
|
||||
else vflag=0;
|
||||
|
||||
#ifdef LAL_NO_BLOCK_REDUCE
|
||||
if (eflag) eflag=2;
|
||||
if (vflag) vflag=2;
|
||||
#endif
|
||||
|
||||
set_kernel(eflag,vflag);
|
||||
*/
|
||||
// reallocate per-atom arrays, transfer extra data from the host
|
||||
// and build the neighbor lists if needed
|
||||
|
||||
int** firstneigh = nullptr;
|
||||
/*
|
||||
firstneigh = precompute(ago, inum_full, nall, host_x, host_type,
|
||||
host_amtype, host_amgroup, host_rpole,
|
||||
host_uind, host_uinp, nullptr, sublo, subhi, tag,
|
||||
nspecial, special, nspecial15, special15,
|
||||
eflag_in, vflag_in, eatom, vatom,
|
||||
host_start, ilist, jnum, cpu_time,
|
||||
success, host_q, boxlo, prd);
|
||||
*/
|
||||
|
||||
cast_extra_data(host_amtype, host_amgroup, host_rpole, host_uind, host_uinp, host_pval);
|
||||
atom->add_extra_data();
|
||||
|
||||
@ -656,14 +573,7 @@ int** BaseAmoebaT::compute_umutual2b(const int ago, const int inum_full,
|
||||
// copy field and fieldp from device to host (_fieldp store both arrays, one after another)
|
||||
|
||||
_fieldp.update_host(_max_fieldp_size*8,false);
|
||||
/*
|
||||
printf("GPU lib: _fieldp size = %d: max fieldp size = %d\n",
|
||||
this->_fieldp.cols(), _max_fieldp_size);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
numtyp4* p = (numtyp4*)(&this->_fieldp[4*i]);
|
||||
printf("i = %d; field = %f %f %f\n", i, p->x, p->y, p->z);
|
||||
}
|
||||
*/
|
||||
|
||||
return firstneigh; //nbor->host_jlist.begin()-host_start;
|
||||
}
|
||||
|
||||
@ -686,44 +596,9 @@ int** BaseAmoebaT::compute_polar_real(const int ago, const int inum_full,
|
||||
const double aewald, const double felec,
|
||||
const double off2_polar, double *host_q,
|
||||
double *boxlo, double *prd, void **tep_ptr) {
|
||||
/*
|
||||
acc_timers();
|
||||
int eflag, vflag;
|
||||
if (eatom) eflag=2;
|
||||
else if (eflag_in) eflag=1;
|
||||
else eflag=0;
|
||||
if (vatom) vflag=2;
|
||||
else if (vflag_in) vflag=1;
|
||||
else vflag=0;
|
||||
|
||||
#ifdef LAL_NO_BLOCK_REDUCE
|
||||
if (eflag) eflag=2;
|
||||
if (vflag) vflag=2;
|
||||
#endif
|
||||
|
||||
set_kernel(eflag,vflag);
|
||||
*/
|
||||
// reallocate per-atom arrays, transfer data from the host
|
||||
// and build the neighbor lists if needed
|
||||
// NOTE:
|
||||
// For now we invoke precompute() again here,
|
||||
// to be able to turn on/off the udirect2b kernel (which comes before this)
|
||||
// Once all the kernels are ready, precompute() is needed only once
|
||||
// in the first kernel in a time step.
|
||||
// We only need to cast uind and uinp from host to device here
|
||||
// if the neighbor lists are rebuilt and other per-atom arrays
|
||||
// (x, type, amtype, amgroup, rpole) are ready on the device.
|
||||
|
||||
int** firstneigh = nullptr;
|
||||
/*
|
||||
firstneigh = precompute(ago, inum_full, nall, host_x, host_type,
|
||||
host_amtype, host_amgroup, host_rpole,
|
||||
host_uind, host_uinp, nullptr, sublo, subhi, tag,
|
||||
nspecial, special, nspecial15, special15,
|
||||
eflag_in, vflag_in, eatom, vatom,
|
||||
host_start, ilist, jnum, cpu_time,
|
||||
success, host_q, boxlo, prd);
|
||||
*/
|
||||
|
||||
cast_extra_data(host_amtype, host_amgroup, host_rpole, host_uind, host_uinp, host_pval);
|
||||
atom->add_extra_data();
|
||||
|
||||
@ -750,13 +625,7 @@ int** BaseAmoebaT::compute_polar_real(const int ago, const int inum_full,
|
||||
// copy tep from device to host
|
||||
|
||||
_tep.update_host(_max_tep_size*4,false);
|
||||
/*
|
||||
printf("GPU lib: tep size = %d: max tep size = %d\n", this->_tep.cols(), _max_tep_size);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
numtyp4* p = (numtyp4*)(&this->_tep[4*i]);
|
||||
printf("i = %d; tep = %f %f %f\n", i, p->x, p->y, p->z);
|
||||
}
|
||||
*/
|
||||
|
||||
return firstneigh; // nbor->host_jlist.begin()-host_start;
|
||||
}
|
||||
|
||||
@ -826,7 +695,6 @@ void BaseAmoebaT::cast_extra_data(int* amtype, int* amgroup, double** rpole,
|
||||
|
||||
n += nstride*_nall;
|
||||
if (pval) {
|
||||
|
||||
for (int i = 0; i < _nall; i++) {
|
||||
int idx = n+i*nstride;
|
||||
pextra[idx] = pval[i];
|
||||
@ -889,9 +757,9 @@ int BaseAmoebaT::add_onefive_neighbors() {
|
||||
|
||||
k_special15.set_size(GX,BX);
|
||||
k_special15.run(&nbor->dev_nbor, &_nbor_data->begin(),
|
||||
&atom->dev_tag, &dev_nspecial15, &dev_special15,
|
||||
&ainum, &_nall, &nbor_pitch,
|
||||
&_threads_per_atom);
|
||||
&atom->dev_tag, &dev_nspecial15, &dev_special15,
|
||||
&ainum, &_nall, &nbor_pitch,
|
||||
&_threads_per_atom);
|
||||
|
||||
return GX;
|
||||
}
|
||||
|
||||
@ -145,14 +145,14 @@ class BaseAmoeba {
|
||||
/// Compute multipole real-space with device neighboring
|
||||
virtual int** compute_multipole_real(const int ago, const int inum_full, const int nall,
|
||||
double **host_x, int *host_type, int *host_amtype,
|
||||
int *host_amgroup, double **host_rpole, double *host_pval, double *sublo, double *subhi,
|
||||
tagint *tag, int **nspecial, tagint **special,
|
||||
int *nspecial15, tagint **special15,
|
||||
const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **numj, const double cpu_time, bool &success,
|
||||
const double aewald, const double felec, const double off2_mpole, double *charge,
|
||||
double *boxlo, double *prd, void **tep_ptr);
|
||||
int *host_amgroup, double **host_rpole, double *host_pval,
|
||||
double *sublo, double *subhi, tagint *tag,
|
||||
int **nspecial, tagint **special, int *nspecial15, tagint **special15,
|
||||
const bool eflag, const bool vflag, const bool eatom, const bool vatom,
|
||||
int &host_start, int **ilist, int **numj, const double cpu_time,
|
||||
bool &success, const double aewald, const double felec,
|
||||
const double off2_mpole, double *charge, double *boxlo,
|
||||
double *prd, void **tep_ptr);
|
||||
|
||||
/// Compute the real space part of the permanent field (udirect2b) with device neighboring
|
||||
virtual int** compute_udirect2b(const int ago, const int inum_full, const int nall,
|
||||
@ -165,8 +165,8 @@ class BaseAmoeba {
|
||||
const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **numj, const double cpu_time, bool &success,
|
||||
const double aewald, const double off2_polar, double *charge,
|
||||
double *boxlo, double *prd, void **fieldp_ptr);
|
||||
const double aewald, const double off2_polar,
|
||||
double *charge, double *boxlo, double *prd, void **fieldp_ptr);
|
||||
|
||||
/// Compute the real space part of the induced field (umutual2b) with device neighboring
|
||||
virtual int** compute_umutual2b(const int ago, const int inum_full, const int nall,
|
||||
|
||||
@ -48,22 +48,20 @@ int HippoT::bytes_per_atom(const int max_nbors) const {
|
||||
|
||||
template <class numtyp, class acctyp>
|
||||
int HippoT::init(const int ntypes, const int max_amtype, const int max_amclass,
|
||||
const double *host_pdamp, const double *host_thole,
|
||||
const double *host_dirdamp, const int *host_amtype2class,
|
||||
const double *host_special_hal,
|
||||
const double *host_special_repel,
|
||||
const double *host_special_disp,
|
||||
const double *host_special_mpole,
|
||||
const double *host_special_polar_wscale,
|
||||
const double *host_special_polar_piscale,
|
||||
const double *host_special_polar_pscale,
|
||||
const double *host_sizpr, const double *host_dmppr, const double *host_elepr,
|
||||
const double *host_csix, const double *host_adisp,
|
||||
const double *host_pcore, const double *host_palpha,
|
||||
const int nlocal, const int nall, const int max_nbors,
|
||||
const int maxspecial, const int maxspecial15,
|
||||
const double cell_size, const double gpu_split, FILE *_screen,
|
||||
const double polar_dscale, const double polar_uscale) {
|
||||
const double *host_pdamp, const double *host_thole,
|
||||
const double *host_dirdamp, const int *host_amtype2class,
|
||||
const double *host_special_repel, const double *host_special_disp,
|
||||
const double *host_special_mpole,
|
||||
const double *host_special_polar_wscale,
|
||||
const double *host_special_polar_piscale,
|
||||
const double *host_special_polar_pscale,
|
||||
const double *host_sizpr, const double *host_dmppr, const double *host_elepr,
|
||||
const double *host_csix, const double *host_adisp,
|
||||
const double *host_pcore, const double *host_palpha,
|
||||
const int nlocal, const int nall, const int max_nbors,
|
||||
const int maxspecial, const int maxspecial15,
|
||||
const double cell_size, const double gpu_split, FILE *_screen,
|
||||
const double polar_dscale, const double polar_uscale) {
|
||||
int success;
|
||||
success=this->init_atomic(nlocal,nall,max_nbors,maxspecial,maxspecial15,
|
||||
cell_size,gpu_split,_screen,hippo,
|
||||
@ -133,9 +131,9 @@ int HippoT::init(const int ntypes, const int max_amtype, const int max_amclass,
|
||||
|
||||
sp_nonpolar.alloc(5,*(this->ucl_device),UCL_READ_ONLY);
|
||||
for (int i=0; i<5; i++) {
|
||||
dview[i].x=host_special_hal[i];
|
||||
dview[i].y=host_special_repel[i];
|
||||
dview[i].z=host_special_disp[i];
|
||||
dview[i].x=host_special_repel[i];
|
||||
dview[i].y=host_special_disp[i];
|
||||
dview[i].z=(numtyp)0;
|
||||
dview[i].w=(numtyp)0;
|
||||
}
|
||||
ucl_copy(sp_nonpolar,dview,5,false);
|
||||
@ -211,7 +209,7 @@ int** HippoT::compute_repulsion(const int ago, const int inum_full,
|
||||
// to be able to turn on/off the udirect2b kernel (which comes before this)
|
||||
// Once all the kernels are ready, precompute() is needed only once
|
||||
// in the first kernel in a time step.
|
||||
// We only need to cast uind and uinp from host to device here
|
||||
// We only need to cast the necessary from host to device here
|
||||
// if the neighbor lists are rebuilt and other per-atom arrays
|
||||
// (x, type, amtype, amgroup, rpole) are ready on the device.
|
||||
|
||||
@ -240,7 +238,7 @@ int** HippoT::compute_repulsion(const int ago, const int inum_full,
|
||||
_c3 = c3;
|
||||
_c4 = c4;
|
||||
_c5 = c5;
|
||||
const int red_blocks=repulsion(eflag,vflag);
|
||||
const int red_blocks=repulsion(this->_eflag,this->_vflag);
|
||||
|
||||
// only copy them back if this is the last kernel
|
||||
// otherwise, commenting out these two lines to leave the answers
|
||||
@ -316,32 +314,14 @@ int** HippoT::compute_dispersion_real(const int ago, const int inum_full,
|
||||
const double cpu_time, bool &success,
|
||||
const double aewald, const double off2_disp,
|
||||
double *host_q, double *boxlo, double *prd) {
|
||||
this->acc_timers();
|
||||
int eflag, vflag;
|
||||
if (eatom) eflag=2;
|
||||
else if (eflag_in) eflag=1;
|
||||
else eflag=0;
|
||||
if (vatom) vflag=2;
|
||||
else if (vflag_in) vflag=1;
|
||||
else vflag=0;
|
||||
|
||||
#ifdef LAL_NO_BLOCK_REDUCE
|
||||
if (eflag) eflag=2;
|
||||
if (vflag) vflag=2;
|
||||
#endif
|
||||
|
||||
this->set_kernel(eflag,vflag);
|
||||
|
||||
// reallocate per-atom arrays, transfer data from the host
|
||||
// and build the neighbor lists if needed
|
||||
// NOTE:
|
||||
// For now we invoke precompute() again here,
|
||||
// to be able to turn on/off the udirect2b kernel (which comes before this)
|
||||
// Once all the kernels are ready, precompute() is needed only once
|
||||
// in the first kernel in a time step.
|
||||
// We only need to cast uind and uinp from host to device here
|
||||
// if the neighbor lists are rebuilt and other per-atom arrays
|
||||
// (x, type, amtype, amgroup, rpole) are ready on the device.
|
||||
// We only need to cast necesary data arrays from host to device here
|
||||
// because the neighbor lists are rebuilt and other per-atom arrays
|
||||
// (x, type) are ready on the device.
|
||||
|
||||
int** firstneigh = nullptr;
|
||||
firstneigh = this->precompute(ago, inum_full, nall, host_x, host_type,
|
||||
@ -350,11 +330,11 @@ int** HippoT::compute_dispersion_real(const int ago, const int inum_full,
|
||||
nspecial, special, nspecial15, special15,
|
||||
eflag_in, vflag_in, eatom, vatom,
|
||||
host_start, ilist, jnum, cpu_time,
|
||||
success, host_q, boxlo, prd);
|
||||
success, host_q, boxlo, prd);
|
||||
|
||||
this->_off2_disp = off2_disp;
|
||||
this->_aewald = aewald;
|
||||
const int red_blocks=dispersion_real(eflag,vflag);
|
||||
const int red_blocks=dispersion_real(this->_eflag,this->_vflag);
|
||||
|
||||
// only copy them back if this is the last kernel
|
||||
// otherwise, commenting out these two lines to leave the answers
|
||||
@ -427,22 +407,6 @@ int** HippoT::compute_multipole_real(const int ago, const int inum_full,
|
||||
const double aewald, const double felec,
|
||||
const double off2_mpole, double *host_q,
|
||||
double *boxlo, double *prd, void **tep_ptr) {
|
||||
this->acc_timers();
|
||||
int eflag, vflag;
|
||||
if (eatom) eflag=2;
|
||||
else if (eflag_in) eflag=1;
|
||||
else eflag=0;
|
||||
if (vatom) vflag=2;
|
||||
else if (vflag_in) vflag=1;
|
||||
else vflag=0;
|
||||
|
||||
#ifdef LAL_NO_BLOCK_REDUCE
|
||||
if (eflag) eflag=2;
|
||||
if (vflag) vflag=2;
|
||||
#endif
|
||||
|
||||
this->set_kernel(eflag,vflag);
|
||||
|
||||
// reallocate per-atom arrays, transfer data from the host
|
||||
// and build the neighbor lists if needed
|
||||
// NOTE:
|
||||
@ -474,7 +438,7 @@ int** HippoT::compute_multipole_real(const int ago, const int inum_full,
|
||||
this->_off2_mpole = off2_mpole;
|
||||
this->_felec = felec;
|
||||
this->_aewald = aewald;
|
||||
const int red_blocks=multipole_real(eflag,vflag);
|
||||
const int red_blocks=multipole_real(this->_eflag,this->_vflag);
|
||||
|
||||
// leave the answers (forces, energies and virial) on the device,
|
||||
// only copy them back in the last kernel (this one, or polar_real once done)
|
||||
@ -486,13 +450,7 @@ int** HippoT::compute_multipole_real(const int ago, const int inum_full,
|
||||
// copy tep from device to host
|
||||
|
||||
this->_tep.update_host(this->_max_tep_size*4,false);
|
||||
/*
|
||||
printf("GPU lib: tep size = %d: max tep size = %d\n", this->_tep.cols(), _max_tep_size);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
numtyp4* p = (numtyp4*)(&this->_tep[4*i]);
|
||||
printf("i = %d; tep = %f %f %f\n", i, p->x, p->y, p->z);
|
||||
}
|
||||
*/
|
||||
|
||||
return firstneigh; // nbor->host_jlist.begin()-host_start;
|
||||
}
|
||||
|
||||
@ -558,22 +516,6 @@ int** HippoT::compute_udirect2b(const int ago, const int inum_full,
|
||||
const double aewald, const double off2_polar,
|
||||
double *host_q, double *boxlo, double *prd,
|
||||
void** fieldp_ptr) {
|
||||
this->acc_timers();
|
||||
int eflag, vflag;
|
||||
if (eatom) eflag=2;
|
||||
else if (eflag_in) eflag=1;
|
||||
else eflag=0;
|
||||
if (vatom) vflag=2;
|
||||
else if (vflag_in) vflag=1;
|
||||
else vflag=0;
|
||||
|
||||
#ifdef LAL_NO_BLOCK_REDUCE
|
||||
if (eflag) eflag=2;
|
||||
if (vflag) vflag=2;
|
||||
#endif
|
||||
|
||||
this->set_kernel(eflag,vflag);
|
||||
|
||||
// reallocate per-atom arrays, transfer data from the host
|
||||
// and build the neighbor lists if needed
|
||||
|
||||
@ -596,19 +538,12 @@ int** HippoT::compute_udirect2b(const int ago, const int inum_full,
|
||||
|
||||
this->_off2_polar = off2_polar;
|
||||
this->_aewald = aewald;
|
||||
const int red_blocks=udirect2b(eflag,vflag);
|
||||
const int red_blocks=udirect2b(this->_eflag,this->_vflag);
|
||||
|
||||
// copy field and fieldp from device to host (_fieldp store both arrays, one after another)
|
||||
|
||||
this->_fieldp.update_host(this->_max_fieldp_size*8,false);
|
||||
/*
|
||||
printf("GPU lib: _fieldp size = %d: max fieldp size = %d\n",
|
||||
this->_fieldp.cols(), _max_fieldp_size);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
numtyp4* p = (numtyp4*)(&this->_fieldp[4*i]);
|
||||
printf("i = %d; field = %f %f %f\n", i, p->x, p->y, p->z);
|
||||
}
|
||||
*/
|
||||
|
||||
return firstneigh; //nbor->host_jlist.begin()-host_start;
|
||||
}
|
||||
|
||||
@ -673,22 +608,6 @@ int** HippoT::compute_umutual2b(const int ago, const int inum_full,
|
||||
const double aewald, const double off2_polar,
|
||||
double *host_q, double *boxlo, double *prd,
|
||||
void** fieldp_ptr) {
|
||||
this->acc_timers();
|
||||
int eflag, vflag;
|
||||
if (eatom) eflag=2;
|
||||
else if (eflag_in) eflag=1;
|
||||
else eflag=0;
|
||||
if (vatom) vflag=2;
|
||||
else if (vflag_in) vflag=1;
|
||||
else vflag=0;
|
||||
|
||||
#ifdef LAL_NO_BLOCK_REDUCE
|
||||
if (eflag) eflag=2;
|
||||
if (vflag) vflag=2;
|
||||
#endif
|
||||
|
||||
this->set_kernel(eflag,vflag);
|
||||
|
||||
// reallocate per-atom arrays, transfer extra data from the host
|
||||
// and build the neighbor lists if needed
|
||||
|
||||
@ -711,19 +630,12 @@ int** HippoT::compute_umutual2b(const int ago, const int inum_full,
|
||||
|
||||
this->_off2_polar = off2_polar;
|
||||
this->_aewald = aewald;
|
||||
const int red_blocks=umutual2b(eflag,vflag);
|
||||
const int red_blocks=umutual2b(this->_eflag,this->_vflag);
|
||||
|
||||
// copy field and fieldp from device to host (_fieldp store both arrays, one after another)
|
||||
|
||||
this->_fieldp.update_host(this->_max_fieldp_size*8,false);
|
||||
/*
|
||||
printf("GPU lib: _fieldp size = %d: max fieldp size = %d\n",
|
||||
this->_fieldp.cols(), _max_fieldp_size);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
numtyp4* p = (numtyp4*)(&this->_fieldp[4*i]);
|
||||
printf("i = %d; field = %f %f %f\n", i, p->x, p->y, p->z);
|
||||
}
|
||||
*/
|
||||
|
||||
return firstneigh; //nbor->host_jlist.begin()-host_start;
|
||||
}
|
||||
|
||||
@ -786,29 +698,11 @@ int** HippoT::compute_polar_real(const int ago, const int inum_full,
|
||||
const double aewald, const double felec,
|
||||
const double off2_polar, double *host_q,
|
||||
double *boxlo, double *prd, void **tep_ptr) {
|
||||
this->acc_timers();
|
||||
int eflag, vflag;
|
||||
if (eatom) eflag=2;
|
||||
else if (eflag_in) eflag=1;
|
||||
else eflag=0;
|
||||
if (vatom) vflag=2;
|
||||
else if (vflag_in) vflag=1;
|
||||
else vflag=0;
|
||||
|
||||
#ifdef LAL_NO_BLOCK_REDUCE
|
||||
if (eflag) eflag=2;
|
||||
if (vflag) vflag=2;
|
||||
#endif
|
||||
|
||||
this->set_kernel(eflag,vflag);
|
||||
|
||||
// reallocate per-atom arrays, transfer data from the host
|
||||
// and build the neighbor lists if needed
|
||||
// NOTE:
|
||||
// For now we invoke precompute() again here,
|
||||
// to be able to turn on/off the udirect2b kernel (which comes before this)
|
||||
// Once all the kernels are ready, precompute() is needed only once
|
||||
// in the first kernel in a time step.
|
||||
// We only need to cast uind and uinp from host to device here
|
||||
// if the neighbor lists are rebuilt and other per-atom arrays
|
||||
// (x, type, amtype, amgroup, rpole) are ready on the device.
|
||||
@ -833,7 +727,7 @@ int** HippoT::compute_polar_real(const int ago, const int inum_full,
|
||||
this->_off2_polar = off2_polar;
|
||||
this->_felec = felec;
|
||||
this->_aewald = aewald;
|
||||
const int red_blocks=polar_real(eflag,vflag);
|
||||
const int red_blocks=polar_real(this->_eflag,this->_vflag);
|
||||
|
||||
// only copy answers (forces, energies and virial) back from the device
|
||||
// in the last kernel (which is polar_real here)
|
||||
@ -845,13 +739,7 @@ int** HippoT::compute_polar_real(const int ago, const int inum_full,
|
||||
// copy tep from device to host
|
||||
|
||||
this->_tep.update_host(this->_max_tep_size*4,false);
|
||||
/*
|
||||
printf("GPU lib: tep size = %d: max tep size = %d\n", this->_tep.cols(), _max_tep_size);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
numtyp4* p = (numtyp4*)(&this->_tep[4*i]);
|
||||
printf("i = %d; tep = %f %f %f\n", i, p->x, p->y, p->z);
|
||||
}
|
||||
*/
|
||||
|
||||
return firstneigh; // nbor->host_jlist.begin()-host_start;
|
||||
}
|
||||
|
||||
|
||||
@ -520,7 +520,7 @@ __kernel void k_hippo_repulsion(const __global numtyp4 *restrict x_,
|
||||
numtyp valk = coeff_rep[jtype].z; // elepr[jtype];
|
||||
|
||||
const numtyp4 sp_nonpol = sp_nonpolar[sbmask15(jextra)];
|
||||
numtyp factor_repel = sp_nonpol.y; // factor_repel = special_repel[sbmask15(j)];
|
||||
numtyp factor_repel = sp_nonpol.x; // factor_repel = special_repel[sbmask15(j)];
|
||||
if (factor_repel == (numtyp)0) continue;
|
||||
|
||||
// intermediates involving moments and separation distance
|
||||
@ -830,7 +830,7 @@ __kernel void k_hippo_dispersion(const __global numtyp4 *restrict x_,
|
||||
numtyp damp3,damp5;
|
||||
numtyp ddamp;
|
||||
const numtyp4 sp_nonpol = sp_nonpolar[sbmask15(jextra)];
|
||||
numtyp factor_disp = sp_nonpol.z; // factor_disp = special_disp[sbmask15(j)];
|
||||
numtyp factor_disp = sp_nonpol.y; // factor_disp = special_disp[sbmask15(j)];
|
||||
|
||||
if (ai != ak) {
|
||||
ai2 = ai * ai;
|
||||
|
||||
@ -41,7 +41,6 @@ class Hippo : public BaseAmoeba<numtyp, acctyp> {
|
||||
const double *host_pdamp, const double *host_thole,
|
||||
const double *host_dirdamp, const int *host_amtype2class,
|
||||
const double *host_special_mpole,
|
||||
const double *host_special_hal,
|
||||
const double *host_special_repel,
|
||||
const double *host_special_disp,
|
||||
const double *host_special_polar_wscale,
|
||||
|
||||
@ -30,7 +30,6 @@ static Hippo<PRECISION,ACC_PRECISION> HIPPOMF;
|
||||
int hippo_gpu_init(const int ntypes, const int max_amtype, const int max_amclass,
|
||||
const double *host_pdamp, const double *host_thole,
|
||||
const double *host_dirdamp, const int *host_amtype2class,
|
||||
const double *host_special_hal,
|
||||
const double *host_special_repel,
|
||||
const double *host_special_disp,
|
||||
const double *host_special_mpole,
|
||||
@ -71,8 +70,7 @@ int hippo_gpu_init(const int ntypes, const int max_amtype, const int max_amclass
|
||||
if (world_me==0)
|
||||
init_ok=HIPPOMF.init(ntypes, max_amtype, max_amclass,
|
||||
host_pdamp, host_thole, host_dirdamp,
|
||||
host_amtype2class, host_special_hal,
|
||||
host_special_repel, host_special_disp,
|
||||
host_amtype2class, host_special_repel, host_special_disp,
|
||||
host_special_mpole, host_special_polar_wscale,
|
||||
host_special_polar_piscale, host_special_polar_pscale,
|
||||
host_sizpr, host_dmppr, host_elepr,
|
||||
@ -97,8 +95,7 @@ int hippo_gpu_init(const int ntypes, const int max_amtype, const int max_amclass
|
||||
if (gpu_rank==i && world_me!=0)
|
||||
init_ok=HIPPOMF.init(ntypes, max_amtype, max_amclass,
|
||||
host_pdamp, host_thole, host_dirdamp,
|
||||
host_amtype2class, host_special_hal,
|
||||
host_special_repel, host_special_disp,
|
||||
host_amtype2class, host_special_repel, host_special_disp,
|
||||
host_special_mpole, host_special_polar_wscale,
|
||||
host_special_polar_piscale, host_special_polar_pscale,
|
||||
host_sizpr, host_dmppr, host_elepr,
|
||||
|
||||
@ -53,8 +53,8 @@ enum{GORDON1,GORDON2};
|
||||
int hippo_gpu_init(const int ntypes, const int max_amtype, const int max_amclass,
|
||||
const double *host_pdamp, const double *host_thole,
|
||||
const double *host_dirdamp, const int* host_amtype2class,
|
||||
const double *host_special_hal, const double *host_special_repel,
|
||||
const double *host_special_disp, const double *host_special_mpole,
|
||||
const double *host_special_repel, const double *host_special_disp,
|
||||
const double *host_special_mpole,
|
||||
const double *host_special_polar_wscale,
|
||||
const double *host_special_polar_piscale,
|
||||
const double *host_special_polar_pscale,
|
||||
@ -203,7 +203,7 @@ void PairHippoGPU::init_style()
|
||||
int tq_size;
|
||||
int mnf = 5e-2 * neighbor->oneatom;
|
||||
int success = hippo_gpu_init(atom->ntypes+1, max_amtype, max_amclass,
|
||||
pdamp, thole, dirdamp, amtype2class, special_hal,
|
||||
pdamp, thole, dirdamp, amtype2class,
|
||||
special_repel, special_disp, special_mpole,
|
||||
special_polar_wscale, special_polar_piscale,
|
||||
special_polar_pscale, sizpr, dmppr, elepr,
|
||||
|
||||
Reference in New Issue
Block a user