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

This commit is contained in:
sjplimp
2012-08-21 13:57:32 +00:00
parent 9a99e27552
commit 31551d81fd
85 changed files with 2630 additions and 2172 deletions

View File

@ -340,6 +340,39 @@ class UCL_D_Vec : public UCL_BaseMat {
inline void clear()
{ if (_kind!=UCL_VIEW) { _cols=0; _kind=UCL_VIEW; _device_free(*this); } }
/// Resize the allocation to contain cols elements
/** \note Cannot be used on views **/
inline int resize(const int cols) {
assert(_kind!=UCL_VIEW);
_row_bytes=cols*sizeof(numtyp);
int err=_device_resize(*this,_row_bytes);
if (err!=UCL_SUCCESS) {
#ifndef UCL_NO_EXIT
std::cerr << "UCL Error: Could not allocate " << _row_bytes
<< " bytes on device.\n";
_row_bytes=0;
UCL_GERYON_EXIT;
#endif
_row_bytes=0;
return err;
}
_cols=cols;
#ifndef _UCL_DEVICE_PTR_MAT
_end=_array+cols;
#endif
#ifdef _OCL_MAT
_offset=0;
#endif
return err;
}
/// Resize (only if bigger) the allocation to contain cols elements
/** \note Cannot be used on views **/
inline int resize_ib(const int cols)
{ if (cols>_cols) return resize(cols); else return UCL_SUCCESS; }
/// Set each element to zero
inline void zero() { _device_zero(*this,row_bytes()); }
@ -353,13 +386,13 @@ class UCL_D_Vec : public UCL_BaseMat {
inline const device_ptr & begin() const { return _array; }
#else
/// For CUDA-RT, get device pointer to first element
inline numtyp * begin() { return _array; }
inline numtyp * & begin() { return _array; }
/// For CUDA-RT, get device pointer to first element
inline const numtyp * begin() const { return _array; }
inline numtyp * const & begin() const { return _array; }
/// For CUDA-RT, get device pointer to one past last element
inline numtyp * end() { return _end; }
/// For CUDA-RT, get device pointer to one past last element
inline const numtyp * end() const { return _end; }
inline numtyp * end() const { return _end; }
#endif
#ifdef _UCL_DEVICE_PTR_MAT