Attempted to reduce the memory footprint of the per-atom arrays

This commit is contained in:
Trung Nguyen
2021-09-11 11:22:17 -05:00
parent c765861851
commit 94d6f7219c
2 changed files with 12 additions and 8 deletions

View File

@ -103,7 +103,8 @@ int BaseAmoebaT::init_atomic(const int nlocal, const int nall,
bool alloc_packed=false;
success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,
_gpu_host,max_nbors,cell_size,alloc_packed,_threads_per_atom);
_gpu_host,max_nbors,cell_size,alloc_packed,
_threads_per_atom);
if (success!=0)
return success;
@ -123,7 +124,7 @@ int BaseAmoebaT::init_atomic(const int nlocal, const int nall,
// allocate per-atom array tep
int ef_nall=nall;
int ef_nall=nlocal; //nall;
if (ef_nall==0)
ef_nall=2000;
@ -413,8 +414,8 @@ int** BaseAmoebaT::precompute(const int ago, const int inum_full, const int nall
boxlo, prd);
// re-allocate dev_short_nbor if necessary
if (nall*(2+_max_nbors) > dev_short_nbor.cols()) {
int _nmax=static_cast<int>(static_cast<double>(nall)*1.10);
if (inum_full*(2+_max_nbors) > dev_short_nbor.cols()) {
int _nmax=static_cast<int>(static_cast<double>(inum_full)*1.10);
dev_short_nbor.resize((2+_max_nbors)*_nmax);
}
@ -468,8 +469,8 @@ int** BaseAmoebaT::compute_udirect2b(const int ago, const int inum_full, const i
// ------------------- Resize _fieldp array ------------------------
if (nall>_max_fieldp_size) {
_max_fieldp_size=static_cast<int>(static_cast<double>(nall)*1.10);
if (inum_full>_max_fieldp_size) {
_max_fieldp_size=static_cast<int>(static_cast<double>(inum_full)*1.10);
_fieldp.resize(_max_fieldp_size*8);
}
*fieldp_ptr=_fieldp.host.begin();
@ -537,8 +538,8 @@ int** BaseAmoebaT::compute_umutual2b(const int ago, const int inum_full, const i
// ------------------- Resize _fieldp array ------------------------
if (nall>_max_fieldp_size) {
_max_fieldp_size=static_cast<int>(static_cast<double>(nall)*1.10);
if (inum_full>_max_fieldp_size) {
_max_fieldp_size=static_cast<int>(static_cast<double>(inum_full)*1.10);
_fieldp.resize(_max_fieldp_size*8);
}
*fieldp_ptr=_fieldp.host.begin();