Measure one kernel only

parent a9769f3f
......@@ -35,6 +35,8 @@
#include <omp.h>
#endif
#include "tools/Logger.hpp"
/**
* Constructor of a SWE_WavePropagationBlock.
*
......@@ -106,6 +108,8 @@ SWE_WavePropagationBlock::SWE_WavePropagationBlock():
* maximum allowed time step size
*/
void SWE_WavePropagationBlock::computeNumericalFluxes() {
// tools::Logger::logger.resetCpuClockToCurrentTime();
//maximum (linearized) wave speed within one iteration
float maxWaveSpeed = (float) 0.;
......@@ -188,7 +192,7 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() {
} // end of parallel for block
#endif
if(maxWaveSpeed > 0.00001) { //TODO zeroTol
// if(maxWaveSpeed > 0.00001) { //TODO zeroTol
//compute the time step width
//CFL-Codition
//(max. wave speed) * dt / dx < .5
......@@ -200,10 +204,11 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() {
// #else
// dt *= (float) .8; //CFL-number = 1. (wave limiters)
// #endif
}
else
maxTimestep = std::numeric_limits<float>::max(); //might happen in dry cells
// }
// else
// maxTimestep = std::numeric_limits<float>::max(); //might happen in dry cells
// tools::Logger::logger.updateCpuTime();
}
/**
......@@ -212,6 +217,8 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() {
* @param dt time step width used in the update.
*/
void SWE_WavePropagationBlock::updateUnknowns(float dt) {
tools::Logger::logger.resetCpuClockToCurrentTime();
//update cell averages with the net-updates
#ifdef LOOP_OPENMP
#pragma omp parallel for
......@@ -248,6 +255,8 @@ void SWE_WavePropagationBlock::updateUnknowns(float dt) {
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 ) {
l_mpiRow );
// reset the cpu clock
tools::Logger::logger.resetCpuClockToCurrentTime();
// tools::Logger::logger.resetCpuClockToCurrentTime();
// set values in ghost cells
l_wavePropgationBlock.setGhostLayer();
......@@ -445,7 +445,7 @@ int main( int argc, char** argv ) {
float l_maxTimeStepWidth = l_wavePropgationBlock.getMaxTimestep();
// update the cpu time in the logger
tools::Logger::logger.updateCpuTime();
// tools::Logger::logger.updateCpuTime();
//! maximum allowed time steps of all blocks
float l_maxTimeStepWidthGlobal;
......@@ -454,13 +454,13 @@ int main( int argc, char** argv ) {
MPI_Allreduce(&l_maxTimeStepWidth, &l_maxTimeStepWidthGlobal, 1, MPI_FLOAT, MPI_MIN, MPI_COMM_WORLD);
// reset the cpu time
tools::Logger::logger.resetCpuClockToCurrentTime();
// tools::Logger::logger.resetCpuClockToCurrentTime();
// update the cell values
l_wavePropgationBlock.updateUnknowns(l_maxTimeStepWidthGlobal);
// update the cpu and CPU-communication time in the logger
tools::Logger::logger.updateCpuTime();
// tools::Logger::logger.updateCpuTime();
tools::Logger::logger.updateCpuCommunicationTime();
// update simulation time with time step width.
......
......@@ -63,6 +63,7 @@
* Main program for the simulation on a single SWE_WavePropagationBlock.
*/
int main( int argc, char** argv ) {
/**
* Initialization.
*/
......@@ -231,7 +232,7 @@ int main( int argc, char** argv ) {
l_wavePropgationBlock.setGhostLayer();
// reset the cpu clock
tools::Logger::logger.resetCpuClockToCurrentTime();
//tools::Logger::logger.resetCpuClockToCurrentTime();
// approximate the maximum time step
// 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 ) {
l_wavePropgationBlock.updateUnknowns(l_maxTimeStepWidth);
// update the cpu time in the logger
tools::Logger::logger.updateCpuTime();
//tools::Logger::logger.updateCpuTime();
// update simulation time with time step width.
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