Fix stubbed variant for LAMMPS algorithm
Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
parent
ab2eb1ff50
commit
14838389ff
@ -20,9 +20,19 @@
|
|||||||
#define LATTICE_DISTANCE 10.0
|
#define LATTICE_DISTANCE 10.0
|
||||||
#define NEIGH_DISTANCE 1.0
|
#define NEIGH_DISTANCE 1.0
|
||||||
|
|
||||||
extern double computeForceLJ(Parameter*, Atom*, Neighbor*, Stats*);
|
extern double computeForceLJFullNeigh_plain_c(Parameter*, Atom*, Neighbor*, Stats*);
|
||||||
|
extern double computeForceLJFullNeigh_simd(Parameter*, Atom*, Neighbor*, Stats*);
|
||||||
|
extern double computeForceLJHalfNeigh(Parameter*, Atom*, Neighbor*, Stats*);
|
||||||
extern double computeForceEam(Eam*, Parameter*, Atom*, Neighbor*, Stats*);
|
extern double computeForceEam(Eam*, Parameter*, Atom*, Neighbor*, Stats*);
|
||||||
|
|
||||||
|
#ifdef USE_SIMD_KERNEL
|
||||||
|
# define KERNEL_NAME "SIMD"
|
||||||
|
# define computeForceLJFullNeigh computeForceLJFullNeigh_simd
|
||||||
|
#else
|
||||||
|
# define KERNEL_NAME "plain-C"
|
||||||
|
# define computeForceLJFullNeigh computeForceLJFullNeigh_plain_c
|
||||||
|
#endif
|
||||||
|
|
||||||
void init(Parameter *param) {
|
void init(Parameter *param) {
|
||||||
param->input_file = NULL;
|
param->input_file = NULL;
|
||||||
param->epsilon = 1.0;
|
param->epsilon = 1.0;
|
||||||
@ -42,7 +52,7 @@ void init(Parameter *param) {
|
|||||||
param->dtforce = 0.5 * param->dt;
|
param->dtforce = 0.5 * param->dt;
|
||||||
param->nstat = 100;
|
param->nstat = 100;
|
||||||
param->temp = 1.44;
|
param->temp = 1.44;
|
||||||
param->every = 20;
|
param->reneigh_every = 20;
|
||||||
param->proc_freq = 2.4;
|
param->proc_freq = 2.4;
|
||||||
param->eam_file = NULL;
|
param->eam_file = NULL;
|
||||||
}
|
}
|
||||||
@ -235,13 +245,15 @@ int main(int argc, const char *argv[]) {
|
|||||||
if(param.force_field == FF_EAM) {
|
if(param.force_field == FF_EAM) {
|
||||||
computeForceEam(&eam, ¶m, atom, &neighbor, &stats);
|
computeForceEam(&eam, ¶m, atom, &neighbor, &stats);
|
||||||
} else {
|
} else {
|
||||||
computeForceLJ(¶m, atom, &neighbor, &stats);
|
if(param.half_neigh) {
|
||||||
|
computeForceLJHalfNeigh(¶m, atom, &neighbor, &stats);
|
||||||
|
} else {
|
||||||
|
computeForceLJFullNeigh(¶m, atom, &neighbor, &stats);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double S, E;
|
double T_accum = 0.0;
|
||||||
S = getTimeStamp();
|
|
||||||
for(int i = 0; i < param.ntimes; i++) {
|
for(int i = 0; i < param.ntimes; i++) {
|
||||||
|
|
||||||
#if defined(MEM_TRACER) || defined(INDEX_TRACER)
|
#if defined(MEM_TRACER) || defined(INDEX_TRACER)
|
||||||
traceAddresses(¶m, atom, &neighbor, i + 1);
|
traceAddresses(¶m, atom, &neighbor, i + 1);
|
||||||
#endif
|
#endif
|
||||||
@ -249,11 +261,14 @@ int main(int argc, const char *argv[]) {
|
|||||||
if(param.force_field == FF_EAM) {
|
if(param.force_field == FF_EAM) {
|
||||||
computeForceEam(&eam, ¶m, atom, &neighbor, &stats);
|
computeForceEam(&eam, ¶m, atom, &neighbor, &stats);
|
||||||
} else {
|
} else {
|
||||||
computeForceLJ(¶m, atom, &neighbor, &stats);
|
if(param.half_neigh) {
|
||||||
|
T_accum += computeForceLJHalfNeigh(¶m, atom, &neighbor, &stats);
|
||||||
|
} else {
|
||||||
|
T_accum += computeForceLJFullNeigh(¶m, atom, &neighbor, &stats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
E = getTimeStamp();
|
}
|
||||||
double T_accum = E-S;
|
|
||||||
double freq_hz = param.proc_freq * 1.e9;
|
double freq_hz = param.proc_freq * 1.e9;
|
||||||
const double atoms_updates_per_sec = (double)(atom->Nlocal) / T_accum * (double)(param.ntimes);
|
const double atoms_updates_per_sec = (double)(atom->Nlocal) / T_accum * (double)(param.ntimes);
|
||||||
const double cycles_per_atom = T_accum / (double)(atom->Nlocal) / (double)(param.ntimes) * freq_hz;
|
const double cycles_per_atom = T_accum / (double)(atom->Nlocal) / (double)(param.ntimes) * freq_hz;
|
||||||
|
Loading…
Reference in New Issue
Block a user