2020-08-11 16:34:22 +02:00
|
|
|
/*
|
2022-09-05 10:39:42 +02:00
|
|
|
* Copyright (C) 2022 NHR@FAU, University Erlangen-Nuremberg.
|
|
|
|
* All rights reserved. This file is part of MD-Bench.
|
|
|
|
* Use of this source code is governed by a LGPL-3.0
|
|
|
|
* license that can be found in the LICENSE file.
|
2020-08-11 16:34:22 +02:00
|
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <float.h>
|
2020-11-05 12:41:44 +01:00
|
|
|
#include <likwid-marker.h>
|
2020-08-18 14:27:28 +02:00
|
|
|
#include <allocate.h>
|
|
|
|
#include <atom.h>
|
2022-08-12 18:12:29 +02:00
|
|
|
#include <device.h>
|
|
|
|
#include <eam.h>
|
|
|
|
#include <integrate.h>
|
2020-08-18 14:27:28 +02:00
|
|
|
#include <thermo.h>
|
2022-08-12 18:12:29 +02:00
|
|
|
#include <timing.h>
|
|
|
|
#include <neighbor.h>
|
|
|
|
#include <parameter.h>
|
|
|
|
#include <stats.h>
|
2021-10-12 22:39:54 +02:00
|
|
|
#include <timers.h>
|
2021-12-01 00:07:45 +01:00
|
|
|
#include <util.h>
|
2022-08-12 18:12:29 +02:00
|
|
|
#include <vtk.h>
|
2024-04-15 16:53:25 +02:00
|
|
|
#include <comm.h>
|
|
|
|
#include <grid.h>
|
|
|
|
#include <shell_methods.h>
|
|
|
|
#include <mpi.h>
|
2020-08-18 14:27:28 +02:00
|
|
|
|
2020-08-11 16:34:22 +02:00
|
|
|
#define HLINE "----------------------------------------------------------------------------\n"
|
2024-04-15 16:53:25 +02:00
|
|
|
#ifdef CUDA_TARGET
|
|
|
|
extern double computeForceLJFullNeigh_cuda(Parameter*, Atom*, Neighbor*);
|
|
|
|
#endif
|
2020-08-11 16:34:22 +02:00
|
|
|
|
2022-04-05 02:57:23 +02:00
|
|
|
extern double computeForceLJFullNeigh_plain_c(Parameter*, Atom*, Neighbor*, Stats*);
|
|
|
|
extern double computeForceLJFullNeigh_simd(Parameter*, Atom*, Neighbor*, Stats*);
|
2022-03-10 16:30:37 +01:00
|
|
|
extern double computeForceLJHalfNeigh(Parameter*, Atom*, Neighbor*, Stats*);
|
2021-12-01 00:07:45 +01:00
|
|
|
extern double computeForceEam(Eam*, Parameter*, Atom*, Neighbor*, Stats*);
|
2022-07-07 00:47:38 +02:00
|
|
|
extern double computeForceDemFullNeigh(Parameter*, Atom*, Neighbor*, Stats*);
|
2020-08-14 08:32:36 +02:00
|
|
|
|
2024-04-15 16:53:25 +02:00
|
|
|
double computeForce(Eam *eam, Parameter *param, Atom *atom, Neighbor *neighbor, Stats *stats) {
|
|
|
|
if(param->force_field == FF_EAM) {
|
|
|
|
return computeForceEam(eam, param, atom, neighbor, stats);
|
|
|
|
} else if(param->force_field == FF_DEM) {
|
|
|
|
if(param->half_neigh) {
|
|
|
|
fprintf(stderr, "Error: DEM cannot use half neighbor-lists!\n");
|
|
|
|
return 0.0;
|
|
|
|
} else {
|
|
|
|
return computeForceDemFullNeigh(param, atom, neighbor, stats);
|
|
|
|
}
|
|
|
|
}
|
2022-04-05 02:57:23 +02:00
|
|
|
|
2024-04-15 16:53:25 +02:00
|
|
|
if(param->half_neigh || param->method) {
|
|
|
|
return computeForceLJHalfNeigh(param, atom, neighbor, stats);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CUDA_TARGET
|
|
|
|
return computeForceLJFullNeigh(param, atom, neighbor);
|
|
|
|
#else
|
|
|
|
return computeForceLJFullNeigh(param, atom, neighbor, stats);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
double dynamicBalance(Comm* comm, Grid* grid, Atom* atom, Parameter* param, double time){
|
|
|
|
double S, E;
|
|
|
|
int dims = 3; //TODO: Adjust to do in 3d and 2d
|
|
|
|
S = getTimeStamp();
|
|
|
|
if(param->balance == RCB) {
|
|
|
|
rcbBalance(grid, atom, param, meanBisect,dims,0);
|
|
|
|
neighComm(comm, param, grid);
|
|
|
|
}else if(param->balance == meanTimeRCB){
|
|
|
|
rcbBalance(grid, atom, param, meanTimeBisect,dims,time);
|
|
|
|
neighComm(comm, param, grid);
|
|
|
|
}else if(param->balance == Staggered) {
|
|
|
|
staggeredBalance(grid, atom, param, time);
|
|
|
|
neighComm(comm, param, grid);
|
|
|
|
exchangeComm(comm,atom);
|
|
|
|
}else { } //Do nothing
|
|
|
|
//printGrid(grid);
|
|
|
|
E = getTimeStamp();
|
|
|
|
|
|
|
|
return E-S;
|
|
|
|
}
|
|
|
|
|
|
|
|
double initialBalance(Parameter *param, Eam *eam, Atom *atom, Neighbor *neighbor, Stats *stats, Comm *comm, Grid *grid)
|
|
|
|
{
|
|
|
|
double E,S,time;
|
|
|
|
int me;
|
|
|
|
MPI_Comm_rank(world,&me);
|
|
|
|
S = getTimeStamp();
|
|
|
|
if(param->balance == meanTimeRCB || param->balance == RCB){
|
|
|
|
rcbBalance(grid, atom, param, meanBisect,3,0);
|
|
|
|
neighComm(comm, param, grid);
|
|
|
|
}
|
|
|
|
MPI_Allreduce(&atom->Nlocal, &atom->Natoms, 1, MPI_INT, MPI_SUM, world);
|
|
|
|
printf("Processor:%i, Local atoms:%i, Total atoms:%i\n",me, atom->Nlocal,atom->Natoms);
|
|
|
|
MPI_Barrier(world);
|
|
|
|
E = getTimeStamp();
|
|
|
|
return E-S;
|
|
|
|
}
|
|
|
|
|
|
|
|
double setup(Parameter *param, Eam *eam, Atom *atom, Neighbor *neighbor, Stats *stats, Comm *comm, Grid *grid) {
|
2021-10-29 16:52:19 +02:00
|
|
|
if(param->force_field == FF_EAM) { initEam(eam, param); }
|
2020-08-19 09:22:43 +02:00
|
|
|
double S, E;
|
2021-03-30 01:54:56 +02:00
|
|
|
param->lattice = pow((4.0 / param->rho), (1.0 / 3.0));
|
|
|
|
param->xprd = param->nx * param->lattice;
|
|
|
|
param->yprd = param->ny * param->lattice;
|
|
|
|
param->zprd = param->nz * param->lattice;
|
2020-08-19 09:22:43 +02:00
|
|
|
S = getTimeStamp();
|
2020-08-19 09:00:35 +02:00
|
|
|
initAtom(atom);
|
2021-10-12 15:04:08 +02:00
|
|
|
initStats(stats);
|
2021-11-30 01:33:55 +01:00
|
|
|
initNeighbor(neighbor, param);
|
|
|
|
if(param->input_file == NULL) {
|
|
|
|
createAtom(atom, param);
|
|
|
|
} else {
|
|
|
|
readAtom(atom, param);
|
|
|
|
}
|
2024-04-15 16:53:25 +02:00
|
|
|
setupGrid(grid,atom,param);
|
2021-11-30 01:33:55 +01:00
|
|
|
setupNeighbor(param);
|
2024-04-15 16:53:25 +02:00
|
|
|
setupComm(comm, param, grid);
|
|
|
|
if(param->balance){
|
|
|
|
initialBalance(param, eam, atom, neighbor, stats, comm, grid);
|
|
|
|
}
|
2020-08-19 09:00:35 +02:00
|
|
|
setupThermo(param, atom->Natoms);
|
2021-11-30 01:33:55 +01:00
|
|
|
if(param->input_file == NULL) { adjustThermo(param, atom); }
|
2023-04-09 01:19:12 +02:00
|
|
|
#ifdef SORT_ATOMS
|
|
|
|
atom->Nghost = 0;
|
|
|
|
sortAtom(atom);
|
|
|
|
#endif
|
2022-08-12 18:12:29 +02:00
|
|
|
initDevice(atom, neighbor);
|
2024-04-15 16:53:25 +02:00
|
|
|
ghostNeighbor(comm, atom, param);
|
2022-08-12 17:28:06 +02:00
|
|
|
buildNeighbor(atom, neighbor);
|
2020-08-19 09:22:43 +02:00
|
|
|
E = getTimeStamp();
|
|
|
|
return E-S;
|
|
|
|
}
|
|
|
|
|
2024-04-15 16:53:25 +02:00
|
|
|
double reneighbour(Comm* comm, Parameter *param, Atom *atom, Neighbor *neighbor) {
|
2020-08-19 09:22:43 +02:00
|
|
|
double S, E;
|
|
|
|
S = getTimeStamp();
|
2020-11-05 12:41:44 +01:00
|
|
|
LIKWID_MARKER_START("reneighbour");
|
2023-04-09 01:19:12 +02:00
|
|
|
#ifdef SORT_ATOMS
|
|
|
|
atom->Nghost = 0;
|
|
|
|
sortAtom(atom);
|
|
|
|
#endif
|
2024-04-15 16:53:25 +02:00
|
|
|
ghostNeighbor(comm, atom, param);
|
2022-08-12 17:28:06 +02:00
|
|
|
buildNeighbor(atom, neighbor);
|
2020-11-05 12:41:44 +01:00
|
|
|
LIKWID_MARKER_STOP("reneighbour");
|
2020-08-19 09:22:43 +02:00
|
|
|
E = getTimeStamp();
|
|
|
|
return E-S;
|
2020-08-19 09:00:35 +02:00
|
|
|
}
|
|
|
|
|
2024-04-15 16:53:25 +02:00
|
|
|
double updateAtoms(Comm* comm, Atom* atom){
|
|
|
|
double S,E;
|
|
|
|
S = getTimeStamp();
|
|
|
|
exchangeComm(comm, atom);
|
|
|
|
E = getTimeStamp();
|
|
|
|
return E-S;
|
2020-08-18 14:27:28 +02:00
|
|
|
}
|
|
|
|
|
2022-11-07 20:37:01 +01:00
|
|
|
void writeInput(Parameter *param, Atom *atom) {
|
|
|
|
FILE *fpin = fopen("input.in", "w");
|
|
|
|
fprintf(fpin, "0,%f,0,%f,0,%f\n", param->xprd, param->yprd, param->zprd);
|
|
|
|
|
|
|
|
for(int i = 0; i < atom->Nlocal; i++) {
|
|
|
|
fprintf(fpin, "1,%f,%f,%f,%f,%f,%f\n", atom_x(i), atom_y(i), atom_z(i), atom_vx(i), atom_vy(i), atom_vz(i));
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(fpin);
|
|
|
|
}
|
|
|
|
|
2022-03-17 02:44:34 +01:00
|
|
|
int main(int argc, char** argv) {
|
2020-08-19 09:00:35 +02:00
|
|
|
double timer[NUMTIMER];
|
2021-10-26 00:40:39 +02:00
|
|
|
Eam eam;
|
2022-08-12 17:28:06 +02:00
|
|
|
Atom atom;
|
|
|
|
Neighbor neighbor;
|
2021-10-12 15:04:08 +02:00
|
|
|
Stats stats;
|
2020-08-11 16:34:22 +02:00
|
|
|
Parameter param;
|
2024-04-15 16:53:25 +02:00
|
|
|
Comm comm;
|
|
|
|
Grid grid;
|
2020-11-05 12:41:44 +01:00
|
|
|
LIKWID_MARKER_INIT;
|
|
|
|
#pragma omp parallel
|
|
|
|
{
|
|
|
|
LIKWID_MARKER_REGISTER("force");
|
2021-07-16 00:24:43 +02:00
|
|
|
//LIKWID_MARKER_REGISTER("reneighbour");
|
|
|
|
//LIKWID_MARKER_REGISTER("pbc");
|
2024-04-15 16:53:25 +02:00
|
|
|
}
|
|
|
|
initComm(&argc, &argv, &comm);
|
2022-03-17 02:44:34 +01:00
|
|
|
initParameter(¶m);
|
|
|
|
for(int i = 0; i < argc; i++) {
|
2024-04-15 16:53:25 +02:00
|
|
|
if((strcmp(argv[i], "-p") == 0)) {
|
2022-03-17 02:44:34 +01:00
|
|
|
readParameter(¶m, argv[++i]);
|
|
|
|
continue;
|
|
|
|
}
|
2022-02-28 22:34:42 +01:00
|
|
|
if((strcmp(argv[i], "-f") == 0)) {
|
2021-10-26 00:40:39 +02:00
|
|
|
if((param.force_field = str2ff(argv[++i])) < 0) {
|
|
|
|
fprintf(stderr, "Invalid force field!\n");
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2022-02-28 22:34:42 +01:00
|
|
|
if((strcmp(argv[i], "-i") == 0)) {
|
2021-10-26 00:40:39 +02:00
|
|
|
param.input_file = strdup(argv[++i]);
|
|
|
|
continue;
|
|
|
|
}
|
2022-02-28 22:34:42 +01:00
|
|
|
if((strcmp(argv[i], "-e") == 0)) {
|
2021-11-30 01:33:55 +01:00
|
|
|
param.eam_file = strdup(argv[++i]);
|
|
|
|
continue;
|
|
|
|
}
|
2022-02-28 22:34:42 +01:00
|
|
|
if((strcmp(argv[i], "-n") == 0) || (strcmp(argv[i], "--nsteps") == 0)) {
|
2020-08-19 09:00:35 +02:00
|
|
|
param.ntimes = atoi(argv[++i]);
|
|
|
|
continue;
|
|
|
|
}
|
2022-02-28 22:34:42 +01:00
|
|
|
if((strcmp(argv[i], "-nx") == 0)) {
|
2020-08-19 09:00:35 +02:00
|
|
|
param.nx = atoi(argv[++i]);
|
|
|
|
continue;
|
|
|
|
}
|
2022-02-28 22:34:42 +01:00
|
|
|
if((strcmp(argv[i], "-ny") == 0)) {
|
2020-08-19 09:00:35 +02:00
|
|
|
param.ny = atoi(argv[++i]);
|
|
|
|
continue;
|
|
|
|
}
|
2022-02-28 22:34:42 +01:00
|
|
|
if((strcmp(argv[i], "-nz") == 0)) {
|
2020-08-19 09:00:35 +02:00
|
|
|
param.nz = atoi(argv[++i]);
|
|
|
|
continue;
|
|
|
|
}
|
2022-03-18 01:28:11 +01:00
|
|
|
if((strcmp(argv[i], "-half") == 0)) {
|
|
|
|
param.half_neigh = atoi(argv[++i]);
|
|
|
|
continue;
|
2024-04-15 16:53:25 +02:00
|
|
|
}
|
|
|
|
if((strcmp(argv[i], "-method") == 0)) {
|
|
|
|
param.method = atoi(argv[++i]);
|
|
|
|
if (param.method>3 || param.method< 0){
|
|
|
|
if(comm.myproc == 0) fprintf(stderr, "Method does not exist!\n");
|
|
|
|
endComm(&comm);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if((strcmp(argv[i], "-bal") == 0)) {
|
|
|
|
param.balance = atoi(argv[++i]);
|
|
|
|
if (param.balance>3 || param.balance< 0){
|
|
|
|
if(comm.myproc == 0) fprintf(stderr, "Load Balance does not exist!\n");
|
|
|
|
endComm(&comm);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
continue;
|
2022-03-18 01:28:11 +01:00
|
|
|
}
|
2022-02-28 22:34:42 +01:00
|
|
|
if((strcmp(argv[i], "-r") == 0) || (strcmp(argv[i], "--radius") == 0)) {
|
|
|
|
param.cutforce = atof(argv[++i]);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if((strcmp(argv[i], "-s") == 0) || (strcmp(argv[i], "--skin") == 0)) {
|
|
|
|
param.skin = atof(argv[++i]);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if((strcmp(argv[i], "--freq") == 0)) {
|
2021-10-12 15:04:08 +02:00
|
|
|
param.proc_freq = atof(argv[++i]);
|
|
|
|
continue;
|
|
|
|
}
|
2022-02-28 22:34:42 +01:00
|
|
|
if((strcmp(argv[i], "--vtk") == 0)) {
|
2021-10-29 16:52:19 +02:00
|
|
|
param.vtk_file = strdup(argv[++i]);
|
|
|
|
continue;
|
|
|
|
}
|
2022-02-28 22:34:42 +01:00
|
|
|
if((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "--help") == 0)) {
|
2024-04-15 16:53:25 +02:00
|
|
|
if(comm.myproc ==0 ){
|
|
|
|
printf("MD Bench: A minimalistic re-implementation of miniMD\n");
|
|
|
|
printf(HLINE);
|
|
|
|
printf("-p <string>: file to read parameters from (can be specified more than once)\n");
|
|
|
|
printf("-f <string>: force field (lj, eam or dem), default lj\n");
|
|
|
|
printf("-i <string>: input file with atom positions (dump)\n");
|
|
|
|
printf("-e <string>: input file for EAM\n");
|
|
|
|
printf("-n / --nsteps <int>: set number of timesteps for simulation\n");
|
|
|
|
printf("-nx/-ny/-nz <int>: set linear dimension of systembox in x/y/z direction\n");
|
|
|
|
printf("-r / --radius <real>: set cutoff radius\n");
|
|
|
|
printf("-s / --skin <real>: set skin (verlet buffer)\n");
|
|
|
|
printf("--freq <real>: processor frequency (GHz)\n");
|
|
|
|
printf("--vtk <string>: VTK file for visualization\n");
|
|
|
|
printf(HLINE);
|
|
|
|
}
|
|
|
|
exit(EXIT_SUCCESS);
|
2020-08-19 09:00:35 +02:00
|
|
|
}
|
|
|
|
}
|
2024-04-15 16:53:25 +02:00
|
|
|
|
|
|
|
if(param.balance>0 && param.method == 1){
|
|
|
|
if(comm.myproc == 0) fprintf(stderr, "Half Shell is not supported by load balance!\n");
|
|
|
|
endComm(&comm);
|
|
|
|
exit(0);
|
|
|
|
}
|
2020-08-19 09:00:35 +02:00
|
|
|
|
2022-02-28 22:34:42 +01:00
|
|
|
param.cutneigh = param.cutforce + param.skin;
|
2024-04-15 16:53:25 +02:00
|
|
|
timer[SETUP]=setup(¶m, &eam, &atom, &neighbor, &stats, &comm, &grid);
|
|
|
|
if(comm.myproc == 0)printParameter(¶m);
|
|
|
|
if(comm.myproc == 0)printf(HLINE);
|
|
|
|
if(comm.myproc == 0) printf("step\ttemp\t\tpressure\n");
|
2020-08-18 14:27:28 +02:00
|
|
|
computeThermo(0, ¶m, &atom);
|
2022-08-09 18:53:53 +02:00
|
|
|
#if defined(MEM_TRACER) || defined(INDEX_TRACER)
|
2024-04-15 16:53:25 +02:00
|
|
|
traceAddresses(¶m, &atom, &neighbor, n + 1);// TODO: trace adress
|
2022-08-09 18:53:53 +02:00
|
|
|
#endif
|
2022-11-07 20:37:01 +01:00
|
|
|
//writeInput(¶m, &atom);
|
2024-04-15 16:53:25 +02:00
|
|
|
timer[FORCE] = computeForce(&eam, ¶m, &atom, &neighbor, &stats);
|
|
|
|
timer[NEIGH] = 0.0;
|
|
|
|
timer[FORWARD] = 0.0;
|
|
|
|
timer[UPDATE] = 0.0;
|
|
|
|
timer[BALANCE] = 0.0;
|
|
|
|
timer[REVERSE] = reverse(&comm, &atom, ¶m);
|
|
|
|
MPI_Barrier(world);
|
|
|
|
timer[TOTAL] = getTimeStamp();
|
2021-10-29 16:52:19 +02:00
|
|
|
if(param.vtk_file != NULL) {
|
2024-04-15 16:53:25 +02:00
|
|
|
printvtk(param.vtk_file, &comm, &atom, ¶m, 0);
|
|
|
|
}
|
2020-08-11 16:34:22 +02:00
|
|
|
for(int n = 0; n < param.ntimes; n++) {
|
2022-08-09 18:53:53 +02:00
|
|
|
bool reneigh = (n + 1) % param.reneigh_every == 0;
|
2022-08-12 17:28:06 +02:00
|
|
|
initialIntegrate(reneigh, ¶m, &atom);
|
2024-04-15 16:53:25 +02:00
|
|
|
if(reneigh) {
|
|
|
|
timer[UPDATE] +=updateAtoms(&comm,&atom);
|
|
|
|
if(param.balance && !((n+1)%param.balance_every))
|
|
|
|
timer[BALANCE] +=dynamicBalance(&comm, &grid, &atom , ¶m, timer[FORCE]);
|
|
|
|
timer[NEIGH] += reneighbour(&comm, ¶m, &atom, &neighbor);
|
2020-08-17 14:01:46 +02:00
|
|
|
} else {
|
2024-04-15 16:53:25 +02:00
|
|
|
timer[FORWARD] += forward(&comm, &atom, ¶m);
|
|
|
|
}
|
2022-08-09 18:53:53 +02:00
|
|
|
#if defined(MEM_TRACER) || defined(INDEX_TRACER)
|
2021-12-01 00:07:45 +01:00
|
|
|
traceAddresses(¶m, &atom, &neighbor, n + 1);
|
2022-08-09 18:53:53 +02:00
|
|
|
#endif
|
2022-08-12 17:28:06 +02:00
|
|
|
timer[FORCE] += computeForce(&eam, ¶m, &atom, &neighbor, &stats);
|
2024-04-15 16:53:25 +02:00
|
|
|
timer[REVERSE] += reverse(&comm, &atom, ¶m);
|
2022-08-12 17:28:06 +02:00
|
|
|
finalIntegrate(reneigh, ¶m, &atom);
|
2024-04-15 16:53:25 +02:00
|
|
|
|
2020-08-17 14:01:46 +02:00
|
|
|
if(!((n + 1) % param.nstat) && (n+1) < param.ntimes) {
|
2022-08-09 18:53:53 +02:00
|
|
|
#ifdef CUDA_TARGET
|
2022-08-12 17:28:06 +02:00
|
|
|
memcpyFromGPU(atom.x, atom.d_atom.x, atom.Nmax * sizeof(MD_FLOAT) * 3);
|
2022-08-09 18:53:53 +02:00
|
|
|
#endif
|
2020-08-18 14:27:28 +02:00
|
|
|
computeThermo(n + 1, ¶m, &atom);
|
2020-08-11 16:34:22 +02:00
|
|
|
}
|
2021-10-29 16:52:19 +02:00
|
|
|
|
|
|
|
if(param.vtk_file != NULL) {
|
2024-04-15 16:53:25 +02:00
|
|
|
printvtk(param.vtk_file, &comm, &atom ,¶m, n+1);
|
|
|
|
}
|
2020-08-11 16:34:22 +02:00
|
|
|
}
|
2024-04-15 16:53:25 +02:00
|
|
|
MPI_Barrier(world);
|
2020-08-19 09:22:43 +02:00
|
|
|
timer[TOTAL] = getTimeStamp() - timer[TOTAL];
|
2020-08-18 14:27:28 +02:00
|
|
|
computeThermo(-1, ¶m, &atom);
|
2024-04-15 16:53:25 +02:00
|
|
|
|
|
|
|
double mint[NUMTIMER];
|
|
|
|
double maxt[NUMTIMER];
|
|
|
|
double sumt[NUMTIMER];
|
|
|
|
timer[REST] = timer[TOTAL]-timer[FORCE]-timer[NEIGH]-timer[BALANCE]-timer[FORWARD]-timer[REVERSE];
|
|
|
|
MPI_Reduce(timer,mint,NUMTIMER,MPI_DOUBLE,MPI_MIN,0,world);
|
|
|
|
MPI_Reduce(timer,maxt,NUMTIMER,MPI_DOUBLE,MPI_MAX,0,world);
|
|
|
|
MPI_Reduce(timer,sumt,NUMTIMER,MPI_DOUBLE,MPI_SUM,0,world);
|
|
|
|
int Nghost;
|
|
|
|
MPI_Reduce(&atom.Nghost,&Nghost,1,MPI_INT,MPI_SUM,0,world);
|
|
|
|
|
|
|
|
if(comm.myproc == 0){
|
|
|
|
int n = comm.numproc;
|
|
|
|
printf(HLINE);
|
|
|
|
printf("System: %d atoms %d ghost atoms, Steps: %d\n", atom.Natoms, Nghost, param.ntimes);
|
|
|
|
printf("TOTAL %.2fs\n\n",timer[TOTAL]);
|
|
|
|
printf("%4s|%7s|%7s|%7s|%7s|%7s|%7s|%7s|%7s|\n","","FORCE ", "NEIGH ", "BALANCE", "FORWARD", "REVERSE","UPDATE","REST ","SETUP");
|
|
|
|
printf("----|-------|-------|-------|-------|-------|-------|-------|-------|\n");
|
|
|
|
printf("%4s|%7.2f|%7.2f|%7.2f|%7.2f|%7.2f|%7.2f|%7.2f|%7.2f|\n", "AVG", sumt[FORCE]/n,sumt[NEIGH]/n,sumt[BALANCE]/n,sumt[FORWARD]/n,sumt[REVERSE]/n,sumt[UPDATE]/n,sumt[REST]/n,sumt[SETUP]/n);
|
|
|
|
printf("%4s|%7.2f|%7.2f|%7.2f|%7.2f|%7.2f|%7.2f|%7.2f|%7.2f|\n", "MIN", mint[FORCE],mint[NEIGH],mint[BALANCE],mint[FORWARD],mint[REVERSE],mint[UPDATE],mint[REST],mint[SETUP]);
|
|
|
|
printf("%4s|%7.2f|%7.2f|%7.2f|%7.2f|%7.2f|%7.2f|%7.2f|%7.2f|\n", "MAX", maxt[FORCE],maxt[NEIGH],maxt[BALANCE],maxt[FORWARD],maxt[REVERSE],maxt[UPDATE],maxt[REST],maxt[SETUP]);
|
|
|
|
printf(HLINE);
|
|
|
|
printf("Performance: %.2f million atom updates per second\n",
|
2020-08-19 10:00:19 +02:00
|
|
|
1e-6 * (double) atom.Natoms * param.ntimes / timer[TOTAL]);
|
2024-04-15 16:53:25 +02:00
|
|
|
|
2021-10-26 09:16:31 +02:00
|
|
|
#ifdef COMPUTE_STATS
|
2021-10-12 22:39:54 +02:00
|
|
|
displayStatistics(&atom, ¶m, &stats, timer);
|
2021-10-26 09:11:17 +02:00
|
|
|
#endif
|
2024-04-15 16:53:25 +02:00
|
|
|
}
|
|
|
|
endComm(&comm);
|
2020-11-05 12:41:44 +01:00
|
|
|
LIKWID_MARKER_CLOSE;
|
2020-08-11 16:34:22 +02:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|