new option to dump FDTD simulation statistics
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
This commit is contained in:
parent
ba474f6068
commit
2966ba2902
@ -517,5 +517,7 @@ void openEMS_FDTD_MPI::RunFDTD()
|
||||
{
|
||||
cout << "Time for " << FDTD_Eng->GetNumberOfTimesteps() << " iterations with " << FDTD_Op->GetNumberCells() << " cells : " << t_diff << " sec" << endl;
|
||||
cout << "Speed: " << speed*(double)FDTD_Eng->GetNumberOfTimesteps()/t_diff << " MCells/s " << endl;
|
||||
|
||||
DumpStatistics("openEMS_stats.txt", t_diff);
|
||||
}
|
||||
}
|
||||
|
3
main.cpp
3
main.cpp
@ -84,7 +84,8 @@ int main(int argc, char *argv[])
|
||||
cout << "\t\t--engine=multithreaded\t\tengine using compressed operator + sse vector extensions + multithreading" << endl;
|
||||
#endif
|
||||
cout << "\t--numThreads=<n>\tForce use n threads for multithreaded engine (needs: --engine=multithreaded)" << endl;
|
||||
cout << "\t--no-simulation\tonly run preprocessing; do not simulate" << endl;
|
||||
cout << "\t--no-simulation\t\tonly run preprocessing; do not simulate" << endl;
|
||||
cout << "\t--dump-statistics\tdump simulation statistics to 'openEMS_stats.txt'" << endl;
|
||||
cout << "\n\t Additional global arguments " << endl;
|
||||
g_settings.ShowArguments(cout,"\t");
|
||||
cout << endl;
|
||||
|
33
openems.cpp
33
openems.cpp
@ -17,6 +17,8 @@
|
||||
|
||||
#include "openems.h"
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include "tools/array_ops.h"
|
||||
#include "tools/useful.h"
|
||||
#include "FDTD/operator_cylinder.h"
|
||||
@ -66,6 +68,7 @@ openEMS::openEMS()
|
||||
DebugOp = false;
|
||||
m_debugCSX = false;
|
||||
m_debugBox = m_debugPEC = m_no_simulation = false;
|
||||
m_DumpStats = false;
|
||||
endCrit = 1e-6;
|
||||
m_OverSampling = 4;
|
||||
|
||||
@ -182,6 +185,12 @@ bool openEMS::parseCommandLineArgument( const char *argv )
|
||||
m_no_simulation = true;
|
||||
return true;
|
||||
}
|
||||
else if (strcmp(argv,"--dump-statistics")==0)
|
||||
{
|
||||
cout << "openEMS - dump simulation statistics to 'openEMS_stats.txt'" << endl;
|
||||
m_DumpStats = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -843,4 +852,28 @@ void openEMS::RunFDTD()
|
||||
|
||||
cout << "Time for " << FDTD_Eng->GetNumberOfTimesteps() << " iterations with " << FDTD_Op->GetNumberCells() << " cells : " << t_diff << " sec" << endl;
|
||||
cout << "Speed: " << speed*(double)FDTD_Eng->GetNumberOfTimesteps()/t_diff << " MCells/s " << endl;
|
||||
|
||||
DumpStatistics("openEMS_stats.txt", t_diff);
|
||||
}
|
||||
|
||||
bool openEMS::DumpStatistics(const string& filename, double time)
|
||||
{
|
||||
ofstream stat_file;
|
||||
stat_file.open(filename.c_str());
|
||||
|
||||
if (!stat_file.is_open())
|
||||
{
|
||||
cerr << "openEMS::DumpStatistics: Error, opening file failed..." << endl;
|
||||
return false;
|
||||
}
|
||||
stat_file << std::setprecision( 16 );
|
||||
stat_file << FDTD_Op->GetNumberCells() << "\t% number of cells" << endl;
|
||||
stat_file << FDTD_Op->GetTimestep() << "\t% timestep (s)" << endl;
|
||||
stat_file << FDTD_Eng->GetNumberOfTimesteps() << "\t% number of iterations" << endl;
|
||||
stat_file << FDTD_Eng->GetNumberOfTimesteps()*FDTD_Op->GetTimestep() << "\t% total numercial time (s)" << endl;
|
||||
stat_file << time << "\t% simulation time (s)" << endl;
|
||||
stat_file << (double)FDTD_Op->GetNumberCells()*(double)FDTD_Eng->GetNumberOfTimesteps()/time << "\t% speed (cells/s)" << endl;
|
||||
|
||||
stat_file.close();
|
||||
return true;
|
||||
}
|
||||
|
@ -74,11 +74,15 @@ protected:
|
||||
|
||||
//! Number of Timesteps
|
||||
unsigned int NrTS;
|
||||
|
||||
// some command line flags
|
||||
bool Enable_Dumps;
|
||||
bool DebugMat;
|
||||
bool DebugOp;
|
||||
bool m_debugCSX;
|
||||
bool m_DumpStats;
|
||||
bool m_debugBox, m_debugPEC, m_no_simulation;
|
||||
|
||||
double endCrit;
|
||||
int m_OverSampling;
|
||||
Operator* FDTD_Op;
|
||||
@ -108,6 +112,9 @@ protected:
|
||||
|
||||
//! Setup all processings.
|
||||
virtual bool SetupProcessing();
|
||||
|
||||
//! Dump statistics to file
|
||||
virtual bool DumpStatistics(const string& filename, double time);
|
||||
};
|
||||
|
||||
#endif // OPENEMS_H
|
||||
|
Loading…
Reference in New Issue
Block a user