Skip to content

Commit

Permalink
Fix potential bug in determining fastest oogs mode (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
MalachiTimothyPhillips authored Sep 11, 2020
1 parent a1dcd32 commit 598bb0a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions 3rd_party/gslib/ogs/src/oogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>::max();
double elapsedMin = std::numeric_limits<double>::max();
oogs_mode fastestMode;
occa::memory o_q;
if(!stride)
Expand All @@ -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;
Expand Down

0 comments on commit 598bb0a

Please sign in to comment.