Measure one kernel only

parent a9769f3f
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include <omp.h> #include <omp.h>
#endif #endif
#include "tools/Logger.hpp"
/** /**
* Constructor of a SWE_WavePropagationBlock. * Constructor of a SWE_WavePropagationBlock.
* *
...@@ -106,6 +108,8 @@ SWE_WavePropagationBlock::SWE_WavePropagationBlock(): ...@@ -106,6 +108,8 @@ SWE_WavePropagationBlock::SWE_WavePropagationBlock():
* maximum allowed time step size * maximum allowed time step size
*/ */
void SWE_WavePropagationBlock::computeNumericalFluxes() { void SWE_WavePropagationBlock::computeNumericalFluxes() {
// tools::Logger::logger.resetCpuClockToCurrentTime();
//maximum (linearized) wave speed within one iteration //maximum (linearized) wave speed within one iteration
float maxWaveSpeed = (float) 0.; float maxWaveSpeed = (float) 0.;
...@@ -188,7 +192,7 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() { ...@@ -188,7 +192,7 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() {
} // end of parallel for block } // end of parallel for block
#endif #endif
if(maxWaveSpeed > 0.00001) { //TODO zeroTol // if(maxWaveSpeed > 0.00001) { //TODO zeroTol
//compute the time step width //compute the time step width
//CFL-Codition //CFL-Codition
//(max. wave speed) * dt / dx < .5 //(max. wave speed) * dt / dx < .5
...@@ -200,10 +204,11 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() { ...@@ -200,10 +204,11 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() {
// #else // #else
// dt *= (float) .8; //CFL-number = 1. (wave limiters) // dt *= (float) .8; //CFL-number = 1. (wave limiters)
// #endif // #endif
} // }
else // else
maxTimestep = std::numeric_limits<float>::max(); //might happen in dry cells // maxTimestep = std::numeric_limits<float>::max(); //might happen in dry cells
// tools::Logger::logger.updateCpuTime();
} }
/** /**
...@@ -212,6 +217,8 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() { ...@@ -212,6 +217,8 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() {
* @param dt time step width used in the update. * @param dt time step width used in the update.
*/ */
void SWE_WavePropagationBlock::updateUnknowns(float dt) { void SWE_WavePropagationBlock::updateUnknowns(float dt) {
tools::Logger::logger.resetCpuClockToCurrentTime();
//update cell averages with the net-updates //update cell averages with the net-updates
#ifdef LOOP_OPENMP #ifdef LOOP_OPENMP
#pragma omp parallel for #pragma omp parallel for
...@@ -248,6 +255,8 @@ void SWE_WavePropagationBlock::updateUnknowns(float dt) { ...@@ -248,6 +255,8 @@ void SWE_WavePropagationBlock::updateUnknowns(float dt) {
hu[i][j] = hv[i][j] = 0.; //no water, no speed! hu[i][j] = hv[i][j] = 0.; //no water, no speed!
} }
} }
tools::Logger::logger.updateCpuTime();
} }
/** /**
......
...@@ -433,7 +433,7 @@ int main( int argc, char** argv ) { ...@@ -433,7 +433,7 @@ int main( int argc, char** argv ) {
l_mpiRow ); l_mpiRow );
// reset the cpu clock // reset the cpu clock
tools::Logger::logger.resetCpuClockToCurrentTime(); // tools::Logger::logger.resetCpuClockToCurrentTime();
// set values in ghost cells // set values in ghost cells
l_wavePropgationBlock.setGhostLayer(); l_wavePropgationBlock.setGhostLayer();
...@@ -445,7 +445,7 @@ int main( int argc, char** argv ) { ...@@ -445,7 +445,7 @@ int main( int argc, char** argv ) {
float l_maxTimeStepWidth = l_wavePropgationBlock.getMaxTimestep(); float l_maxTimeStepWidth = l_wavePropgationBlock.getMaxTimestep();
// update the cpu time in the logger // update the cpu time in the logger
tools::Logger::logger.updateCpuTime(); // tools::Logger::logger.updateCpuTime();
//! maximum allowed time steps of all blocks //! maximum allowed time steps of all blocks
float l_maxTimeStepWidthGlobal; float l_maxTimeStepWidthGlobal;
...@@ -454,13 +454,13 @@ int main( int argc, char** argv ) { ...@@ -454,13 +454,13 @@ int main( int argc, char** argv ) {
MPI_Allreduce(&l_maxTimeStepWidth, &l_maxTimeStepWidthGlobal, 1, MPI_FLOAT, MPI_MIN, MPI_COMM_WORLD); MPI_Allreduce(&l_maxTimeStepWidth, &l_maxTimeStepWidthGlobal, 1, MPI_FLOAT, MPI_MIN, MPI_COMM_WORLD);
// reset the cpu time // reset the cpu time
tools::Logger::logger.resetCpuClockToCurrentTime(); // tools::Logger::logger.resetCpuClockToCurrentTime();
// update the cell values // update the cell values
l_wavePropgationBlock.updateUnknowns(l_maxTimeStepWidthGlobal); l_wavePropgationBlock.updateUnknowns(l_maxTimeStepWidthGlobal);
// update the cpu and CPU-communication time in the logger // update the cpu and CPU-communication time in the logger
tools::Logger::logger.updateCpuTime(); // tools::Logger::logger.updateCpuTime();
tools::Logger::logger.updateCpuCommunicationTime(); tools::Logger::logger.updateCpuCommunicationTime();
// update simulation time with time step width. // update simulation time with time step width.
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
* Main program for the simulation on a single SWE_WavePropagationBlock. * Main program for the simulation on a single SWE_WavePropagationBlock.
*/ */
int main( int argc, char** argv ) { int main( int argc, char** argv ) {
/** /**
* Initialization. * Initialization.
*/ */
...@@ -231,7 +232,7 @@ int main( int argc, char** argv ) { ...@@ -231,7 +232,7 @@ int main( int argc, char** argv ) {
l_wavePropgationBlock.setGhostLayer(); l_wavePropgationBlock.setGhostLayer();
// reset the cpu clock // reset the cpu clock
tools::Logger::logger.resetCpuClockToCurrentTime(); //tools::Logger::logger.resetCpuClockToCurrentTime();
// approximate the maximum time step // approximate the maximum time step
// TODO: This calculation should be replaced by the usage of the wave speeds occuring during the flux computation // TODO: This calculation should be replaced by the usage of the wave speeds occuring during the flux computation
...@@ -248,7 +249,7 @@ int main( int argc, char** argv ) { ...@@ -248,7 +249,7 @@ int main( int argc, char** argv ) {
l_wavePropgationBlock.updateUnknowns(l_maxTimeStepWidth); l_wavePropgationBlock.updateUnknowns(l_maxTimeStepWidth);
// update the cpu time in the logger // update the cpu time in the logger
tools::Logger::logger.updateCpuTime(); //tools::Logger::logger.updateCpuTime();
// update simulation time with time step width. // update simulation time with time step width.
l_t += l_maxTimeStepWidth; l_t += l_maxTimeStepWidth;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment