Update stubbed force calculation
Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
parent
77a0774208
commit
706f1c38f2
@ -6,4 +6,4 @@ DATA_TYPE ?= DP
|
||||
DATA_LAYOUT ?= SOA
|
||||
|
||||
#Feature options
|
||||
OPTIONS += -DALIGNMENT=64
|
||||
OPTIONS += -DALIGNMENT=64 -DLIKWID_PERFMON
|
||||
|
@ -11,5 +11,7 @@ CFLAGS = -O3 -march=znver1 -ffast-math -funroll-loops # -fopenmp
|
||||
ASFLAGS = -masm=intel
|
||||
LFLAGS =
|
||||
DEFINES = -D_GNU_SOURCE
|
||||
INCLUDES =
|
||||
LIBS = -lm
|
||||
#INCLUDES =
|
||||
#LIBS = -lm
|
||||
INCLUDES = $(LIKWID_INC)
|
||||
LIBS = -lm $(LIKWID_LIB) -llikwid
|
||||
|
@ -31,7 +31,8 @@ double computeForce(
|
||||
Parameter *param,
|
||||
Atom *atom,
|
||||
Neighbor *neighbor,
|
||||
int profile)
|
||||
int profile,
|
||||
int ntimes)
|
||||
{
|
||||
int Nlocal = atom->Nlocal;
|
||||
int* neighs;
|
||||
@ -52,6 +53,7 @@ double computeForce(
|
||||
LIKWID_MARKER_START("force");
|
||||
}
|
||||
|
||||
for(int t = 0; t < ntimes; t++) {
|
||||
#pragma omp parallel for
|
||||
for(int i = 0; i < Nlocal; i++) {
|
||||
neighs = &neighbor->neighbors[i * neighbor->maxneighs];
|
||||
@ -85,6 +87,7 @@ double computeForce(
|
||||
fy[i] += fiy;
|
||||
fz[i] += fiz;
|
||||
}
|
||||
}
|
||||
|
||||
if(profile) {
|
||||
LIKWID_MARKER_STOP("force");
|
||||
|
@ -47,7 +47,7 @@ typedef enum {
|
||||
NUMTIMER
|
||||
} timertype;
|
||||
|
||||
extern double computeForce( Parameter*, Atom*, Neighbor*, int);
|
||||
extern double computeForce( Parameter*, Atom*, Neighbor*, int, int);
|
||||
|
||||
void init(Parameter *param)
|
||||
{
|
||||
@ -205,7 +205,7 @@ int main (int argc, char** argv)
|
||||
|
||||
setup(¶m, &atom, &neighbor);
|
||||
computeThermo(0, ¶m, &atom);
|
||||
computeForce(¶m, &atom, &neighbor, 1);
|
||||
computeForce(¶m, &atom, &neighbor, 1, 1);
|
||||
|
||||
timer[FORCE] = 0.0;
|
||||
timer[NEIGH] = 0.0;
|
||||
@ -221,7 +221,7 @@ int main (int argc, char** argv)
|
||||
timer[NEIGH] += reneighbour(¶m, &atom, &neighbor);
|
||||
}
|
||||
|
||||
timer[FORCE] += computeForce(¶m, &atom, &neighbor, 1);
|
||||
timer[FORCE] += computeForce(¶m, &atom, &neighbor, 1, 1);
|
||||
finalIntegrate(¶m, &atom);
|
||||
|
||||
if(!((n + 1) % param.nstat) && (n+1) < param.ntimes) {
|
||||
|
14
src/stub.c
14
src/stub.c
@ -16,7 +16,7 @@
|
||||
#define LATTICE_DISTANCE 10.0
|
||||
#define NEIGH_DISTANCE 1.0
|
||||
|
||||
extern double computeForce( Parameter*, Atom*, Neighbor*, int);
|
||||
extern double computeForce( Parameter*, Atom*, Neighbor*, int, int);
|
||||
|
||||
void init(Parameter *param) {
|
||||
param->epsilon = 1.0;
|
||||
@ -103,7 +103,7 @@ int main(int argc, const char *argv[]) {
|
||||
initAtom(atom);
|
||||
|
||||
DEBUG("Creating atoms...\n");
|
||||
const int atoms_per_unit_cell = 16;
|
||||
const int atoms_per_unit_cell = 8;
|
||||
|
||||
for(int i = 0; i < param.nx; ++i) {
|
||||
for(int j = 0; j < param.ny; ++j) {
|
||||
@ -158,7 +158,7 @@ int main(int argc, const char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
const double estim_volume = (double)(atom->Nlocal * 6 * sizeof(MD_FLOAT) + (atoms_per_unit_cell - 1 + 2) * sizeof(int)) / 1000.0;
|
||||
const double estim_volume = (double)(atom->Nlocal * 6 * sizeof(MD_FLOAT) + atom->Nlocal * (atoms_per_unit_cell - 1 + 2) * sizeof(int)) / 1000.0;
|
||||
printf("System size (unit cells): %dx%dx%d\n", param.nx, param.ny, param.nz);
|
||||
printf("Atoms per unit cell: %d\n", atoms_per_unit_cell);
|
||||
printf("Total number of atoms: %d\n", atom->Nlocal);
|
||||
@ -171,13 +171,9 @@ int main(int argc, const char *argv[]) {
|
||||
DEBUG("Building neighbor lists...\n");
|
||||
buildNeighbor(atom, &neighbor);
|
||||
DEBUG("Computing forces...\n");
|
||||
computeForce(¶m, atom, &neighbor, 0);
|
||||
|
||||
double T_accum = 0.0;
|
||||
for(int i = 0; i < param.ntimes; i++) {
|
||||
T_accum += computeForce(¶m, atom, &neighbor, 1);
|
||||
}
|
||||
computeForce(¶m, atom, &neighbor, 0, 1);
|
||||
|
||||
double T_accum = computeForce(¶m, atom, &neighbor, 1, param.ntimes);
|
||||
printf("Total time: %.4f, Time/force: %.4f\n", T_accum, T_accum / param.ntimes);
|
||||
LIKWID_MARKER_CLOSE;
|
||||
return EXIT_SUCCESS;
|
||||
|
Loading…
Reference in New Issue
Block a user