From 9631345b05b0a0dd2acb5581f52d078aba8da339 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Mon, 6 Aug 2012 21:05:10 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8530 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/GPU/pppm_gpu.h | 2 +- src/KSPACE/pppm_cg.cpp | 4 ++-- src/KSPACE/pppm_cg.h | 4 ++-- src/KSPACE/pppm_old.cpp | 4 +++- src/KSPACE/pppm_old.h | 2 +- src/KSPACE/pppm_tip4p.cpp | 4 ++-- src/KSPACE/pppm_tip4p.h | 4 ++-- src/USER-CUDA/pppm_cuda.cpp | 6 ++++-- src/USER-CUDA/pppm_cuda.h | 6 +++--- src/finish.cpp | 13 +++++++++---- src/kspace.h | 2 +- 11 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/GPU/pppm_gpu.h b/src/GPU/pppm_gpu.h index 0acc5a0060..9614fd640c 100644 --- a/src/GPU/pppm_gpu.h +++ b/src/GPU/pppm_gpu.h @@ -31,7 +31,7 @@ class PPPMGPU : public PPPM { virtual void init(); virtual void setup(); virtual void compute(int, int); - virtual void timing(int, double &, double &); + virtual int timing(int, double &, double &); virtual double memory_usage(); protected: diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index f98584426b..499b55c08f 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -42,7 +42,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -PPPMCG::PPPMCG(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp, narg, arg) +PPPMCG::PPPMCG(LAMMPS *lmp, int narg, char **arg) : PPPMOld(lmp, narg, arg) { if ((narg < 1) || (narg > 2)) error->all(FLERR,"Illegal kspace_style pppm/cg command"); @@ -521,7 +521,7 @@ void PPPMCG::slabcorr() double PPPMCG::memory_usage() { - double bytes = PPPM::memory_usage(); + double bytes = PPPMOld::memory_usage(); bytes += nmax * sizeof(int); return bytes; } diff --git a/src/KSPACE/pppm_cg.h b/src/KSPACE/pppm_cg.h index 4ab1918b37..6215d13249 100644 --- a/src/KSPACE/pppm_cg.h +++ b/src/KSPACE/pppm_cg.h @@ -20,11 +20,11 @@ KSpaceStyle(pppm/cg,PPPMCG) #ifndef LMP_PPPM_CG_H #define LMP_PPPM_CG_H -#include "pppm.h" +#include "pppm_old.h" namespace LAMMPS_NS { -class PPPMCG : public PPPM { +class PPPMCG : public PPPMOld { public: PPPMCG(class LAMMPS *, int, char **); virtual ~PPPMCG(); diff --git a/src/KSPACE/pppm_old.cpp b/src/KSPACE/pppm_old.cpp index a0bdc509f8..9c8838f406 100644 --- a/src/KSPACE/pppm_old.cpp +++ b/src/KSPACE/pppm_old.cpp @@ -2488,7 +2488,7 @@ void PPPMOld::slabcorr() perform and time the 4 FFTs required for N timesteps ------------------------------------------------------------------------- */ -void PPPMOld::timing(int n, double &time3d, double &time1d) +int PPPMOld::timing(int n, double &time3d, double &time1d) { double time1,time2; @@ -2521,6 +2521,8 @@ void PPPMOld::timing(int n, double &time3d, double &time1d) MPI_Barrier(world); time2 = MPI_Wtime(); time1d = time2 - time1; + + return 4; } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pppm_old.h b/src/KSPACE/pppm_old.h index 3bf496b257..45798ecd0b 100644 --- a/src/KSPACE/pppm_old.h +++ b/src/KSPACE/pppm_old.h @@ -42,7 +42,7 @@ class PPPMOld : public KSpace { virtual void init(); virtual void setup(); virtual void compute(int, int); - virtual void timing(int, double &, double &); + virtual int timing(int, double &, double &); virtual double memory_usage(); virtual void compute_group_group(int, int, int); diff --git a/src/KSPACE/pppm_tip4p.cpp b/src/KSPACE/pppm_tip4p.cpp index c9dabf94cd..d7a8450db6 100644 --- a/src/KSPACE/pppm_tip4p.cpp +++ b/src/KSPACE/pppm_tip4p.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ PPPMTIP4P::PPPMTIP4P(LAMMPS *lmp, int narg, char **arg) : - PPPM(lmp, narg, arg) {} + PPPMOld(lmp, narg, arg) {} /* ---------------------------------------------------------------------- */ @@ -49,7 +49,7 @@ void PPPMTIP4P::init() if (force->newton == 0) error->all(FLERR,"Kspace style pppm/tip4p requires newton on"); - PPPM::init(); + PPPMOld::init(); } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pppm_tip4p.h b/src/KSPACE/pppm_tip4p.h index 32d45f9229..df98002d6c 100644 --- a/src/KSPACE/pppm_tip4p.h +++ b/src/KSPACE/pppm_tip4p.h @@ -20,11 +20,11 @@ KSpaceStyle(pppm/tip4p,PPPMTIP4P) #ifndef LMP_PPPM_TIP4P_H #define LMP_PPPM_TIP4P_H -#include "pppm.h" +#include "pppm_old.h" namespace LAMMPS_NS { -class PPPMTIP4P : public PPPM { +class PPPMTIP4P : public PPPMOld { public: PPPMTIP4P(class LAMMPS *, int, char **); virtual ~PPPMTIP4P () {}; diff --git a/src/USER-CUDA/pppm_cuda.cpp b/src/USER-CUDA/pppm_cuda.cpp index 60504bf556..8b3ff4548d 100644 --- a/src/USER-CUDA/pppm_cuda.cpp +++ b/src/USER-CUDA/pppm_cuda.cpp @@ -97,7 +97,8 @@ void printArray(double*** data,int nx, int ny, int nz) } /* ---------------------------------------------------------------------- */ -PPPMCuda::PPPMCuda(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp, (narg==2?1:narg), arg) +PPPMCuda::PPPMCuda(LAMMPS *lmp, int narg, char **arg) : + PPPMOld(lmp, (narg==2?1:narg), arg) { cuda = lmp->cuda; if(cuda == NULL) @@ -1387,7 +1388,7 @@ void PPPMCuda::fieldforce() perform and time the 4 FFTs required for N timesteps ------------------------------------------------------------------------- */ -void PPPMCuda::timing(int n, double &time3d, double &time1d) +int PPPMCuda::timing(int n, double &time3d, double &time1d) { double time1,time2; @@ -1422,6 +1423,7 @@ void PPPMCuda::timing(int n, double &time3d, double &time1d) time2 = MPI_Wtime(); time1d = time2 - time1;*/ + return 4; } void PPPMCuda::slabcorr(int eflag) diff --git a/src/USER-CUDA/pppm_cuda.h b/src/USER-CUDA/pppm_cuda.h index 2237155a11..89d809c425 100644 --- a/src/USER-CUDA/pppm_cuda.h +++ b/src/USER-CUDA/pppm_cuda.h @@ -30,20 +30,20 @@ KSpaceStyle(pppm/cuda,PPPMCuda) #ifndef LMP_PPPM_CUDA_H #define LMP_PPPM_CUDA_H -#include "pppm.h" +#include "pppm_old.h" #include "cuda_data.h" #include "cuda_precision.h" namespace LAMMPS_NS { -class PPPMCuda : public PPPM { +class PPPMCuda : public PPPMOld { public: PPPMCuda(class LAMMPS *, int, char **); ~PPPMCuda(); void init(); void setup(); void compute(int, int); - void timing(int, double &, double &); + int timing(int, double &, double &); double poissontime; diff --git a/src/finish.cpp b/src/finish.cpp index 3c063aefc5..b0427da1da 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -419,6 +419,7 @@ void Finish::end(int flag) // FFT timing statistics // time3d,time1d = total time during run for 3d and 1d FFTs + // loop on timing() until nsample FFTs require at least 1.0 CPU sec // time_kspace may be 0.0 if another partition is doing Kspace if (fftflag) { @@ -429,9 +430,13 @@ void Finish::end(int flag) int nsteps = update->nsteps; - int nsample = 5; double time3d,time1d; - force->kspace->timing(nsample,time3d,time1d); + int nsample = 1; + int nfft = force->kspace->timing(nsample,time3d,time1d); + while (time3d < 1.0 || time1d < 1.0) { + nsample *= 5; + nfft = force->kspace->timing(nsample,time3d,time1d); + } time3d = nsteps * time3d / nsample; MPI_Allreduce(&time3d,&tmp,1,MPI_DOUBLE,MPI_SUM,world); @@ -453,8 +458,8 @@ void Finish::end(int flag) if (nsteps) { if (time_kspace) fraction = time3d/time_kspace*100.0; else fraction = 0.0; - flop3 = nflops/1.0e9/(time3d/4.0/nsteps); - flop1 = nflops/1.0e9/(time1d/4.0/nsteps); + flop3 = nfft*nflops/1.0e9/(time3d/nsteps); + flop1 = nfft*nflops/1.0e9/(time1d/nsteps); } else fraction = flop3 = flop1 = 0.0; if (me == 0) { diff --git a/src/kspace.h b/src/kspace.h index cfa3dafc9a..e1dce9a54d 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -46,7 +46,7 @@ class KSpace : protected Pointers { virtual void setup() = 0; virtual void compute(int, int) = 0; virtual void compute_group_group(int, int, int) {}; - virtual void timing(int, double &, double &) {} + virtual int timing(int, double &, double &) {return 0;} virtual double memory_usage() {return 0.0;} protected: