Skip to content
Snippets Groups Projects
Commit dde2a6de authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Disable thread-level logging.

parent cf88c51b
No related branches found
No related tags found
No related merge requests found
...@@ -243,6 +243,7 @@ void cluster(const string& config_file, const string& data_file, const string& o ...@@ -243,6 +243,7 @@ void cluster(const string& config_file, const string& data_file, const string& o
#pragma omp barrier #pragma omp barrier
{ {
// thread 0 already wrote on global files, skip it and take care of appending the others // thread 0 already wrote on global files, skip it and take care of appending the others
chrono::time_point<chrono::high_resolution_clock> t_output_start = chrono::high_resolution_clock::now();
for (int ri = 1; ri < ompnumthreads; ri++) { for (int ri = 1; ri < ompnumthreads; ri++) {
// Giovanni, please add here in this loop code to reopen the temporary files, reread them and append them respectively to the global output and tppoan, before closing them // Giovanni, please add here in this loop code to reopen the temporary files, reread them and append them respectively to the global output and tppoan, before closing them
string partial_file_name = output_path + "/c_OCLU_" + to_string(ri); string partial_file_name = output_path + "/c_OCLU_" + to_string(ri);
...@@ -273,6 +274,11 @@ void cluster(const string& config_file, const string& data_file, const string& o ...@@ -273,6 +274,11 @@ void cluster(const string& config_file, const string& data_file, const string& o
remove(partial_file_name.c_str()); remove(partial_file_name.c_str());
logger->log("done.\n", LOG_DEBG); logger->log("done.\n", LOG_DEBG);
} }
chrono::time_point<chrono::high_resolution_clock> t_output_end = chrono::high_resolution_clock::now();
elapsed = t_output_end - t_output_start;
message = "INFO: Recombining output files took " + to_string(elapsed.count()) + "s.\n";
logger->log(message);
time_logger->log(message);
} }
#endif #endif
tppoanp->close(); tppoanp->close();
...@@ -295,8 +301,8 @@ void cluster(const string& config_file, const string& data_file, const string& o ...@@ -295,8 +301,8 @@ void cluster(const string& config_file, const string& data_file, const string& o
elapsed = t_end - t_start; elapsed = t_end - t_start;
message = "INFO: Calculation lasted " + to_string(elapsed.count()) + "s.\n"; message = "INFO: Calculation lasted " + to_string(elapsed.count()) + "s.\n";
logger->log(message); logger->log(message);
logger->log("Finished: output written to " + output_path + "/c_OCLU\n");
time_logger->log(message); time_logger->log(message);
logger->log("Finished: output written to " + output_path + "/c_OCLU\n");
fclose(timing_file); fclose(timing_file);
delete time_logger; delete time_logger;
delete logger; delete logger;
...@@ -306,7 +312,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf ...@@ -306,7 +312,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
{ {
int nxi = sconf->number_of_scales; int nxi = sconf->number_of_scales;
string message = "INFO: running scale iteration " + to_string(jxi488) + " of " + to_string(nxi) + ".\n"; string message = "INFO: running scale iteration " + to_string(jxi488) + " of " + to_string(nxi) + ".\n";
logger->log(message); // logger->log(message);
chrono::duration<double> elapsed; chrono::duration<double> elapsed;
chrono::time_point<chrono::high_resolution_clock> interval_start, interval_end; chrono::time_point<chrono::high_resolution_clock> interval_start, interval_end;
int jer = 0; int jer = 0;
...@@ -389,13 +395,13 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf ...@@ -389,13 +395,13 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
interval_end = chrono::high_resolution_clock::now(); interval_end = chrono::high_resolution_clock::now();
elapsed = interval_end - interval_start; elapsed = interval_end - interval_start;
message = "INFO: matrix calculation for scale " + to_string(jxi488) + " took " + to_string(elapsed.count()) + "s.\n"; message = "INFO: matrix calculation for scale " + to_string(jxi488) + " took " + to_string(elapsed.count()) + "s.\n";
logger->log(message); // logger->log(message);
interval_start = chrono::high_resolution_clock::now(); interval_start = chrono::high_resolution_clock::now();
invert_matrix(cid->am, ndit, jer, mxndm); invert_matrix(cid->am, ndit, jer, mxndm);
interval_end = chrono::high_resolution_clock::now(); interval_end = chrono::high_resolution_clock::now();
elapsed = interval_end - interval_start; elapsed = interval_end - interval_start;
message = "INFO: matrix inversion for scale " + to_string(jxi488) + " took " + to_string(elapsed.count()) + "s.\n"; message = "INFO: matrix inversion for scale " + to_string(jxi488) + " took " + to_string(elapsed.count()) + "s.\n";
logger->log(message); // logger->log(message);
if (jer != 0) { if (jer != 0) {
return jer; return jer;
// break; // jxi488 loop: goes to memory clean // break; // jxi488 loop: goes to memory clean
...@@ -471,7 +477,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf ...@@ -471,7 +477,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
interval_end = chrono::high_resolution_clock::now(); interval_end = chrono::high_resolution_clock::now();
elapsed = interval_end - interval_start; elapsed = interval_end - interval_start;
message = "INFO: average calculation for scale " + to_string(jxi488) + " took " + to_string(elapsed.count()) + "s.\n"; message = "INFO: average calculation for scale " + to_string(jxi488) + " took " + to_string(elapsed.count()) + "s.\n";
logger->log(message); // logger->log(message);
interval_start = chrono::high_resolution_clock::now(); interval_start = chrono::high_resolution_clock::now();
double th = sa->th; double th = sa->th;
for (int jth486 = 1; jth486 <= sa->nth; jth486++) { // OpenMP portable? for (int jth486 = 1; jth486 <= sa->nth; jth486++) { // OpenMP portable?
...@@ -960,9 +966,9 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf ...@@ -960,9 +966,9 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
interval_end = chrono::high_resolution_clock::now(); interval_end = chrono::high_resolution_clock::now();
elapsed = interval_end - interval_start; elapsed = interval_end - interval_start;
message = "INFO: angle loop for scale " + to_string(jxi488) + " took " + to_string(elapsed.count()) + "s.\n"; message = "INFO: angle loop for scale " + to_string(jxi488) + " took " + to_string(elapsed.count()) + "s.\n";
logger->log(message); // logger->log(message);
logger->log("INFO: finished scale iteration " + to_string(jxi488) + " of " + to_string(nxi) + ".\n"); // logger->log("INFO: finished scale iteration " + to_string(jxi488) + " of " + to_string(nxi) + ".\n");
return jer; return jer;
} }
...@@ -53,11 +53,11 @@ void Logger::flush(int level) { ...@@ -53,11 +53,11 @@ void Logger::flush(int level) {
} }
void Logger::log(const std::string& message, int level) { void Logger::log(const std::string& message, int level) {
#pragma omp critical
{
if (level == LOG_ERRO) err(message); if (level == LOG_ERRO) err(message);
else { else {
if (level >= log_threshold) { if (level >= log_threshold) {
#pragma omp critical
{
fprintf(log_output, "%s", message.c_str()); fprintf(log_output, "%s", message.c_str());
fflush(log_output); fflush(log_output);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment