commit ed7dc0c0333eed97a8ff17b31336e299e77409d2
parent 7a68a88f261fc266ce54d08bafc5ee1c43aa293b
Author: Fabian Wermelinger <fabianw@mavt.ethz.ch>
Date: Thu, 1 Dec 2016 10:02:25 +0100
added timers for expensive tasks
Diffstat:
4 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/src/Interpolator.h b/src/Interpolator.h
@@ -13,6 +13,7 @@
#include <cstring>
#include <string>
#include <functional>
+#include <chrono>
#ifdef _USE_HDF_
#include <hdf5.h>
#endif /* _USE_HDF_ */
@@ -33,6 +34,8 @@ public:
m_extent(p("extent").asDouble(1.0))
{
// load the data
+ std::chrono::time_point<std::chrono::system_clock> start, end;
+ start = std::chrono::system_clock::now();
if (p("load").asString("h5") == "h5") _load_h5(p);
else if (p("load").asString("h5") == "wavelet") _load_wavelet(p);
else
@@ -40,6 +43,9 @@ public:
std::cerr << "ERROR: Interpolator: Undefined loader \"" << p("load").asString() << "\"" << std::endl;
abort();
}
+ end = std::chrono::system_clock::now();
+ std::chrono::duration<double> elapsed_seconds = end-start;
+ std::cout << "Loading data done. Elapsed time = " << elapsed_seconds.count() << "s" << std::endl;
// cell centered or nodal values?
if (p("data").asString("cell") == "cell") _nCells = [](const int N) { return N; };
diff --git a/src/InterpolatorMPI.h b/src/InterpolatorMPI.h
@@ -83,6 +83,8 @@ public:
m_isroot = (0 == myrank);
// load the data
+ std::chrono::time_point<std::chrono::system_clock> start, end;
+ start = std::chrono::system_clock::now();
if (p("load").asString("h5") == "h5") this->_load_h5_MPI(p);
else if (p("load").asString("h5") == "wavelet") this->_load_wavelet_MPI(p);
else
@@ -91,6 +93,10 @@ public:
std::cerr << "ERROR: InterpolatorMPI: Undefined loader \"" << p("load").asString() << "\"" << std::endl;
abort();
}
+ end = std::chrono::system_clock::now();
+ std::chrono::duration<double> elapsed_seconds = end-start;
+ if (m_isroot)
+ std::cout << "Loading data done. Elapsed time = " << elapsed_seconds.count() << "s" << std::endl;
// cell centered or nodal values?
if (p("data").asString("cell") == "cell") this->_nCells = [](const int N) { return N; };
@@ -134,8 +140,13 @@ public:
for (int i = 0; i < 3; ++i)
this->m_origin_off[i] = origin[i];
- // fetch halos cells
+ // fetch halo cells
+ start = std::chrono::system_clock::now();
_fetch_halo(cartcomm);
+ end = std::chrono::system_clock::now();
+ elapsed_seconds = end-start;
+ if (m_isroot)
+ std::cout << "Exchanging messages data done. Elapsed time = " << elapsed_seconds.count() << "s" << std::endl;
}
virtual ~InterpolatorMPI() {}
@@ -443,6 +454,8 @@ void InterpolatorMPI<Tinterp>::_fetch_halo(const MPI_Comm comm)
std::vector<MPI_Status> cstat_recv(cpend_recv.size());
MPI_Waitall(cpend_recv.size(), cpend_recv.data(), cstat_recv.data());
_unpack_corners(crecv, mynbrs);
+
+ MPI_Barrier(comm);
}
diff --git a/src/IsoExtractor.h b/src/IsoExtractor.h
@@ -11,6 +11,7 @@
#include <string>
#include <ctime>
#include <cstdlib>
+#include <chrono>
#include "common.h"
#include "ArgumentParser.h"
#include "Interpolator.h"
@@ -528,6 +529,11 @@ void IsoExtractor<Tkernel,Tinterpolator>::_extractIso(const Real isoval,
abort();
}
+ std::chrono::time_point<std::chrono::system_clock> start, end;
+ start = std::chrono::system_clock::now();
+ if (verbose)
+ std::cout << "Extracting isovalue " << isoval << "..." << std::endl;
+
const size_t nCubes = static_cast<size_t>(Nx) * Ny * Nz;
size_t totalSize = 0;
#pragma omp parallel
@@ -578,6 +584,10 @@ void IsoExtractor<Tkernel,Tinterpolator>::_extractIso(const Real isoval,
m_triList.insert(m_triList.end(), myTriList.begin(), myTriList.end());
}
}
+ end = std::chrono::system_clock::now();
+ std::chrono::duration<double> elapsed_seconds = end-start;
+ if (verbose)
+ std::cout << "Extraction done. Elapsed time = " << elapsed_seconds.count() << "s" << std::endl;
}
diff --git a/src/IsoExtractorMPI.h b/src/IsoExtractorMPI.h
@@ -55,6 +55,7 @@ public:
this->m_interp.setOrigin(origin);
this->_extractIso(isoval, Nx, Ny, Nz, chx, chy, chz, Ox, Oy, Oz, this->m_interp.isroot());
+ MPI_Barrier(this->m_interp.getComm());
_writePLY_MPI(fout, this->m_triList);
}