From 179477ef7ded23c6d38aaaab426b5ebb7ed59ae1 Mon Sep 17 00:00:00 2001 From: Malachi Date: Fri, 11 Sep 2020 00:55:44 -0500 Subject: [PATCH] Fix potential bug in determining fastest oogs mode (#144) --- 3rd_party/gslib/ogs/src/oogs.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/3rd_party/gslib/ogs/src/oogs.cpp b/3rd_party/gslib/ogs/src/oogs.cpp index d4d8189de..4047f3516 100644 --- a/3rd_party/gslib/ogs/src/oogs.cpp +++ b/3rd_party/gslib/ogs/src/oogs.cpp @@ -191,7 +191,7 @@ oogs_t* oogs::setup(ogs_t *ogs, int nVec, dlong stride, const char *type, std::f if(gsMode == OOGS_AUTO) { if(rank == 0) printf("timing oogs modes: "); const int Ntests = 10; - double elapsedLast = std::numeric_limits::max(); + double elapsedMin = std::numeric_limits::max(); oogs_mode fastestMode; occa::memory o_q; if(!stride) @@ -218,8 +218,10 @@ oogs_t* oogs::setup(ogs_t *ogs, int nVec, dlong stride, const char *type, std::f MPI_Barrier(comm->c); const double elapsed = (MPI_Wtime() - tStart)/Ntests; if(rank == 0) printf("%gs ", elapsed); - if(elapsed < elapsedLast) fastestMode = gs->mode; - elapsedLast = elapsed; + if(elapsed < elapsedMin){ + fastestMode = gs->mode; + elapsedMin = elapsed; + } } MPI_Bcast(&fastestMode, 1, MPI_INT, 0, comm->c); gs->mode = fastestMode;