[sdpb] 99/233: A few cosmetic changes

Tobias Hansen thansen at moszumanska.debian.org
Thu Mar 9 04:06:25 UTC 2017


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository sdpb.

commit 3dc6128dd42027aab2876d0783663d953eca5833
Author: David Simmons-Duffin <dsd at minerva.sns.ias.edu>
Date:   Fri Oct 24 22:50:20 2014 -0400

    A few cosmetic changes
---
 src/SDPSolver.cpp   |  4 ++--
 src/SDPSolverIO.cpp | 11 ++++++-----
 src/main.cpp        | 12 ++++++------
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/SDPSolver.cpp b/src/SDPSolver.cpp
index c07da7e..0f9de3e 100644
--- a/src/SDPSolver.cpp
+++ b/src/SDPSolver.cpp
@@ -595,9 +595,9 @@ SDPSolverTerminateReason SDPSolver::run(const SDPSolverParameters &parameters,
   
   for (int iteration = 1;; iteration++) {
 
-    if (timers["Save checkpoint"].elapsed().wall >= parameters.checkpointInterval * 1000000000LL)
+    if (timers["Last checkpoint"].elapsed().wall >= parameters.checkpointInterval * 1000000000LL)
       saveCheckpoint(checkpointFile);
-    if (timers["Run solver"].elapsed().wall >= parameters.maxRuntime * 1000000000LL)
+    if (timers["Solver runtime"].elapsed().wall >= parameters.maxRuntime * 1000000000LL)
       return MaxRuntimeExceeded;
 
     choleskyDecomposition(X, XCholesky);
diff --git a/src/SDPSolverIO.cpp b/src/SDPSolverIO.cpp
index 434845a..045d78f 100644
--- a/src/SDPSolverIO.cpp
+++ b/src/SDPSolverIO.cpp
@@ -27,8 +27,8 @@ void printSolverInfo(int iteration,
                      Real primalStepLength,
                      Real dualStepLength,
                      Real betaCorrector) {
-  Real time = Real(timers["Run solver"].elapsed().wall)/1000000000;
-  time_duration td(microseconds(timers["Run solver"].elapsed().wall)/1000);
+  Real time = Real(timers["Solver runtime"].elapsed().wall)/1000000000;
+  time_duration td(microseconds(timers["Solver runtime"].elapsed().wall)/1000);
   std::stringstream ss;
   ss << td;
   gmp_fprintf(stdout,
@@ -48,6 +48,7 @@ void printSolverInfo(int iteration,
 }
 
 ostream& operator<<(ostream& os, const SDPSolverParameters& p) {
+  os << std::boolalpha;
   os << "maxIterations                = " << p.maxIterations                << endl;
   os << "maxRuntime                   = " << p.maxRuntime                   << endl;
   os << "checkpointInterval           = " << p.checkpointInterval           << endl;
@@ -55,7 +56,7 @@ ostream& operator<<(ostream& os, const SDPSolverParameters& p) {
   os << "findDualFeasible             = " << p.findDualFeasible             << endl;
   os << "detectDualFeasibleJump       = " << p.detectDualFeasibleJump       << endl;
   os << "precision(actual)            = " << p.precision << "(" << mpf_get_default_prec() << ")" << endl;
-  os << "maxThreads                   = " << p.maxThreads                   << endl;
+  os << "maxThreads(using)            = " << p.maxThreads << "(" << omp_get_max_threads() << ")" << endl;
   os << "dualityGapThreshold          = " << p.dualityGapThreshold          << endl;
   os << "primalErrorThreshold         = " << p.primalErrorThreshold         << endl;
   os << "dualErrorThreshold           = " << p.dualErrorThreshold           << endl;
@@ -115,7 +116,7 @@ void SDPSolver::saveCheckpoint(const path &checkpointFile) {
   boost::archive::text_oarchive ar(ofs);
   cout << "Saving checkpoint to    : " << checkpointFile << endl;
   boost::serialization::serializeSDPSolverState(ar, x, X, y, Y);
-  timers["Save checkpoint"].start();
+  timers["Last checkpoint"].start();
 }
 
 void SDPSolver::loadCheckpoint(const path &checkpointFile) {
@@ -135,7 +136,7 @@ void SDPSolver::saveSolution(const SDPSolverTerminateReason terminateReason, con
   ofs << "dualityGap      = " << status.dualityGap()    << ";\n";
   ofs << "primalError     = " << status.primalError     << ";\n";
   ofs << "dualError       = " << status.dualError       << ";\n";
-  ofs << "runtime         = " << float(timers["Run solver"].elapsed().wall)/1000000000 << ";\n";
+  ofs << "runtime         = " << float(timers["Solver runtime"].elapsed().wall)/1000000000 << ";\n";
   ofs << "y = " << y << ";\n";
   ofs << "Y = " << Y << ";\n";
   ofs << "x = " << x << ";\n";
diff --git a/src/main.cpp b/src/main.cpp
index ad7921e..4ec7336 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -41,7 +41,6 @@ int solveSDP(const path &sdpFile,
   cout << "SDP file        : " << sdpFile        << endl;
   cout << "out file        : " << outFile        << endl;
   cout << "checkpoint file : " << checkpointFile << endl;
-  cout << "using " << omp_get_max_threads() << " threads." << endl;
 
   cout << "\nParameters:\n";
   cout << parameters << endl;
@@ -54,21 +53,22 @@ int solveSDP(const path &sdpFile,
   else
     solver.initialize(parameters);
 
-  timers["Run solver"].start();
-  timers["Save checkpoint"].start();
+  timers["Solver runtime"].start();
+  timers["Last checkpoint"].start();
   printSolverHeader();
   SDPSolverTerminateReason reason = solver.run(parameters, checkpointFile);
-  timers["Run solver"].stop();
-  timers["Save checkpoint"].stop();
+  timers["Solver runtime"].stop();
 
   cout << "-----" << setfill('-') << setw(100) << std::left << reason << endl << endl;
   cout << solver.status << endl;
-  cout << timers << endl;
 
   if (!parameters.noFinalCheckpoint)
     solver.saveCheckpoint(checkpointFile);
+  timers["Last checkpoint"].stop();
   solver.saveSolution(reason, outFile);
 
+  cout << endl << timers;
+
   return 0;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sdpb.git



More information about the debian-science-commits mailing list