diff --git a/lib/gpu/lal_base_atomic.cpp b/lib/gpu/lal_base_atomic.cpp index 3d47df8a92..da54f1dca3 100644 --- a/lib/gpu/lal_base_atomic.cpp +++ b/lib/gpu/lal_base_atomic.cpp @@ -64,15 +64,12 @@ int BaseAtomicT::init_atomic(const int nlocal, const int nall, } else _nbor_data=&(nbor->dev_nbor); - int success=device->init(*ans,false,false,nlocal,host_nlocal,nall,nbor, - maxspecial,_gpu_host,max_nbors,cell_size,false, - _threads_per_atom); + int success=device->init(*ans,false,false,nlocal,nall,maxspecial); if (success!=0) return success; success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,_gpu_host, max_nbors,cell_size,false,_threads_per_atom); - if (success!=0) return success; diff --git a/lib/gpu/lal_base_charge.cpp b/lib/gpu/lal_base_charge.cpp index 94e7502c55..a3ec710baa 100644 --- a/lib/gpu/lal_base_charge.cpp +++ b/lib/gpu/lal_base_charge.cpp @@ -65,15 +65,12 @@ int BaseChargeT::init_atomic(const int nlocal, const int nall, } else _nbor_data=&(nbor->dev_nbor); - int success=device->init(*ans,true,false,nlocal,host_nlocal,nall,nbor, - maxspecial,_gpu_host,max_nbors,cell_size,false, - _threads_per_atom); + int success=device->init(*ans,true,false,nlocal,nall,maxspecial); if (success!=0) return success; success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,_gpu_host, max_nbors,cell_size,false,_threads_per_atom); - if (success!=0) return success; diff --git a/lib/gpu/lal_base_dipole.cpp b/lib/gpu/lal_base_dipole.cpp index b2a41f10cf..9fc7e1b235 100644 --- a/lib/gpu/lal_base_dipole.cpp +++ b/lib/gpu/lal_base_dipole.cpp @@ -66,15 +66,12 @@ int BaseDipoleT::init_atomic(const int nlocal, const int nall, } else _nbor_data=&(nbor->dev_nbor); - int success=device->init(*ans,true,true,nlocal,host_nlocal,nall,nbor, - maxspecial,_gpu_host,max_nbors,cell_size,false, - _threads_per_atom); + int success=device->init(*ans,true,true,nlocal,nall,maxspecial); if (success!=0) return success; success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,_gpu_host, max_nbors,cell_size,false,_threads_per_atom); - if (success!=0) return success; diff --git a/lib/gpu/lal_base_dpd.cpp b/lib/gpu/lal_base_dpd.cpp index 3f71c820c7..eb5c2088a6 100644 --- a/lib/gpu/lal_base_dpd.cpp +++ b/lib/gpu/lal_base_dpd.cpp @@ -65,9 +65,7 @@ int BaseDPDT::init_atomic(const int nlocal, const int nall, } else _nbor_data=&(nbor->dev_nbor); - int success=device->init(*ans,false,false,nlocal,host_nlocal,nall,nbor, - maxspecial,_gpu_host,max_nbors,cell_size,false, - _threads_per_atom,true); + int success=device->init(*ans,false,false,nlocal,nall,maxspecial,true); if (success!=0) return success; diff --git a/lib/gpu/lal_base_ellipsoid.cpp b/lib/gpu/lal_base_ellipsoid.cpp index 8918a3140c..eea5344e33 100644 --- a/lib/gpu/lal_base_ellipsoid.cpp +++ b/lib/gpu/lal_base_ellipsoid.cpp @@ -71,12 +71,15 @@ int BaseEllipsoidT::init_base(const int nlocal, const int nall, _threads_per_atom=device->threads_per_atom(); - int success=device->init(*ans,false,true,nlocal,host_nlocal,nall,nbor, - maxspecial,_gpu_host,max_nbors,cell_size,true, - 1); + int success=device->init(*ans,false,true,nlocal,nall,maxspecial); if (success!=0) return success; + success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,_gpu_host, + max_nbors,cell_size,true,1); + if (success!=0) + return success; + ucl_device=device->gpu; atom=&device->atom; diff --git a/lib/gpu/lal_base_three.cpp b/lib/gpu/lal_base_three.cpp index ba28d697cc..0510b84d92 100644 --- a/lib/gpu/lal_base_three.cpp +++ b/lib/gpu/lal_base_three.cpp @@ -78,15 +78,12 @@ int BaseThreeT::init_three(const int nlocal, const int nall, if (_threads_per_atom*_threads_per_atom>device->warp_size()) return -10; - int success=device->init(*ans,false,false,nlocal,host_nlocal,nall,nbor, - maxspecial,_gpu_host,max_nbors,cell_size,false, - _threads_per_atom); + int success=device->init(*ans,false,false,nlocal,nall,maxspecial); if (success!=0) return success; success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,_gpu_host, max_nbors,cell_size,false,_threads_per_atom); - if (success!=0) return success; diff --git a/lib/gpu/lal_device.cpp b/lib/gpu/lal_device.cpp index 411e19a78a..3b7f393056 100644 --- a/lib/gpu/lal_device.cpp +++ b/lib/gpu/lal_device.cpp @@ -246,11 +246,8 @@ int DeviceT::set_ocl_params(char *ocl_vendor) { template int DeviceT::init(Answer &ans, const bool charge, const bool rot, const int nlocal, - const int host_nlocal, const int nall, - Neighbor *nbor, const int maxspecial, - const int gpu_host, const int max_nbors, - const double cell_size, const bool pre_cut, - const int threads_per_atom, const bool vel) { + const int nall, const int maxspecial, + const bool vel) { if (!_device_init) return -1; if (sizeof(acctyp)==sizeof(double) && gpu->double_precision()==false) diff --git a/lib/gpu/lal_device.h b/lib/gpu/lal_device.h index 68d88a3182..4287967210 100644 --- a/lib/gpu/lal_device.h +++ b/lib/gpu/lal_device.h @@ -53,8 +53,38 @@ class Device { const int t_per_atom, const double cell_size, char *vendor_string, const int block_pair); - /// Initialize the device for Atom and Neighbor storage - /** \param rot True if quaternions need to be stored + /// Initialize the device for Atom storage + /** \param charge True if charges need to be stored + * \param rot True if quaternions need to be stored + * \param nlocal Total number of local particles to allocate memory for + * \param host_nlocal Initial number of host particles to allocate memory for + * \param nall Total number of local+ghost particles + * + * Returns: + * - 0 if successfull + * - -1 if fix gpu not found + * - -3 if there is an out of memory error + * - -4 if the GPU library was not compiled for GPU + * - -5 Double precision is not supported on card **/ + int init(Answer &a, const bool charge, const bool rot, + const int nlocal, const int nall, const int maxspecial, + const bool vel=false); + + /// Initialize the device for Atom storage only + /** \param nlocal Total number of local particles to allocate memory for + * \param nall Total number of local+ghost particles + * + * Returns: + * - 0 if successfull + * - -1 if fix gpu not found + * - -3 if there is an out of memory error + * - -4 if the GPU library was not compiled for GPU + * - -5 Double precision is not supported on card **/ + int init(Answer &ans, const int nlocal, const int nall); + + /// Initialize neighbor list storage and build + /** \param charge True if charges need to be stored + * \param rot True if quaternions need to be stored * \param nlocal Total number of local particles to allocate memory for * \param host_nlocal Initial number of host particles to allocate memory for * \param nall Total number of local+ghost particles @@ -73,25 +103,6 @@ class Device { * - -3 if there is an out of memory error * - -4 if the GPU library was not compiled for GPU * - -5 Double precision is not supported on card **/ - int init(Answer &a, const bool charge, const bool rot, - const int nlocal, const int host_nlocal, const int nall, - Neighbor *nbor, const int maxspecial, const int gpu_host, - const int max_nbors, const double cell_size, const bool pre_cut, - const int threads_per_atom, const bool vel=false); - - /// Initialize the device for Atom storage only - /** \param nlocal Total number of local particles to allocate memory for - * \param nall Total number of local+ghost particles - * - * Returns: - * - 0 if successfull - * - -1 if fix gpu not found - * - -3 if there is an out of memory error - * - -4 if the GPU library was not compiled for GPU - * - -5 Double precision is not supported on card **/ - int init(Answer &ans, const int nlocal, const int nall); - - /// Initialize neighbor list build -- callback function from pair int init_nbor(Neighbor *nbor, const int nlocal, const int host_nlocal, const int nall, const int maxspecial, const int gpu_host,