From c4e5e872658e51878cddd2318e5099b09b5cfdec Mon Sep 17 00:00:00 2001 From: TejeshPala Date: Tue, 21 Nov 2023 15:31:27 +0100 Subject: [PATCH] omp print threads --- gromacs/main.c | 10 ++++++++++ lammps/main.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/gromacs/main.c b/gromacs/main.c index f635f62..e849b12 100644 --- a/gromacs/main.c +++ b/gromacs/main.c @@ -6,6 +6,7 @@ */ #include #include +#include //-- #include //-- @@ -308,6 +309,15 @@ int main(int argc, char** argv) { printf("TOTAL %.2fs FORCE %.2fs NEIGH %.2fs REST %.2fs\n", timer[TOTAL], timer[FORCE], timer[NEIGH], timer[TOTAL]-timer[FORCE]-timer[NEIGH]); printf(HLINE); + + int nthreads = 0; +#pragma omp parallel + { + nthreads = omp_get_num_threads(); + } + + printf("Num threads: %d\n", nthreads); + printf("Performance: %.2f million atom updates per second\n", 1e-6 * (double) atom.Natoms * param.ntimes / timer[TOTAL]); #ifdef COMPUTE_STATS diff --git a/lammps/main.c b/lammps/main.c index 713c86e..91743f6 100644 --- a/lammps/main.c +++ b/lammps/main.c @@ -11,6 +11,7 @@ #include #include #include +#include #include @@ -282,6 +283,15 @@ int main(int argc, char** argv) { printf("TOTAL %.2fs FORCE %.2fs NEIGH %.2fs REST %.2fs\n", timer[TOTAL], timer[FORCE], timer[NEIGH], timer[TOTAL]-timer[FORCE]-timer[NEIGH]); printf(HLINE); + + int nthreads = 0; +#pragma omp parallel + { + nthreads = omp_get_num_threads(); + } + + printf("Num threads: %d\n", nthreads); + printf("Performance: %.2f million atom updates per second\n", 1e-6 * (double) atom.Natoms * param.ntimes / timer[TOTAL]); #ifdef COMPUTE_STATS