2011-12-03 00:02:36 +08:00
|
|
|
// **************************************************************************
|
|
|
|
// atom.cu
|
|
|
|
// -------------------
|
|
|
|
// W. Michael Brown (ORNL)
|
|
|
|
//
|
|
|
|
// Device code for handling CPU generated neighbor lists
|
|
|
|
//
|
|
|
|
// __________________________________________________________________________
|
|
|
|
// This file is part of the LAMMPS Accelerator Library (LAMMPS_AL)
|
|
|
|
// __________________________________________________________________________
|
|
|
|
//
|
2016-07-02 07:27:26 +08:00
|
|
|
// begin :
|
2011-12-03 00:02:36 +08:00
|
|
|
// email : brownw@ornl.gov
|
|
|
|
// ***************************************************************************/
|
|
|
|
|
|
|
|
#ifdef NV_KERNEL
|
|
|
|
#include "lal_preprocessor.h"
|
|
|
|
#endif
|
|
|
|
|
2016-07-02 07:27:26 +08:00
|
|
|
__kernel void kernel_unpack(__global int *dev_nbor,
|
2012-09-21 23:57:23 +08:00
|
|
|
const __global int *dev_ij,
|
2011-12-03 00:02:36 +08:00
|
|
|
const int inum, const int t_per_atom) {
|
|
|
|
int tid=THREAD_ID_X;
|
|
|
|
int offset=tid & (t_per_atom-1);
|
|
|
|
int ii=fast_mul((int)BLOCK_ID_X,(int)(BLOCK_SIZE_X)/t_per_atom)+tid/t_per_atom;
|
|
|
|
|
|
|
|
if (ii<inum) {
|
2014-10-29 23:47:24 +08:00
|
|
|
int nbor=ii+inum;
|
|
|
|
int numj=dev_nbor[nbor];
|
2011-12-03 00:02:36 +08:00
|
|
|
nbor+=inum;
|
2014-10-29 23:47:24 +08:00
|
|
|
int list=dev_nbor[nbor];
|
|
|
|
int list_end=list+numj;
|
2011-12-03 00:02:36 +08:00
|
|
|
list+=offset;
|
|
|
|
nbor+=fast_mul(ii,t_per_atom-1)+offset;
|
|
|
|
int stride=fast_mul(t_per_atom,inum);
|
2016-07-02 07:27:26 +08:00
|
|
|
|
2011-12-03 00:02:36 +08:00
|
|
|
for ( ; list<list_end; list++) {
|
2014-10-29 23:47:24 +08:00
|
|
|
dev_nbor[nbor]=dev_ij[list];
|
2011-12-03 00:02:36 +08:00
|
|
|
nbor+=stride;
|
|
|
|
}
|
|
|
|
} // if ii
|
|
|
|
}
|
|
|
|
|