git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@15248 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2016-07-01 23:27:26 +00:00
parent 8366b35459
commit 9656958169
245 changed files with 4890 additions and 4832 deletions

View File

@ -9,7 +9,7 @@
This file is part of the LAMMPS Accelerator Library (LAMMPS_AL)
__________________________________________________________________________
begin :
begin :
email : brownw@ornl.gov
***************************************************************************/
@ -57,19 +57,19 @@ class Atom {
/// Set number of local+ghost atoms for future copy operations
inline void nall(const int n) { _nall=n; }
/// Memory usage per atom in this class
int bytes_per_atom() const;
int bytes_per_atom() const;
/// Clear any previous data and set up for a new LAMMPS run
/** \param rot True if atom storage needs quaternions
* \param gpu_nbor 0 if neighboring will be performed on host
* gpu_nbor 1 if neighboring will be performed on device
* gpu_nbor 2 if binning on host and neighboring on device **/
bool init(const int nall, const bool charge, const bool rot,
UCL_Device &dev, const int gpu_nbor=0, const bool bonds=false,
bool init(const int nall, const bool charge, const bool rot,
UCL_Device &dev, const int gpu_nbor=0, const bool bonds=false,
const bool vel=false);
/// Check if we have enough device storage and realloc if not
/** Returns true if resized with any call during this timestep **/
inline bool resize(const int nall, bool &success) {
@ -81,7 +81,7 @@ class Atom {
}
return _resized;
}
/// If already initialized by another LAMMPS style, add fields as necessary
/** \param rot True if atom storage needs quaternions
* \param gpu_nbor 0 if neighboring will be performed on host
@ -89,28 +89,28 @@ class Atom {
* gpu_nbor 2 if binning on host and neighboring on device **/
bool add_fields(const bool charge, const bool rot, const int gpu_nbor,
const bool bonds, const bool vel=false);
/// Returns true if GPU is using charges
bool charge() { return _charge; }
/// Returns true if GPU is using quaternions
bool quaternion() { return _rot; }
/// Returns true if GPU is using velocities
bool velocity() { return _vel; }
/// Only free matrices of length inum or nall for resizing
void clear_resize();
/// Free all memory on host and device
void clear();
/// Return the total amount of host memory used by class in bytes
double host_memory_usage() const;
/// Sort arrays for neighbor list calculation on device
void sort_neighbor(const int num_atoms);
/// Add copy times to timers
inline void acc_timers() {
time_pos.add_to_total();
@ -150,18 +150,18 @@ class Atom {
total+=time_vel.total_seconds();
time_vel.zero_total();
}
return total+_time_transfer/1000.0;
}
/// Return the total time for data cast/pack
/** Zeros the time so that atom times are only included once **/
inline double cast_time()
inline double cast_time()
{ double t=_time_cast; _time_cast=0.0; return t; }
/// Pack LAMMPS atom type constants into matrix and copy to device
template <class dev_typ, class t1>
inline void type_pack1(const int n, const int m_size,
inline void type_pack1(const int n, const int m_size,
UCL_D_Vec<dev_typ> &dev_v, UCL_H_Vec<numtyp> &buffer,
t1 **one) {
int ii=0;
@ -215,7 +215,7 @@ class Atom {
view.view((dev_typ*)buffer.begin(),m_size*m_size,*dev);
ucl_copy(dev_v,view,false);
}
/// Pack LAMMPS atom type constants (4) into 4 vectors and copy to device
template <class dev_typ, class t1, class t2, class t3, class t4>
inline void type_pack4(const int n, const int m_size,
@ -239,7 +239,7 @@ class Atom {
/// Pack LAMMPS atom "self" type constants into 2 vectors and copy to device
template <class dev_typ, class t1, class t2>
inline void self_pack2(const int n, UCL_D_Vec<dev_typ> &dev_v,
inline void self_pack2(const int n, UCL_D_Vec<dev_typ> &dev_v,
UCL_H_Vec<numtyp> &buffer, t1 **one, t2 **two) {
for (int i=0; i<n; i++) {
buffer[i*2]=static_cast<numtyp>(one[i][i]);
@ -279,7 +279,7 @@ class Atom {
/// Copy positions and types to device asynchronously
/** Copies nall() elements **/
inline void add_x_data(double **host_ptr, int *host_type) {
inline void add_x_data(double **host_ptr, int *host_type) {
time_pos.start();
if (_x_avail==false) {
#ifdef GPU_CAST
@ -376,7 +376,7 @@ class Atom {
/// Copy velocities and tags to device asynchronously
/** Copies nall() elements **/
inline void add_v_data(double **host_ptr, tagint *host_tag) {
inline void add_v_data(double **host_ptr, tagint *host_tag) {
time_vel.start();
if (_v_avail==false) {
#ifdef GPU_CAST
@ -407,8 +407,8 @@ class Atom {
inline void add_transfer_time(double t) { _time_transfer+=t; }
/// Return number of bytes used on device
inline double max_gpu_bytes()
{ double m=_max_gpu_bytes; _max_gpu_bytes=0.0; return m; }
inline double max_gpu_bytes()
{ double m=_max_gpu_bytes; _max_gpu_bytes=0.0; return m; }
/// Returns true if the device is addressing memory on the host
inline bool host_view() { return _host_view; }
@ -422,7 +422,7 @@ class Atom {
/// Quaterions
UCL_Vector<numtyp,numtyp> quat;
/// Velocities
UCL_Vector<numtyp,numtyp> v;
UCL_Vector<numtyp,numtyp> v;
#ifdef GPU_CAST
UCL_Vector<double,double> x_cast;
@ -436,7 +436,7 @@ class Atom {
/// Atom tag information for device nbor builds
UCL_D_Vec<tagint> dev_tag;
/// Cell list identifiers for hybrid nbor builds
UCL_H_Vec<int> host_cell_id;
/// Cell list identifiers for hybrid nbor builds
@ -444,7 +444,7 @@ class Atom {
/// Device timers
UCL_Timer time_pos, time_q, time_quat, time_vel;
/// Geryon device
UCL_Device *dev;
@ -456,19 +456,19 @@ class Atom {
#endif
bool _compiled;
// True if data has been copied to device already
bool _x_avail, _q_avail, _quat_avail, _v_avail, _resized;
bool alloc(const int nall);
bool _allocated, _rot, _charge, _bonds, _vel, _other;
int _max_atoms, _nall, _gpu_nbor;
bool _host_view;
double _time_cast, _time_transfer;
double _max_gpu_bytes;
#ifdef USE_CUDPP
CUDPPConfiguration sort_config;
CUDPPHandle sort_plan;