[Swift-commit] r5513 - SwiftApps/SciColSim
wilde at ci.uchicago.edu
wilde at ci.uchicago.edu
Mon Jan 23 13:13:49 CST 2012
Author: wilde
Date: 2012-01-23 13:13:49 -0600 (Mon, 23 Jan 2012)
New Revision: 5513
Modified:
SwiftApps/SciColSim/Makefile
SwiftApps/SciColSim/optimizer.cpp
Log:
Fix bug in original optimizer which caused the inner loop of
multi_loss() to be executed way too many times - N^2 instead of N -
(per EMAIL circa Oct 16 2011):
> Looking deeper, I think the bug was simply that the first for() statement
> should have enclosed just the parameter setting loop. In other words, the top
> of multi_loss should start with:
>
> for(int i=0; i<Nworkers; i++){
> for(int j=0; j<5; j++){
> un[i]->set_parameter(params[j],j);
> }
> }
>
> Then the real work is done by the next loop:
> for(i=0; i<Nworkers; i++){
Add make targets for raw Mac version.
Modified: SwiftApps/SciColSim/Makefile
===================================================================
--- SwiftApps/SciColSim/Makefile 2012-01-23 18:30:50 UTC (rev 5512)
+++ SwiftApps/SciColSim/Makefile 2012-01-23 19:13:49 UTC (rev 5513)
@@ -1,5 +1,10 @@
-all: toptimizer optimizer Optimizer
+all: macoptimizer
+macoptimizer: optimizer.cpp
+ g++ -I boost_1_47_0 -o optimizer optimizer.cpp
+
+protoall: toptimizer optimizer Optimizer
+
optimizer: optimizer.snap01.cpp
g++ -static -fopenmp -I boost_1_47_0 -o optimizer optimizer.snap01.cpp
Modified: SwiftApps/SciColSim/optimizer.cpp
===================================================================
--- SwiftApps/SciColSim/optimizer.cpp 2012-01-23 18:30:50 UTC (rev 5512)
+++ SwiftApps/SciColSim/optimizer.cpp 2012-01-23 19:13:49 UTC (rev 5513)
@@ -1249,24 +1249,23 @@
double Loss=0., LossSquare=0.;
for(int i=0; i<Nworkers; i++){
-
-
for(int j=0; j<5; j++){
un[i]->set_parameter(params[j],j);
}
+ }
+
+ for(int i=0; i<Nworkers; i++){
- for(int i=0; i<Nworkers; i++){
-
- dispatch_group_async(group, CustomQueues[i], ^{
+ dispatch_group_async(group, CustomQueues[i], ^{
- un[i]->evolve_to_target_and_save(istart, iend, Results, Counters);
- });
+ un[i]->evolve_to_target_and_save(istart, iend, Results, Counters);
+ });
- istart += step;
- iend = min(istart+step,N);
+ std::cout << "queued: i=" << i << " N=" << N << " istart=" << istart << " iend=" << iend << "\n";
+ istart += step;
+ iend = min(istart+step,N);
- }
}
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
//dispatch_release(group);
More information about the Swift-commit
mailing list