...
 
Commits (5)
......@@ -521,7 +521,10 @@ String
DistributedMesh< Grid< Dimension, Real, Device, Index > >::
printProcessDistr() const
{
return convertToString(this->domainDecomposition[0])+String("-")+convertToString(this->domainDecomposition[1])+String("-")+convertToString(this->domainDecomposition[2]);
String res = convertToString(this->domainDecomposition[0]);
for(int i=1; i<Dimension; i++)
res=res+String("-")+convertToString(this->domainDecomposition[i]);
return res;
};
template< int Dimension, typename Real, typename Device, typename Index >
......
......@@ -25,6 +25,11 @@
#include <TNL/Solvers/PDE/SemiImplicitTimeStepper.h>
#include <TNL/Solvers/PDE/PDESolverTypeResolver.h>
#include <omp.h>
#include <sstream>
#include <chrono>
#include <thread>
namespace TNL {
namespace Solvers {
......@@ -390,6 +395,48 @@ bool SolverStarter< ConfigTag > :: runPDESolver( Problem& problem,
writeEpilog( logFile, solver );
logFile.close();
//write log in common logfile
//char * of dimension...
std::stringstream str;
str << problem.getMesh()->getDistributedMesh()->getGlobalGrid().getDimensions();
char buf[ 2048 ];
snprintf( buf,2048, "Dim: %d; Dof: %s; TimeStep: %f; TimeFinal: %f; MPI: %d; Distr: %s; OpenMPperMPI: %d; Device: %s; RunTime: %f; ComputeTime: %f; IOTime: %f;\n",
problem.getMesh()->getMeshDimension(),//Dim
str.str().c_str(),//Dof - size
parameters.getParameter< double >( "time-step" ),
parameters.getParameter< double >( "final-time"),
Problem::CommunicatorType::GetSize(Problem::CommunicatorType::AllGroup),//MPI count
problem.getMesh()->getDistributedMesh()->printProcessDistr().getString(), //MPI distr
omp_get_num_threads(), //OMPperMPI
parameters.getParameter< String >( "device" ).getString(),
this->totalTimer.getRealTime(),
this->computeTimer.getRealTime(),
this->ioTimer.getRealTime()
);
std::cout <<std::endl << std::endl<< buf <<std::endl;
if(Problem::CommunicatorType::GetRank(Problem::CommunicatorType::AllGroup)==0)
{
std::ofstream ofs;
for(int i=0;i<20;i++)
{
ofs.open ("/home/hanouvit/heatequationtest.log", std::ofstream::out | std::ofstream::app);
if(ofs.fail())
{
std::this_thread::sleep_for(std::chrono::seconds(5));
continue;
}
ofs << buf;
ofs.close();
break;
}
}
return returnCode;
}
......@@ -417,6 +464,7 @@ bool SolverStarter< ConfigTag > :: writeEpilog( std::ostream& str, const Solver&
sprintf( buf, "%f %%", 100 * ( ( double ) this->totalTimer.getCPUTime() ) / this->totalTimer.getRealTime() );
logger.writeParameter< char* >( "CPU usage:", buf );
logger.writeSeparator();
return true;
}
......