changed names of files, and added a lj12-5 function type.
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
/***************************************************************************
|
||||
lj_sdk.cpp
|
||||
lj_spica.cpp
|
||||
-------------------
|
||||
W. Michael Brown (ORNL)
|
||||
|
||||
Class for acceleration of the lj/sdk/cut pair style
|
||||
Class for acceleration of the lj/spica/cut pair style
|
||||
|
||||
__________________________________________________________________________
|
||||
This file is part of the LAMMPS Accelerator Library (LAMMPS_AL)
|
||||
@ -14,14 +14,14 @@
|
||||
***************************************************************************/
|
||||
|
||||
#if defined(USE_OPENCL)
|
||||
#include "lj_sdk_cl.h"
|
||||
#include "lj_spica_cl.h"
|
||||
#elif defined(USE_CUDART)
|
||||
const char *lj_sdk=0;
|
||||
const char *lj_spica=0;
|
||||
#else
|
||||
#include "lj_sdk_cubin.h"
|
||||
#include "lj_spica_cubin.h"
|
||||
#endif
|
||||
|
||||
#include "lal_lj_sdk.h"
|
||||
#include "lal_lj_spica.h"
|
||||
#include <cassert>
|
||||
namespace LAMMPS_AL {
|
||||
#define CGCMMT CGCMM<numtyp, acctyp>
|
||||
@ -53,33 +53,33 @@ int CGCMMT::init(const int ntypes, double **host_cutsq,
|
||||
const double gpu_split, FILE *_screen) {
|
||||
int success;
|
||||
success=this->init_atomic(nlocal,nall,max_nbors,maxspecial,cell_size,gpu_split,
|
||||
_screen,lj_sdk,"k_lj_sdk");
|
||||
_screen,lj_spica,"k_lj_spica");
|
||||
if (success!=0)
|
||||
return success;
|
||||
|
||||
// If atom type constants fit in shared memory use fast kernel
|
||||
int sdk_types=ntypes;
|
||||
int spica_types=ntypes;
|
||||
shared_types=false;
|
||||
int max_shared_types=this->device->max_shared_types();
|
||||
if (sdk_types<=max_shared_types && this->_block_size>=max_shared_types) {
|
||||
sdk_types=max_shared_types;
|
||||
if (spica_types<=max_shared_types && this->_block_size>=max_shared_types) {
|
||||
spica_types=max_shared_types;
|
||||
shared_types=true;
|
||||
}
|
||||
_sdk_types=sdk_types;
|
||||
_spica_types=spica_types;
|
||||
|
||||
// Allocate a host write buffer for data initialization
|
||||
UCL_H_Vec<numtyp> host_write(sdk_types*sdk_types*32,*(this->ucl_device),
|
||||
UCL_H_Vec<numtyp> host_write(spica_types*spica_types*32,*(this->ucl_device),
|
||||
UCL_WRITE_ONLY);
|
||||
|
||||
for (int i=0; i<sdk_types*sdk_types; i++)
|
||||
for (int i=0; i<spica_types*spica_types; i++)
|
||||
host_write[i]=0.0;
|
||||
|
||||
lj1.alloc(sdk_types*sdk_types,*(this->ucl_device),UCL_READ_ONLY);
|
||||
this->atom->type_pack4(ntypes,sdk_types,lj1,host_write,host_cutsq,
|
||||
lj1.alloc(spica_types*spica_types,*(this->ucl_device),UCL_READ_ONLY);
|
||||
this->atom->type_pack4(ntypes,spica_types,lj1,host_write,host_cutsq,
|
||||
host_cg_type,host_lj1,host_lj2);
|
||||
|
||||
lj3.alloc(sdk_types*sdk_types,*(this->ucl_device),UCL_READ_ONLY);
|
||||
this->atom->type_pack4(ntypes,sdk_types,lj3,host_write,host_lj3,host_lj4,
|
||||
lj3.alloc(spica_types*spica_types,*(this->ucl_device),UCL_READ_ONLY);
|
||||
this->atom->type_pack4(ntypes,spica_types,lj3,host_write,host_lj3,host_lj4,
|
||||
host_offset);
|
||||
|
||||
UCL_H_Vec<double> dview;
|
||||
@ -132,7 +132,7 @@ int CGCMMT::loop(const int eflag, const int vflag) {
|
||||
} else {
|
||||
this->k_pair.set_size(GX,BX);
|
||||
this->k_pair.run(&this->atom->x, &lj1, &lj3,
|
||||
&_sdk_types, &sp_lj, &this->nbor->dev_nbor,
|
||||
&_spica_types, &sp_lj, &this->nbor->dev_nbor,
|
||||
&this->_nbor_data->begin(), &this->ans->force,
|
||||
&this->ans->engv, &eflag, &vflag, &ainum,
|
||||
&nbor_pitch, &this->_threads_per_atom);
|
||||
@ -1,9 +1,9 @@
|
||||
// **************************************************************************
|
||||
// lj_sdk.cu
|
||||
// lj_spica.cu
|
||||
// -------------------
|
||||
// W. Michael Brown (ORNL)
|
||||
//
|
||||
// Device code for acceleration of the lj/sdk pair style
|
||||
// Device code for acceleration of the lj/spica pair style
|
||||
//
|
||||
// __________________________________________________________________________
|
||||
// This file is part of the LAMMPS Accelerator Library (LAMMPS_AL)
|
||||
@ -24,7 +24,7 @@ _texture_2d( pos_tex,int4);
|
||||
#define pos_tex x_
|
||||
#endif
|
||||
|
||||
__kernel void k_lj_sdk(const __global numtyp4 *restrict x_,
|
||||
__kernel void k_lj_spica(const __global numtyp4 *restrict x_,
|
||||
const __global numtyp4 *restrict lj1,
|
||||
const __global numtyp4 *restrict lj3,
|
||||
const int lj_types,
|
||||
@ -91,6 +91,9 @@ __kernel void k_lj_sdk(const __global numtyp4 *restrict x_,
|
||||
} else if (lj1[mtype].y == 1) {
|
||||
inv2=r2inv*ucl_sqrt(r2inv);
|
||||
inv1=inv2*inv2;
|
||||
} else if (lj1[mtype].y == 4) {
|
||||
inv1=r2inv*r2inv*ucl_sqrt(r2inv);
|
||||
inv2=inv1*r2inv;
|
||||
} else {
|
||||
inv1=r2inv*r2inv*r2inv;
|
||||
inv2=inv1;
|
||||
@ -119,7 +122,7 @@ __kernel void k_lj_sdk(const __global numtyp4 *restrict x_,
|
||||
ans,engv);
|
||||
}
|
||||
|
||||
__kernel void k_lj_sdk_fast(const __global numtyp4 *restrict x_,
|
||||
__kernel void k_lj_spica_fast(const __global numtyp4 *restrict x_,
|
||||
const __global numtyp4 *restrict lj1_in,
|
||||
const __global numtyp4 *restrict lj3_in,
|
||||
const __global numtyp *restrict sp_lj_in,
|
||||
@ -192,6 +195,9 @@ __kernel void k_lj_sdk_fast(const __global numtyp4 *restrict x_,
|
||||
} else if (lj1[mtype].y == (numtyp)1) {
|
||||
inv2=r2inv*ucl_sqrt(r2inv);
|
||||
inv1=inv2*inv2;
|
||||
} else if (lj1[mtype].y == (numtyp)4) {
|
||||
inv1=r2inv*r2inv*ucl_sqrt(r2inv);
|
||||
inv2=inv1*r2inv;
|
||||
} else {
|
||||
inv1=r2inv*r2inv*r2inv;
|
||||
inv2=inv1;
|
||||
@ -1,9 +1,9 @@
|
||||
/***************************************************************************
|
||||
lj_sdk.h
|
||||
lj_spica.h
|
||||
-------------------
|
||||
W. Michael Brown (ORNL)
|
||||
|
||||
Class for acceleration of the lj/sdk pair style
|
||||
Class for acceleration of the lj/spica pair style
|
||||
|
||||
__________________________________________________________________________
|
||||
This file is part of the LAMMPS Accelerator Library (LAMMPS_AL)
|
||||
@ -67,7 +67,7 @@ class CGCMM : public BaseAtomic<numtyp, acctyp> {
|
||||
bool shared_types;
|
||||
|
||||
/// Number of atom types
|
||||
int _sdk_types;
|
||||
int _spica_types;
|
||||
|
||||
private:
|
||||
bool _allocated;
|
||||
@ -1,9 +1,9 @@
|
||||
/***************************************************************************
|
||||
lj_sdk.h
|
||||
lj_spica.h
|
||||
-------------------
|
||||
W. Michael Brown (ORNL)
|
||||
|
||||
Functions for LAMMPS access to lj/sdk pair acceleration routines
|
||||
Functions for LAMMPS access to lj/spica pair acceleration routines
|
||||
|
||||
__________________________________________________________________________
|
||||
This file is part of the LAMMPS Accelerator Library (LAMMPS_AL)
|
||||
@ -17,7 +17,7 @@
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
#include "lal_lj_sdk.h"
|
||||
#include "lal_lj_spica.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace LAMMPS_AL;
|
||||
@ -27,7 +27,7 @@ static CGCMM<PRECISION,ACC_PRECISION> CMMMF;
|
||||
// ---------------------------------------------------------------------------
|
||||
// Allocate memory on host and device and copy constants to device
|
||||
// ---------------------------------------------------------------------------
|
||||
int sdk_gpu_init(const int ntypes, double **cutsq, int **cg_types,
|
||||
int spica_gpu_init(const int ntypes, double **cutsq, int **cg_types,
|
||||
double **host_lj1, double **host_lj2, double **host_lj3,
|
||||
double **host_lj4, double **offset, double *special_lj,
|
||||
const int inum, const int nall, const int max_nbors,
|
||||
@ -42,7 +42,7 @@ int sdk_gpu_init(const int ntypes, double **cutsq, int **cg_types,
|
||||
int gpu_rank=CMMMF.device->gpu_rank();
|
||||
int procs_per_gpu=CMMMF.device->procs_per_gpu();
|
||||
|
||||
CMMMF.device->init_message(screen,"lj/sdk",first_gpu,last_gpu);
|
||||
CMMMF.device->init_message(screen,"lj/spica",first_gpu,last_gpu);
|
||||
|
||||
bool message=false;
|
||||
if (CMMMF.device->replica_me()==0 && screen)
|
||||
@ -89,11 +89,11 @@ int sdk_gpu_init(const int ntypes, double **cutsq, int **cg_types,
|
||||
return init_ok;
|
||||
}
|
||||
|
||||
void sdk_gpu_clear() {
|
||||
void spica_gpu_clear() {
|
||||
CMMMF.clear();
|
||||
}
|
||||
|
||||
int** sdk_gpu_compute_n(const int ago, const int inum_full,
|
||||
int** spica_gpu_compute_n(const int ago, const int inum_full,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, tagint *tag, int **nspecial,
|
||||
tagint **special, const bool eflag, const bool vflag,
|
||||
@ -105,7 +105,7 @@ int** sdk_gpu_compute_n(const int ago, const int inum_full,
|
||||
vatom, host_start, ilist, jnum, cpu_time, success);
|
||||
}
|
||||
|
||||
void sdk_gpu_compute(const int ago, const int inum_full, const int nall,
|
||||
void spica_gpu_compute(const int ago, const int inum_full, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
@ -114,7 +114,7 @@ void sdk_gpu_compute(const int ago, const int inum_full, const int nall,
|
||||
firstneigh,eflag,vflag,eatom,vatom,host_start,cpu_time,success);
|
||||
}
|
||||
|
||||
double sdk_gpu_bytes() {
|
||||
double spica_gpu_bytes() {
|
||||
return CMMMF.host_memory_usage();
|
||||
}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
/***************************************************************************
|
||||
lj_sdk_long.cpp
|
||||
lj_spica_long.cpp
|
||||
-------------------
|
||||
W. Michael Brown (ORNL)
|
||||
|
||||
Class for acceleration of the lj/sdk/coul/long pair style
|
||||
Class for acceleration of the lj/spica/coul/long pair style
|
||||
|
||||
__________________________________________________________________________
|
||||
This file is part of the LAMMPS Accelerator Library (LAMMPS_AL)
|
||||
@ -14,14 +14,14 @@
|
||||
***************************************************************************/
|
||||
|
||||
#if defined(USE_OPENCL)
|
||||
#include "lj_sdk_long_cl.h"
|
||||
#include "lj_spica_long_cl.h"
|
||||
#elif defined(USE_CUDART)
|
||||
const char *lj_sdk_long=0;
|
||||
const char *lj_spica_long=0;
|
||||
#else
|
||||
#include "lj_sdk_long_cubin.h"
|
||||
#include "lj_spica_long_cubin.h"
|
||||
#endif
|
||||
|
||||
#include "lal_lj_sdk_long.h"
|
||||
#include "lal_lj_spica_long.h"
|
||||
#include <cassert>
|
||||
namespace LAMMPS_AL {
|
||||
#define CGCMMLongT CGCMMLong<numtyp, acctyp>
|
||||
@ -58,7 +58,7 @@ int CGCMMLongT::init(const int ntypes, double **host_cutsq,
|
||||
const double g_ewald) {
|
||||
int success;
|
||||
success=this->init_atomic(nlocal,nall,max_nbors,maxspecial,cell_size,gpu_split,
|
||||
_screen,lj_sdk_long,"k_lj_sdk_long");
|
||||
_screen,lj_spica_long,"k_lj_spica_long");
|
||||
if (success!=0)
|
||||
return success;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
// **************************************************************************
|
||||
// lj_sdk_long.cu
|
||||
// lj_spica_long.cu
|
||||
// -------------------
|
||||
// W. Michael Brown (ORNL)
|
||||
//
|
||||
// Device code for acceleration of the lj/sdk/coul/long pair style
|
||||
// Device code for acceleration of the lj/spica/coul/long pair style
|
||||
//
|
||||
// __________________________________________________________________________
|
||||
// This file is part of the LAMMPS Accelerator Library (LAMMPS_AL)
|
||||
@ -29,7 +29,7 @@ _texture( q_tex,int2);
|
||||
#define q_tex q_
|
||||
#endif
|
||||
|
||||
__kernel void k_lj_sdk_long(const __global numtyp4 *restrict x_,
|
||||
__kernel void k_lj_spica_long(const __global numtyp4 *restrict x_,
|
||||
const __global numtyp4 *restrict lj1,
|
||||
const __global numtyp4 *restrict lj3,
|
||||
const int lj_types,
|
||||
@ -107,6 +107,9 @@ __kernel void k_lj_sdk_long(const __global numtyp4 *restrict x_,
|
||||
} else if (lj3[mtype].x == (numtyp)1) {
|
||||
inv2=r2inv*ucl_rsqrt(rsq);
|
||||
inv1=inv2*inv2;
|
||||
} else if (lj3[mtype].x == (numtyp)4) {
|
||||
inv1=r2inv*r2inv*ucl_rsqrt(rsq);
|
||||
inv2=inv1*r2inv;
|
||||
} else {
|
||||
inv1=r2inv*r2inv*r2inv;
|
||||
inv2=inv1;
|
||||
@ -157,7 +160,7 @@ __kernel void k_lj_sdk_long(const __global numtyp4 *restrict x_,
|
||||
vflag,ans,engv);
|
||||
}
|
||||
|
||||
__kernel void k_lj_sdk_long_fast(const __global numtyp4 *restrict x_,
|
||||
__kernel void k_lj_spica_long_fast(const __global numtyp4 *restrict x_,
|
||||
const __global numtyp4 *restrict lj1_in,
|
||||
const __global numtyp4 *restrict lj3_in,
|
||||
const __global numtyp *restrict sp_lj_in,
|
||||
@ -236,6 +239,9 @@ __kernel void k_lj_sdk_long_fast(const __global numtyp4 *restrict x_,
|
||||
} else if (lj3[mtype].x == (numtyp)1) {
|
||||
inv2=r2inv*ucl_rsqrt(rsq);
|
||||
inv1=inv2*inv2;
|
||||
} else if (lj3[mtype].x == (numtyp)4) {
|
||||
inv1=r2inv*r2inv*ucl_rsqrt(rsq);
|
||||
inv2=inv1*r2inv;
|
||||
} else {
|
||||
inv1=r2inv*r2inv*r2inv;
|
||||
inv2=inv1;
|
||||
@ -1,9 +1,9 @@
|
||||
/***************************************************************************
|
||||
lj_sdk_long.h
|
||||
lj_spica_long.h
|
||||
-------------------
|
||||
W. Michael Brown (ORNL)
|
||||
|
||||
Class for acceleration of the lj/sdk/coul/long pair style
|
||||
Class for acceleration of the lj/spica/coul/long pair style
|
||||
|
||||
__________________________________________________________________________
|
||||
This file is part of the LAMMPS Accelerator Library (LAMMPS_AL)
|
||||
@ -1,9 +1,9 @@
|
||||
/***************************************************************************
|
||||
lj_sdk_long.h
|
||||
lj_spica_long.h
|
||||
-------------------
|
||||
W. Michael Brown (ORNL)
|
||||
|
||||
Functions for LAMMPS access to lj/sdk/coul/long acceleration functions
|
||||
Functions for LAMMPS access to lj/spica/coul/long acceleration functions
|
||||
|
||||
__________________________________________________________________________
|
||||
This file is part of the LAMMPS Accelerator Library (LAMMPS_AL)
|
||||
@ -17,7 +17,7 @@
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
#include "lal_lj_sdk_long.h"
|
||||
#include "lal_lj_spica_long.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace LAMMPS_AL;
|
||||
@ -27,7 +27,7 @@ static CGCMMLong<PRECISION,ACC_PRECISION> CMMLMF;
|
||||
// ---------------------------------------------------------------------------
|
||||
// Allocate memory on host and device and copy constants to device
|
||||
// ---------------------------------------------------------------------------
|
||||
int sdkl_gpu_init(const int ntypes, double **cutsq, int **cg_type,
|
||||
int spical_gpu_init(const int ntypes, double **cutsq, int **cg_type,
|
||||
double **host_lj1, double **host_lj2, double **host_lj3,
|
||||
double **host_lj4, double **offset, double *special_lj,
|
||||
const int inum, const int nall, const int max_nbors,
|
||||
@ -44,7 +44,7 @@ int sdkl_gpu_init(const int ntypes, double **cutsq, int **cg_type,
|
||||
int gpu_rank=CMMLMF.device->gpu_rank();
|
||||
int procs_per_gpu=CMMLMF.device->procs_per_gpu();
|
||||
|
||||
CMMLMF.device->init_message(screen,"lj/sdk/coul/long",first_gpu,last_gpu);
|
||||
CMMLMF.device->init_message(screen,"lj/spica/coul/long",first_gpu,last_gpu);
|
||||
|
||||
bool message=false;
|
||||
if (CMMLMF.device->replica_me()==0 && screen)
|
||||
@ -93,11 +93,11 @@ int sdkl_gpu_init(const int ntypes, double **cutsq, int **cg_type,
|
||||
return init_ok;
|
||||
}
|
||||
|
||||
void sdkl_gpu_clear() {
|
||||
void spical_gpu_clear() {
|
||||
CMMLMF.clear();
|
||||
}
|
||||
|
||||
int** sdkl_gpu_compute_n(const int ago, const int inum_full,
|
||||
int** spical_gpu_compute_n(const int ago, const int inum_full,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, tagint *tag, int **nspecial,
|
||||
tagint **special, const bool eflag, const bool vflag,
|
||||
@ -111,7 +111,7 @@ int** sdkl_gpu_compute_n(const int ago, const int inum_full,
|
||||
host_q,boxlo,prd);
|
||||
}
|
||||
|
||||
void sdkl_gpu_compute(const int ago, const int inum_full, const int nall,
|
||||
void spical_gpu_compute(const int ago, const int inum_full, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
@ -122,7 +122,7 @@ void sdkl_gpu_compute(const int ago, const int inum_full, const int nall,
|
||||
host_q,nlocal,boxlo,prd);
|
||||
}
|
||||
|
||||
double sdkl_gpu_bytes() {
|
||||
double spical_gpu_bytes() {
|
||||
return CMMLMF.host_memory_usage();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user