Commit dde2a6de authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Disable thread-level logging.

parent cf88c51b
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -243,6 +243,7 @@ void cluster(const string& config_file, const string& data_file, const string& o
#pragma omp barrier
      {
	// 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++) {
	  // 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);
@@ -273,6 +274,11 @@ void cluster(const string& config_file, const string& data_file, const string& o
	  remove(partial_file_name.c_str());
	  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
      tppoanp->close();
@@ -295,8 +301,8 @@ void cluster(const string& config_file, const string& data_file, const string& o
  elapsed = t_end - t_start;
  message = "INFO: Calculation lasted " + to_string(elapsed.count()) + "s.\n";
  logger->log(message);
  logger->log("Finished: output written to " + output_path + "/c_OCLU\n");
  time_logger->log(message);
  logger->log("Finished: output written to " + output_path + "/c_OCLU\n");
  fclose(timing_file);
  delete time_logger;
  delete logger;
@@ -306,7 +312,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
{
  int nxi = sconf->number_of_scales;
  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::time_point<chrono::high_resolution_clock> interval_start, interval_end;
  int jer = 0;
@@ -389,13 +395,13 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
  interval_end = chrono::high_resolution_clock::now();
  elapsed = interval_end - interval_start;
  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();
  invert_matrix(cid->am, ndit, jer, mxndm);
  interval_end = chrono::high_resolution_clock::now();
  elapsed = interval_end - interval_start;
  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) {
    return jer;
    // break; // jxi488 loop: goes to memory clean
@@ -471,7 +477,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
  interval_end = chrono::high_resolution_clock::now();
  elapsed = interval_end - interval_start;
  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();
  double th = sa->th;
  for (int jth486 = 1; jth486 <= sa->nth; jth486++) { // OpenMP portable?
@@ -960,9 +966,9 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
  interval_end = chrono::high_resolution_clock::now();
  elapsed = interval_end - interval_start;
  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;
}
+4 −4
Original line number Diff line number Diff line
@@ -53,11 +53,11 @@ void Logger::flush(int level) {
}

void Logger::log(const std::string& message, int level) {
#pragma omp critical
  {
  if (level == LOG_ERRO) err(message);
  else {
    if (level >= log_threshold) {
#pragma omp critical
      {
	fprintf(log_output, "%s", message.c_str());
	fflush(log_output);
      }