[Swift-commit] r5519 - SwiftApps/SciColSim

wilde at ci.uchicago.edu wilde at ci.uchicago.edu
Tue Jan 24 14:41:30 CST 2012


Author: wilde
Date: 2012-01-24 14:41:30 -0600 (Tue, 24 Jan 2012)
New Revision: 5519

Modified:
   SwiftApps/SciColSim/optimizer.cpp
   SwiftApps/SciColSim/testopt1.py
Log:
Added timings, minor output adjustment. Test script improved.

Modified: SwiftApps/SciColSim/optimizer.cpp
===================================================================
--- SwiftApps/SciColSim/optimizer.cpp	2012-01-24 19:25:34 UTC (rev 5518)
+++ SwiftApps/SciColSim/optimizer.cpp	2012-01-24 20:41:30 UTC (rev 5519)
@@ -1268,6 +1268,10 @@
     
     double Loss=0., LossSquare=0.;
     
+    timeval startTime, endTime;
+    double elapsedTime;
+    gettimeofday(&startTime, NULL);
+
     for(int i=0; i<Nworkers; i++){
         for(int j=0; j<5; j++){
             un[i]->set_parameter(params[j],j);
@@ -1316,6 +1320,12 @@
     Res.first=Loss;
     Res.second=two_std;
     
+    gettimeofday(&endTime, NULL);
+    elapsedTime = (endTime.tv_sec - startTime.tv_sec) * 1000.0;      // sec to ms
+    elapsedTime += (endTime.tv_usec - startTime.tv_usec) / 1000.0;   // us to ms
+    elapsedTime /= 1000.;
+    cout << "multi_loss(N=" << N << ", target=" << un[0]->get_target() << ") elapsed time: " << elapsedTime << " seconds " << elapsedTime/60. << " minutes\n\n";
+
     return Res;
     
     
@@ -1727,7 +1737,7 @@
     elapsedTime = (t2.tv_sec - t1.tv_sec) * 1000.0;      // sec to ms
     elapsedTime += (t2.tv_usec - t1.tv_usec) / 1000.0;   // us to ms
     elapsedTime /= 1000.;
-    cout << elapsedTime << " seconds \n .....(" << elapsedTime/60. << " minutes)\n\n";
+    cout << "\n*** optimizer completed, elapsed time=" << elapsedTime << " seconds " << elapsedTime/60. << " minutes)\n\n";
     
     //.....................
     

Modified: SwiftApps/SciColSim/testopt1.py
===================================================================
--- SwiftApps/SciColSim/testopt1.py	2012-01-24 19:25:34 UTC (rev 5518)
+++ SwiftApps/SciColSim/testopt1.py	2012-01-24 20:41:30 UTC (rev 5519)
@@ -1,13 +1,13 @@
 #! /usr/bin/env python -u
 #                      -u => run unbuffered
 
-import os
+import os, sys
 
 app              = "./orig-optimizer";     # For Mac only: original code (+1 loop fix) using Grnd Central Dispatch
 app              = "./dispatch-optimizer"; # For Mac only: sing Grand Central Dispatch
 app              = "./openmp-optimizer";   # For Mac or Linux: Using OpenMP (Default)
 
-app              = "./orig-optimizer";
+app              = "./dispatch-optimizer";
 
 # FULL INITIAL TEST PARAMETERS from Andrey
 
@@ -39,10 +39,10 @@
 for target in range(startTarget,endTarget,incrTarget):
   for i in range(optimizerRepeats):
     args = app + " 0 0 4 50 -1 " + str(target) + " 40000 20 " + str(evolveReruns) + \
-      " 2 1 2. 0.01 " + str(annealingSteps) + " 0.3 2.3 1 1 0 0 0 " + NWorkers + " " + operation
+      " 2 1 2. 0.01 " + str(annealingSteps) + " 0.3 2.3 1 1 0 0 0 " + operation + " " + NWorkers
     print("\n**** Calling optimizer: "+args+"\n")
     os.system(args);
-print "Done!"
+print sys.argv[0] + " Done!"
 
 # From older test, using separate file per run:
 #    args = app + " 0 0 4 50 -1 " + str(target) + " 40000 20 " + str(evolveReruns) + \




More information about the Swift-commit mailing list