Cleaned up unused member functions and hd_balancer calls
This commit is contained in:
@ -270,99 +270,6 @@ inline int BaseAmoebaT::build_nbor_list(const int inum, const int host_inum,
|
|||||||
return mn;
|
return mn;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// Copy nbor list from host if necessary and then calculate forces, virials
|
|
||||||
// for the polar real-space term
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
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,
|
|
||||||
double **host_uind, double **host_uinp,
|
|
||||||
int *ilist, int *numj, int **firstneigh,
|
|
||||||
const bool eflag_in, const bool vflag_in,
|
|
||||||
const bool eatom, const bool vatom,
|
|
||||||
int &host_start, const double cpu_time,
|
|
||||||
bool &success, const double aewald, const double felec,
|
|
||||||
const double off2_polar, double *host_q, const int nlocal,
|
|
||||||
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);
|
|
||||||
|
|
||||||
// ------------------- Resize _tep array ------------------------
|
|
||||||
|
|
||||||
if (nall>_max_tep_size) {
|
|
||||||
_max_tep_size=static_cast<int>(static_cast<double>(nall)*1.10);
|
|
||||||
_tep.resize(_max_tep_size*4);
|
|
||||||
|
|
||||||
dev_nspecial15.clear();
|
|
||||||
dev_special15.clear();
|
|
||||||
dev_special15_t.clear();
|
|
||||||
dev_nspecial15.alloc(nall,*(this->ucl_device),UCL_READ_ONLY);
|
|
||||||
dev_special15.alloc(_maxspecial15*nall,*(this->ucl_device),UCL_READ_ONLY);
|
|
||||||
dev_special15_t.alloc(nall*_maxspecial15,*(this->ucl_device),UCL_READ_ONLY);
|
|
||||||
}
|
|
||||||
|
|
||||||
*tep_ptr=_tep.host.begin();
|
|
||||||
|
|
||||||
if (inum_full==0) {
|
|
||||||
host_start=0;
|
|
||||||
// Make sure textures are correct if realloc by a different hybrid style
|
|
||||||
resize_atom(0,nall,success);
|
|
||||||
zero_timers();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ago=hd_balancer.ago_first(f_ago);
|
|
||||||
int inum=hd_balancer.balance(ago,inum_full,cpu_time);
|
|
||||||
ans->inum(inum);
|
|
||||||
host_start=inum;
|
|
||||||
|
|
||||||
if (ago==0) {
|
|
||||||
reset_nbors(nall, inum, ilist, numj, firstneigh, success);
|
|
||||||
if (!success)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// packing host arrays into host_extra
|
|
||||||
|
|
||||||
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);
|
|
||||||
hd_balancer.start_timer();
|
|
||||||
atom->add_x_data(host_x,host_type);
|
|
||||||
atom->add_q_data();
|
|
||||||
atom->add_extra_data();
|
|
||||||
|
|
||||||
device->precompute(f_ago,nlocal,nall,host_x,host_type,success,host_q,
|
|
||||||
boxlo, prd);
|
|
||||||
|
|
||||||
_off2_polar = off2_polar;
|
|
||||||
_felec = felec;
|
|
||||||
const int red_blocks=polar_real(eflag,vflag);
|
|
||||||
|
|
||||||
ans->copy_answers(eflag_in,vflag_in,eatom,vatom,ilist,red_blocks);
|
|
||||||
device->add_ans_object(ans);
|
|
||||||
hd_balancer.stop_timer();
|
|
||||||
|
|
||||||
// copy tep from device to host
|
|
||||||
|
|
||||||
_tep.update_host(_max_tep_size*4,false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Prepare for multiple kernel calls in a time step:
|
// Prepare for multiple kernel calls in a time step:
|
||||||
// - reallocate per-atom arrays, if needed
|
// - reallocate per-atom arrays, if needed
|
||||||
@ -450,6 +357,8 @@ int** BaseAmoebaT::precompute(const int ago, const int inum_full, const int nall
|
|||||||
dev_short_nbor.resize((2+_max_nbors)*_nmax);
|
dev_short_nbor.resize((2+_max_nbors)*_nmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hd_balancer.stop_timer();
|
||||||
|
|
||||||
return nbor->host_jlist.begin()-host_start;
|
return nbor->host_jlist.begin()-host_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,8 +400,6 @@ void BaseAmoebaT::compute_multipole_real(const int ago, const int inum_full,
|
|||||||
//ans->copy_answers(eflag_in,vflag_in,eatom,vatom,red_blocks);
|
//ans->copy_answers(eflag_in,vflag_in,eatom,vatom,red_blocks);
|
||||||
//device->add_ans_object(ans);
|
//device->add_ans_object(ans);
|
||||||
|
|
||||||
hd_balancer.stop_timer();
|
|
||||||
|
|
||||||
// copy tep from device to host
|
// copy tep from device to host
|
||||||
|
|
||||||
_tep.update_host(_max_tep_size*4,false);
|
_tep.update_host(_max_tep_size*4,false);
|
||||||
@ -828,7 +735,7 @@ void BaseAmoebaT::compute_polar_real(int *host_amtype, int *host_amgroup,
|
|||||||
const double aewald, const double felec,
|
const double aewald, const double felec,
|
||||||
const double off2_polar, void **tep_ptr) {
|
const double off2_polar, void **tep_ptr) {
|
||||||
|
|
||||||
int** firstneigh = nullptr;
|
// cast necessary data arrays from host to device
|
||||||
|
|
||||||
cast_extra_data(host_amtype, host_amgroup, host_rpole, host_uind, host_uinp, host_pval);
|
cast_extra_data(host_amtype, host_amgroup, host_rpole, host_uind, host_uinp, host_pval);
|
||||||
atom->add_extra_data();
|
atom->add_extra_data();
|
||||||
@ -845,10 +752,7 @@ void BaseAmoebaT::compute_polar_real(int *host_amtype, int *host_amgroup,
|
|||||||
ans->copy_answers(eflag_in,vflag_in,eatom,vatom,red_blocks);
|
ans->copy_answers(eflag_in,vflag_in,eatom,vatom,red_blocks);
|
||||||
device->add_ans_object(ans);
|
device->add_ans_object(ans);
|
||||||
|
|
||||||
hd_balancer.stop_timer();
|
|
||||||
|
|
||||||
// copy tep from device to host
|
// copy tep from device to host
|
||||||
|
|
||||||
_tep.update_host(_max_tep_size*4,false);
|
_tep.update_host(_max_tep_size*4,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -182,11 +182,12 @@ class BaseAmoeba {
|
|||||||
const int nzlo_out, const int nzhi_out,
|
const int nzlo_out, const int nzhi_out,
|
||||||
const int nylo_out, const int nyhi_out,
|
const int nylo_out, const int nyhi_out,
|
||||||
const int nxlo_out, const int nxhi_out);
|
const int nxlo_out, const int nxhi_out);
|
||||||
|
/// Interpolate the induced potential from the grid
|
||||||
virtual void compute_fphi_uind(double ****host_grid_brick,
|
virtual void compute_fphi_uind(double ****host_grid_brick,
|
||||||
void **host_fdip_phi1, void **host_fdip_phi2,
|
void **host_fdip_phi1, void **host_fdip_phi2,
|
||||||
void **host_fdip_sum_phi);
|
void **host_fdip_sum_phi);
|
||||||
|
|
||||||
|
/// Interpolate the multipolar potential from the grid
|
||||||
virtual void compute_fphi_mpole(double ***host_grid_brick, void **host_fphi,
|
virtual void compute_fphi_mpole(double ***host_grid_brick, void **host_fphi,
|
||||||
const double felec);
|
const double felec);
|
||||||
|
|
||||||
@ -198,17 +199,6 @@ class BaseAmoeba {
|
|||||||
const double aewald, const double felec, const double off2_polar,
|
const double aewald, const double felec, const double off2_polar,
|
||||||
void **tep_ptr);
|
void **tep_ptr);
|
||||||
|
|
||||||
/// Compute polar real-space with host neighboring (not active for now)
|
|
||||||
void 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, double **host_uind,
|
|
||||||
double **host_uinp, int *ilist, int *numj,
|
|
||||||
int **firstneigh, const bool eflag, const bool vflag,
|
|
||||||
const bool eatom, const bool vatom, int &host_start,
|
|
||||||
const double cpu_time, bool &success, const double aewald, const double felec,
|
|
||||||
const double off2_polar, double *charge, const int nlocal, double *boxlo,
|
|
||||||
double *prd, void **tep_ptr);
|
|
||||||
|
|
||||||
// copy field and fieldp from device to host after umutual2b
|
// copy field and fieldp from device to host after umutual2b
|
||||||
virtual void update_fieldp(void **fieldp_ptr) {
|
virtual void update_fieldp(void **fieldp_ptr) {
|
||||||
*fieldp_ptr=_fieldp.host.begin();
|
*fieldp_ptr=_fieldp.host.begin();
|
||||||
|
|||||||
@ -177,20 +177,20 @@ double HippoT::host_memory_usage() const {
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template <class numtyp, class acctyp>
|
template <class numtyp, class acctyp>
|
||||||
void HippoT::compute_repulsion(const int ago, const int inum_full,
|
void HippoT::compute_repulsion(const int ago, const int inum_full,
|
||||||
const int nall, double **host_x,
|
const int nall, double **host_x,
|
||||||
int *host_type, int *host_amtype,
|
int *host_type, int *host_amtype,
|
||||||
int *host_amgroup, double **host_rpole,
|
int *host_amgroup, double **host_rpole,
|
||||||
double *sublo, double *subhi, tagint *tag,
|
double *sublo, double *subhi, tagint *tag,
|
||||||
int **nspecial, tagint **special,
|
int **nspecial, tagint **special,
|
||||||
int *nspecial15, tagint **special15,
|
int *nspecial15, tagint **special15,
|
||||||
const bool eflag_in, const bool vflag_in,
|
const bool eflag_in, const bool vflag_in,
|
||||||
const bool eatom, const bool vatom,
|
const bool eatom, const bool vatom,
|
||||||
int &host_start, int **ilist, int **jnum,
|
int &host_start, int **ilist, int **jnum,
|
||||||
const double cpu_time, bool &success,
|
const double cpu_time, bool &success,
|
||||||
const double aewald, const double off2_repulse,
|
const double aewald, const double off2_repulse,
|
||||||
double *host_q, double *boxlo, double *prd,
|
double *host_q, double *boxlo, double *prd,
|
||||||
double cut2, double c0, double c1, double c2,
|
double cut2, double c0, double c1, double c2,
|
||||||
double c3, double c4, double c5, void **tep_ptr) {
|
double c3, double c4, double c5, void **tep_ptr) {
|
||||||
this->acc_timers();
|
this->acc_timers();
|
||||||
int eflag, vflag;
|
int eflag, vflag;
|
||||||
if (eatom) eflag=2;
|
if (eatom) eflag=2;
|
||||||
@ -225,16 +225,7 @@ void HippoT::compute_repulsion(const int ago, const int inum_full,
|
|||||||
_c5 = c5;
|
_c5 = c5;
|
||||||
const int red_blocks=repulsion(this->_eflag,this->_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
|
|
||||||
// (forces, energies and virial) on the device until the last kernel
|
|
||||||
//this->ans->copy_answers(eflag_in,vflag_in,eatom,vatom,red_blocks);
|
|
||||||
//this->device->add_ans_object(this->ans);
|
|
||||||
|
|
||||||
this->hd_balancer.stop_timer();
|
|
||||||
|
|
||||||
// copy tep from device to host
|
// copy tep from device to host
|
||||||
|
|
||||||
this->_tep.update_host(this->_max_tep_size*4,false);
|
this->_tep.update_host(this->_max_tep_size*4,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,8 +294,6 @@ void HippoT::compute_dispersion_real(int *host_amtype, int *host_amgroup,
|
|||||||
// (forces, energies and virial) on the device until the last kernel
|
// (forces, energies and virial) on the device until the last kernel
|
||||||
//this->ans->copy_answers(eflag_in,vflag_in,eatom,vatom,red_blocks);
|
//this->ans->copy_answers(eflag_in,vflag_in,eatom,vatom,red_blocks);
|
||||||
//this->device->add_ans_object(this->ans);
|
//this->device->add_ans_object(this->ans);
|
||||||
|
|
||||||
this->hd_balancer.stop_timer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@ -386,15 +375,7 @@ void HippoT::compute_multipole_real(const int ago, const int inum_full,
|
|||||||
this->_aewald = aewald;
|
this->_aewald = aewald;
|
||||||
const int red_blocks=multipole_real(this->_eflag,this->_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)
|
|
||||||
//this->ans->copy_answers(eflag_in,vflag_in,eatom,vatom,red_blocks);
|
|
||||||
//this->device->add_ans_object(this->ans);
|
|
||||||
|
|
||||||
this->hd_balancer.stop_timer();
|
|
||||||
|
|
||||||
// copy tep from device to host
|
// copy tep from device to host
|
||||||
|
|
||||||
this->_tep.update_host(this->_max_tep_size*4,false);
|
this->_tep.update_host(this->_max_tep_size*4,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -595,14 +576,11 @@ void HippoT::compute_polar_real(int *host_amtype, int *host_amgroup, double **ho
|
|||||||
const int red_blocks=polar_real(this->_eflag,this->_vflag);
|
const int red_blocks=polar_real(this->_eflag,this->_vflag);
|
||||||
|
|
||||||
// only copy answers (forces, energies and virial) back from the device
|
// only copy answers (forces, energies and virial) back from the device
|
||||||
// in the last kernel (which is polar_real here)
|
// in the last kernel in a timestep (which is polar_real here)
|
||||||
this->ans->copy_answers(eflag_in,vflag_in,eatom,vatom,red_blocks);
|
this->ans->copy_answers(eflag_in,vflag_in,eatom,vatom,red_blocks);
|
||||||
this->device->add_ans_object(this->ans);
|
this->device->add_ans_object(this->ans);
|
||||||
|
|
||||||
this->hd_balancer.stop_timer();
|
|
||||||
|
|
||||||
// copy tep from device to host
|
// copy tep from device to host
|
||||||
|
|
||||||
this->_tep.update_host(this->_max_tep_size*4,false);
|
this->_tep.update_host(this->_max_tep_size*4,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -69,15 +69,15 @@ int hippo_gpu_init(const int ntypes, const int max_amtype, const int max_amclass
|
|||||||
int init_ok=0;
|
int init_ok=0;
|
||||||
if (world_me==0)
|
if (world_me==0)
|
||||||
init_ok=HIPPOMF.init(ntypes, max_amtype, max_amclass,
|
init_ok=HIPPOMF.init(ntypes, max_amtype, max_amclass,
|
||||||
host_pdamp, host_thole, host_dirdamp,
|
host_pdamp, host_thole, host_dirdamp,
|
||||||
host_amtype2class, host_special_repel, host_special_disp,
|
host_amtype2class, host_special_repel, host_special_disp,
|
||||||
host_special_mpole, host_special_polar_wscale,
|
host_special_mpole, host_special_polar_wscale,
|
||||||
host_special_polar_piscale, host_special_polar_pscale,
|
host_special_polar_piscale, host_special_polar_pscale,
|
||||||
host_sizpr, host_dmppr, host_elepr,
|
host_sizpr, host_dmppr, host_elepr,
|
||||||
host_csix, host_adisp, host_pcore, host_palpha,
|
host_csix, host_adisp, host_pcore, host_palpha,
|
||||||
nlocal, nall, max_nbors,
|
nlocal, nall, max_nbors,
|
||||||
maxspecial, maxspecial15, cell_size, gpu_split,
|
maxspecial, maxspecial15, cell_size, gpu_split,
|
||||||
screen, polar_dscale, polar_uscale);
|
screen, polar_dscale, polar_uscale);
|
||||||
|
|
||||||
HIPPOMF.device->world_barrier();
|
HIPPOMF.device->world_barrier();
|
||||||
if (message)
|
if (message)
|
||||||
@ -94,15 +94,15 @@ int hippo_gpu_init(const int ntypes, const int max_amtype, const int max_amclass
|
|||||||
}
|
}
|
||||||
if (gpu_rank==i && world_me!=0)
|
if (gpu_rank==i && world_me!=0)
|
||||||
init_ok=HIPPOMF.init(ntypes, max_amtype, max_amclass,
|
init_ok=HIPPOMF.init(ntypes, max_amtype, max_amclass,
|
||||||
host_pdamp, host_thole, host_dirdamp,
|
host_pdamp, host_thole, host_dirdamp,
|
||||||
host_amtype2class, host_special_repel, host_special_disp,
|
host_amtype2class, host_special_repel, host_special_disp,
|
||||||
host_special_mpole, host_special_polar_wscale,
|
host_special_mpole, host_special_polar_wscale,
|
||||||
host_special_polar_piscale, host_special_polar_pscale,
|
host_special_polar_piscale, host_special_polar_pscale,
|
||||||
host_sizpr, host_dmppr, host_elepr,
|
host_sizpr, host_dmppr, host_elepr,
|
||||||
host_csix, host_adisp, host_pcore, host_palpha,
|
host_csix, host_adisp, host_pcore, host_palpha,
|
||||||
nlocal, nall, max_nbors,
|
nlocal, nall, max_nbors,
|
||||||
maxspecial, maxspecial15, cell_size, gpu_split,
|
maxspecial, maxspecial15, cell_size, gpu_split,
|
||||||
screen, polar_dscale, polar_uscale);
|
screen, polar_dscale, polar_uscale);
|
||||||
|
|
||||||
HIPPOMF.device->gpu_barrier();
|
HIPPOMF.device->gpu_barrier();
|
||||||
if (message)
|
if (message)
|
||||||
@ -121,16 +121,16 @@ void hippo_gpu_clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int** hippo_gpu_precompute(const int ago, const int inum_full, const int nall,
|
int** hippo_gpu_precompute(const int ago, const int inum_full, const int nall,
|
||||||
double **host_x, int *host_type, int *host_amtype,
|
double **host_x, int *host_type, int *host_amtype,
|
||||||
int *host_amgroup, double **host_rpole,
|
int *host_amgroup, double **host_rpole,
|
||||||
double **host_uind, double **host_uinp, double *host_pval,
|
double **host_uind, double **host_uinp, double *host_pval,
|
||||||
double *sublo, double *subhi, tagint *tag,
|
double *sublo, double *subhi, tagint *tag,
|
||||||
int **nspecial, tagint **special,
|
int **nspecial, tagint **special,
|
||||||
int *nspecial15, tagint **special15,
|
int *nspecial15, tagint **special15,
|
||||||
const bool eflag_in, const bool vflag_in,
|
const bool eflag_in, const bool vflag_in,
|
||||||
const bool eatom, const bool vatom, int &host_start,
|
const bool eatom, const bool vatom, int &host_start,
|
||||||
int **ilist, int **jnum, const double cpu_time,
|
int **ilist, int **jnum, const double cpu_time,
|
||||||
bool &success, double *host_q, double *boxlo, double *prd) {
|
bool &success, double *host_q, double *boxlo, double *prd) {
|
||||||
return HIPPOMF.precompute(ago, inum_full, nall, host_x, host_type,
|
return HIPPOMF.precompute(ago, inum_full, nall, host_x, host_type,
|
||||||
host_amtype, host_amgroup, host_rpole,
|
host_amtype, host_amgroup, host_rpole,
|
||||||
nullptr, nullptr, nullptr, sublo, subhi, tag,
|
nullptr, nullptr, nullptr, sublo, subhi, tag,
|
||||||
@ -141,17 +141,17 @@ int** hippo_gpu_precompute(const int ago, const int inum_full, const int nall,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void hippo_gpu_compute_repulsion(const int ago, const int inum_full,
|
void hippo_gpu_compute_repulsion(const int ago, const int inum_full,
|
||||||
const int nall, double **host_x, int *host_type,
|
const int nall, double **host_x, int *host_type,
|
||||||
int *host_amtype, int *host_amgroup, double **host_rpole,
|
int *host_amtype, int *host_amgroup, double **host_rpole,
|
||||||
double *sublo, double *subhi, tagint *tag, int **nspecial,
|
double *sublo, double *subhi, tagint *tag, int **nspecial,
|
||||||
tagint **special, int *nspecial15, tagint** special15,
|
tagint **special, int *nspecial15, tagint** special15,
|
||||||
const bool eflag, const bool vflag, const bool eatom,
|
const bool eflag, const bool vflag, const bool eatom,
|
||||||
const bool vatom, int &host_start,
|
const bool vatom, int &host_start,
|
||||||
int **ilist, int **jnum, const double cpu_time,
|
int **ilist, int **jnum, const double cpu_time,
|
||||||
bool &success, const double aewald, const double off2,
|
bool &success, const double aewald, const double off2,
|
||||||
double *host_q, double *boxlo, double *prd,
|
double *host_q, double *boxlo, double *prd,
|
||||||
double cut2, double c0, double c1, double c2,
|
double cut2, double c0, double c1, double c2,
|
||||||
double c3, double c4, double c5, void **tep_ptr) {
|
double c3, double c4, double c5, void **tep_ptr) {
|
||||||
HIPPOMF.compute_repulsion(ago, inum_full, nall, host_x, host_type,
|
HIPPOMF.compute_repulsion(ago, inum_full, nall, host_x, host_type,
|
||||||
host_amtype, host_amgroup, host_rpole, sublo, subhi,
|
host_amtype, host_amgroup, host_rpole, sublo, subhi,
|
||||||
tag, nspecial, special, nspecial15, special15,
|
tag, nspecial, special, nspecial15, special15,
|
||||||
|
|||||||
Reference in New Issue
Block a user