Cleaned up the changes in Device and the base class of the pair styles
This commit is contained in:
@ -64,15 +64,12 @@ int BaseAtomicT::init_atomic(const int nlocal, const int nall,
|
|||||||
} else
|
} else
|
||||||
_nbor_data=&(nbor->dev_nbor);
|
_nbor_data=&(nbor->dev_nbor);
|
||||||
|
|
||||||
int success=device->init(*ans,false,false,nlocal,host_nlocal,nall,nbor,
|
int success=device->init(*ans,false,false,nlocal,nall,maxspecial);
|
||||||
maxspecial,_gpu_host,max_nbors,cell_size,false,
|
|
||||||
_threads_per_atom);
|
|
||||||
if (success!=0)
|
if (success!=0)
|
||||||
return success;
|
return success;
|
||||||
|
|
||||||
success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,_gpu_host,
|
success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,_gpu_host,
|
||||||
max_nbors,cell_size,false,_threads_per_atom);
|
max_nbors,cell_size,false,_threads_per_atom);
|
||||||
|
|
||||||
if (success!=0)
|
if (success!=0)
|
||||||
return success;
|
return success;
|
||||||
|
|
||||||
|
|||||||
@ -65,15 +65,12 @@ int BaseChargeT::init_atomic(const int nlocal, const int nall,
|
|||||||
} else
|
} else
|
||||||
_nbor_data=&(nbor->dev_nbor);
|
_nbor_data=&(nbor->dev_nbor);
|
||||||
|
|
||||||
int success=device->init(*ans,true,false,nlocal,host_nlocal,nall,nbor,
|
int success=device->init(*ans,true,false,nlocal,nall,maxspecial);
|
||||||
maxspecial,_gpu_host,max_nbors,cell_size,false,
|
|
||||||
_threads_per_atom);
|
|
||||||
if (success!=0)
|
if (success!=0)
|
||||||
return success;
|
return success;
|
||||||
|
|
||||||
success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,_gpu_host,
|
success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,_gpu_host,
|
||||||
max_nbors,cell_size,false,_threads_per_atom);
|
max_nbors,cell_size,false,_threads_per_atom);
|
||||||
|
|
||||||
if (success!=0)
|
if (success!=0)
|
||||||
return success;
|
return success;
|
||||||
|
|
||||||
|
|||||||
@ -66,15 +66,12 @@ int BaseDipoleT::init_atomic(const int nlocal, const int nall,
|
|||||||
} else
|
} else
|
||||||
_nbor_data=&(nbor->dev_nbor);
|
_nbor_data=&(nbor->dev_nbor);
|
||||||
|
|
||||||
int success=device->init(*ans,true,true,nlocal,host_nlocal,nall,nbor,
|
int success=device->init(*ans,true,true,nlocal,nall,maxspecial);
|
||||||
maxspecial,_gpu_host,max_nbors,cell_size,false,
|
|
||||||
_threads_per_atom);
|
|
||||||
if (success!=0)
|
if (success!=0)
|
||||||
return success;
|
return success;
|
||||||
|
|
||||||
success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,_gpu_host,
|
success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,_gpu_host,
|
||||||
max_nbors,cell_size,false,_threads_per_atom);
|
max_nbors,cell_size,false,_threads_per_atom);
|
||||||
|
|
||||||
if (success!=0)
|
if (success!=0)
|
||||||
return success;
|
return success;
|
||||||
|
|
||||||
|
|||||||
@ -65,9 +65,7 @@ int BaseDPDT::init_atomic(const int nlocal, const int nall,
|
|||||||
} else
|
} else
|
||||||
_nbor_data=&(nbor->dev_nbor);
|
_nbor_data=&(nbor->dev_nbor);
|
||||||
|
|
||||||
int success=device->init(*ans,false,false,nlocal,host_nlocal,nall,nbor,
|
int success=device->init(*ans,false,false,nlocal,nall,maxspecial,true);
|
||||||
maxspecial,_gpu_host,max_nbors,cell_size,false,
|
|
||||||
_threads_per_atom,true);
|
|
||||||
if (success!=0)
|
if (success!=0)
|
||||||
return success;
|
return success;
|
||||||
|
|
||||||
|
|||||||
@ -71,12 +71,15 @@ int BaseEllipsoidT::init_base(const int nlocal, const int nall,
|
|||||||
|
|
||||||
_threads_per_atom=device->threads_per_atom();
|
_threads_per_atom=device->threads_per_atom();
|
||||||
|
|
||||||
int success=device->init(*ans,false,true,nlocal,host_nlocal,nall,nbor,
|
int success=device->init(*ans,false,true,nlocal,nall,maxspecial);
|
||||||
maxspecial,_gpu_host,max_nbors,cell_size,true,
|
|
||||||
1);
|
|
||||||
if (success!=0)
|
if (success!=0)
|
||||||
return success;
|
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;
|
ucl_device=device->gpu;
|
||||||
atom=&device->atom;
|
atom=&device->atom;
|
||||||
|
|
||||||
|
|||||||
@ -78,15 +78,12 @@ int BaseThreeT::init_three(const int nlocal, const int nall,
|
|||||||
if (_threads_per_atom*_threads_per_atom>device->warp_size())
|
if (_threads_per_atom*_threads_per_atom>device->warp_size())
|
||||||
return -10;
|
return -10;
|
||||||
|
|
||||||
int success=device->init(*ans,false,false,nlocal,host_nlocal,nall,nbor,
|
int success=device->init(*ans,false,false,nlocal,nall,maxspecial);
|
||||||
maxspecial,_gpu_host,max_nbors,cell_size,false,
|
|
||||||
_threads_per_atom);
|
|
||||||
if (success!=0)
|
if (success!=0)
|
||||||
return success;
|
return success;
|
||||||
|
|
||||||
success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,_gpu_host,
|
success = device->init_nbor(nbor,nlocal,host_nlocal,nall,maxspecial,_gpu_host,
|
||||||
max_nbors,cell_size,false,_threads_per_atom);
|
max_nbors,cell_size,false,_threads_per_atom);
|
||||||
|
|
||||||
if (success!=0)
|
if (success!=0)
|
||||||
return success;
|
return success;
|
||||||
|
|
||||||
|
|||||||
@ -246,11 +246,8 @@ int DeviceT::set_ocl_params(char *ocl_vendor) {
|
|||||||
template <class numtyp, class acctyp>
|
template <class numtyp, class acctyp>
|
||||||
int DeviceT::init(Answer<numtyp,acctyp> &ans, const bool charge,
|
int DeviceT::init(Answer<numtyp,acctyp> &ans, const bool charge,
|
||||||
const bool rot, const int nlocal,
|
const bool rot, const int nlocal,
|
||||||
const int host_nlocal, const int nall,
|
const int nall, const int maxspecial,
|
||||||
Neighbor *nbor, const int maxspecial,
|
const bool vel) {
|
||||||
const int gpu_host, const int max_nbors,
|
|
||||||
const double cell_size, const bool pre_cut,
|
|
||||||
const int threads_per_atom, const bool vel) {
|
|
||||||
if (!_device_init)
|
if (!_device_init)
|
||||||
return -1;
|
return -1;
|
||||||
if (sizeof(acctyp)==sizeof(double) && gpu->double_precision()==false)
|
if (sizeof(acctyp)==sizeof(double) && gpu->double_precision()==false)
|
||||||
|
|||||||
@ -53,8 +53,38 @@ class Device {
|
|||||||
const int t_per_atom, const double cell_size,
|
const int t_per_atom, const double cell_size,
|
||||||
char *vendor_string, const int block_pair);
|
char *vendor_string, const int block_pair);
|
||||||
|
|
||||||
/// Initialize the device for Atom and Neighbor storage
|
/// Initialize the device for Atom storage
|
||||||
/** \param rot True if quaternions need to be stored
|
/** \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<numtyp,acctyp> &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<numtyp,acctyp> &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 nlocal Total number of local particles to allocate memory for
|
||||||
* \param host_nlocal Initial number of host 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
|
* \param nall Total number of local+ghost particles
|
||||||
@ -73,25 +103,6 @@ class Device {
|
|||||||
* - -3 if there is an out of memory error
|
* - -3 if there is an out of memory error
|
||||||
* - -4 if the GPU library was not compiled for GPU
|
* - -4 if the GPU library was not compiled for GPU
|
||||||
* - -5 Double precision is not supported on card **/
|
* - -5 Double precision is not supported on card **/
|
||||||
int init(Answer<numtyp,acctyp> &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<numtyp,acctyp> &ans, const int nlocal, const int nall);
|
|
||||||
|
|
||||||
/// Initialize neighbor list build -- callback function from pair
|
|
||||||
int init_nbor(Neighbor *nbor, const int nlocal,
|
int init_nbor(Neighbor *nbor, const int nlocal,
|
||||||
const int host_nlocal, const int nall,
|
const int host_nlocal, const int nall,
|
||||||
const int maxspecial, const int gpu_host,
|
const int maxspecial, const int gpu_host,
|
||||||
|
|||||||
Reference in New Issue
Block a user