[Swift-commit] r5614 - SwiftApps/SciColSim

jonmon at ci.uchicago.edu jonmon at ci.uchicago.edu
Tue Feb 14 13:58:14 CST 2012


Author: jonmon
Date: 2012-02-14 13:58:13 -0600 (Tue, 14 Feb 2012)
New Revision: 5614

Modified:
   SwiftApps/SciColSim/Makefile
   SwiftApps/SciColSim/annealing.swift
Log:
Make file compiles with -O3 flag, annealing.swift not prints to separate files based on target innovation file and what repition it is on.



Modified: SwiftApps/SciColSim/Makefile
===================================================================
--- SwiftApps/SciColSim/Makefile	2012-02-14 17:23:40 UTC (rev 5613)
+++ SwiftApps/SciColSim/Makefile	2012-02-14 19:58:13 UTC (rev 5614)
@@ -8,7 +8,7 @@
 	g++ -DP_OPENMP -fopenmp -I boost_1_47_0 -o openmp-optimizer optimizer.cpp
 
 clean:
-	rm -rf openmp-optimizer
+	@rm -rvf openmp-optimizer
 
 endif
 
@@ -17,16 +17,16 @@
 all:	openmp-optimizer dispatch-optimizer orig-optimizer
 
 openmp-optimizer: optimizer.cpp
-	g++ -DP_OPENMP -fopenmp -I boost_1_47_0 -o openmp-optimizer optimizer.cpp
+	g++ -O3 -DP_OPENMP -fopenmp -I boost_1_47_0 -o openmp-optimizer optimizer.cpp
 
 dispatch-optimizer: optimizer.cpp
-	g++ -DP_DISPATCH -I boost_1_47_0 -o dispatch-optimizer optimizer.cpp
+	g++ -O3 -DP_DISPATCH -I boost_1_47_0 -o dispatch-optimizer optimizer.cpp
 
 orig-optimizer: optimizer.orig-mac.cpp
-	g++ -I boost_1_47_0 -o orig-optimizer optimizer.orig-mac.cpp
+	g++ -O3 -I boost_1_47_0 -o orig-optimizer optimizer.orig-mac.cpp
 
 clean:
-	rm -rf mac-openmp-optimizer mac-dispatch-optimizer mac-orig-optimizer
+	@rm -rvf openmp-optimizer dispatch-optimizer orig-optimizer
 
 endif
 

Modified: SwiftApps/SciColSim/annealing.swift
===================================================================
--- SwiftApps/SciColSim/annealing.swift	2012-02-14 17:23:40 UTC (rev 5613)
+++ SwiftApps/SciColSim/annealing.swift	2012-02-14 19:58:13 UTC (rev 5614)
@@ -1,8 +1,8 @@
 import "math";
 import "colortext";
- 
+
 /*
- *TODO: 
+ *TODO:
  */
 
 type file;
@@ -55,7 +55,7 @@
   sumloss()
 */
 
-( file bestfile, file maxfile ) multi_annealing (
+( file bestfile, file maxfile ) multi_annealing ( string some_out_filename,
                                                   float T_start,
                                                   float T_end,
                                                   float Target_rejection,
@@ -88,7 +88,7 @@
     }
 
     iterate iter_i   // number of annealing cycles
-    {    
+    {
         int i = iter_i + 1;
 
         // set new temperature, rejection threshold, and dx values for this cycle
@@ -121,7 +121,7 @@
             }
             tracef( color( Blue, "multi_annealing: AR: New cycle at %i: dx[0-4]=[%f %f %f %f %f]\n" ), i, dx[i][0], dx[i][1], dx[i][2], dx[i][3], dx[i][4] );
         }
-        else  // If not new cycle, set dx[i][*] from previous dx ([i-1]). rejection[i]j] is set later.
+        else  // If not new cycle, set dx[i][*] from previous dx ([i-1]). rejection[i][j] is set later.
         {
             foreach k in [0:NEVOPARAMS-1]
             {
@@ -163,12 +163,13 @@
                 tracef( "multi_annealing: AR: %f +- %f\n", mlres[i][j].loss, mlres[i][j].sdev );
                 // Beyond this point, x[] and dx[] are being set for this i,j
 
-                float ALOT=100000000000.0; // 100,000,000,000. = 10^11
+                float ALOT = 100000000000.0; // 100,000,000,000. = 10^11
 
                 if ( mlres[i][j].loss < ALOT )
                 {
-                    fprintf( "best_opt_some_swift.txt", "%f, %f, %f, %f, %f, %f, %f, %f\n",
-                           target_innov, mlres[i][j].loss, try_x[0], try_x[1], try_x[2], try_x[3], try_x[4], mlres[i][j].sdev );
+                    fprintf( some_out_filename, "%i, %f, %f, %f, %f, %f, %f, %f\n",
+                             @toint(target_innov), mlres[i][j].loss, try_x[0], try_x[1], try_x[2], try_x[3], try_x[4], mlres[i][j].sdev );
+
                     fprintf( "max_dist_swift.txt", color( Red,"multi_annealing: AF: max_dist.txt - tbd\n" ) ); // FIXME: max_dist is global set in evolve()
                 }
                 else
@@ -217,7 +218,7 @@
                     tracef( "multi_annealing: Accepting try_x[j], i=%i j=%i try_x[j]=%f\n", i, j, try_x[j] );
                     float rj[];
                     foreach k in [0:NEVOPARAMS-1]
-                    { 
+                    {
                         if (k <= j)
                         {
                             rj[k] = rejection[i][k]; // Was either set from previous j or just set for this j
@@ -315,18 +316,20 @@
     {
         foreach rep in [1:nreps]
         {
+            string some_out_filename = @strcat( "best.T", @strcat(target_innov), ".R", @strcat(rep), ".txt" );
             file outfile;  // <single_file_mapper; file=@strcat("output/T",target_innov,".R",rep,".out")>;
             file lossfile; // <single_file_mapper; file=@strcat("output/T",target_innov,".R",rep,".loss_data")>;
 
             ( outfile,lossfile ) = multi_annealing(
-						   @tofloat(@arg("tstart", "2.0")),
-						   @tofloat(@arg("tend", "0.01")),
-						   @tofloat(@arg("trejection", "0.3")),
-						   @toint(@arg("evoreruns", "100")),
-						   @tofloat(@arg("startingjump", "2.3")),
-						   [@tofloat(@arg("alphai", "0.0")), @tofloat(@arg("alpham", "0.0")), @tofloat(@arg("beta", "4.0")), @tofloat(@arg("gamma", "50.0")), @tofloat(@arg("delta", "-1.0"))],
-                                                   @tofloat(target_innov),
-						   @toint(@arg("annealingcycles", "50")) );
+                                                    some_out_filename,
+						                            @tofloat(@arg("tstart", "2.0")),
+                                                    @tofloat(@arg("tend", "0.01")),
+                                                    @tofloat(@arg("trejection", "0.3")),
+                                                    @toint(@arg("evoreruns", "100")),
+                                                    @tofloat(@arg("startingjump", "2.3")),
+                                                    [@tofloat(@arg("alphai", "0.0")), @tofloat(@arg("alpham", "0.0")), @tofloat(@arg("beta", "4.0")), @tofloat(@arg("gamma", "50.0")), @tofloat(@arg("delta", "-1.0"))],
+                                                    @tofloat(target_innov),
+                                                    @toint(@arg("annealingcycles", "50")) );
         }
     }
 }




More information about the Swift-commit mailing list