From ca8d1ac2ff54a5826d9acbe175619e14a50673de Mon Sep 17 00:00:00 2001 From: Vsevak Date: Sun, 17 Nov 2019 22:02:56 +0300 Subject: [PATCH] Simplify tip4p GPU memory resize using 'resize_ib' --- lib/gpu/lal_lj_tip4p_long.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/gpu/lal_lj_tip4p_long.cpp b/lib/gpu/lal_lj_tip4p_long.cpp index 9714e9bf91..7e2b8ecc72 100644 --- a/lib/gpu/lal_lj_tip4p_long.cpp +++ b/lib/gpu/lal_lj_tip4p_long.cpp @@ -182,11 +182,12 @@ void LJ_TIP4PLong::loop(const bool _eflag, const bool _vflag) { this->k_pair.set_size(GX,BX); if (vflag){ - this->ansO.resize(ainum*3); + this->ansO.resize_ib(ainum*3); } else { - this->ansO.resize(ainum); + this->ansO.resize_ib(ainum); } this->ansO.zero(); + this->device->gpu->sync(); this->k_pair.run(&this->atom->x, &lj1, &lj3, &_lj_types, &sp_lj, &this->nbor->dev_nbor, &this->_nbor_data->begin(), &this->ans->force, &this->ans->engv, &eflag, &vflag, @@ -210,28 +211,24 @@ void LJ_TIP4PLong::copy_relations_data(int **hn, double **newsit int* tag, int *map_array, int map_size, int *sametag, int max_same, int ago){ int nall = n; const int hn_sz = n*4; // matrix size = col size * col number - if(hn_sz > hneight.cols()){ - hneight.resize(hn_sz+1); - } + hneight.resize_ib(hn_sz+1); if (ago == 0) hneight.zero(); - if(n > m.cols()){ - m.resize(n+1); - } + m.resize_ib(n+1); m.zero(); UCL_H_Vec host_tag_write(nall,*(this->ucl_device),UCL_WRITE_ONLY); - if(this->tag.cols() < nall) this->tag.resize(nall); + this->tag.resize_ib(nall); for(int i=0; itag, host_tag_write, nall, false); if(max_same>host_tag_write.cols()) host_tag_write.resize(max_same); - if(this->atom_sametag.cols() < nall) this->atom_sametag.resize(nall); + this->atom_sametag.resize_ib(nall); for(int i=0; iatom_sametag, host_tag_write, nall, false); if(map_size>host_tag_write.cols()) host_tag_write.resize(map_size); - if(this->map_array.cols() < map_size) this->map_array.resize(map_size); + this->map_array.resize_ib(map_size); for(int i=0; imap_array, host_tag_write, map_size, false);