diff options
author | Chris Dyer <prguest11@taipan.cs> | 2012-03-07 20:13:58 +0000 |
---|---|---|
committer | Chris Dyer <prguest11@taipan.cs> | 2012-03-07 20:13:58 +0000 |
commit | 69c69c19ce527c0bc20f17e80fea0f779e45095d (patch) | |
tree | 6f72f2063b83ccc3b929530f6367adb5b2633cc9 /training | |
parent | e5d07b5b4e79a10d901d7c71e3e869803e145e42 (diff) |
more mpi fixes
Diffstat (limited to 'training')
-rw-r--r-- | training/mpi_flex_optimize.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/training/mpi_flex_optimize.cc b/training/mpi_flex_optimize.cc index d98ea4dc..a9197208 100644 --- a/training/mpi_flex_optimize.cc +++ b/training/mpi_flex_optimize.cc @@ -272,6 +272,7 @@ int main(int argc, char** argv) { int iter = -1; bool converged = false; + vector<double> gg; while (!converged) { #ifdef HAVE_MPI mpi::timer timer; @@ -354,13 +355,14 @@ int main(int argc, char** argv) { // g /= (size_per_proc * size); if (!o) o.reset(new LBFGSOptimizer(FD::NumFeats(), lbfgs_memory_buffers)); - vector<double> gg(FD::NumFeats()); + gg.clear(); + gg.resize(FD::NumFeats()); if (gg.size() != cur_weights.size()) { cur_weights.resize(gg.size()); } for (SparseVector<double>::const_iterator it = g.begin(); it != g.end(); ++it) if (it->first) { gg[it->first] = it->second; } g.clear(); double r = ApplyRegularizationTerms(regularization_strength, - time_series_strength * (iter == 0 ? 0.0 : 1.0), + time_series_strength, // * (iter == 0 ? 0.0 : 1.0), cur_weights, prev_weights, &gg); @@ -375,10 +377,9 @@ int main(int argc, char** argv) { o->Optimize(obj, gg, &cur_weights); } #ifdef HAVE_MPI - // broadcast(world, x, 0); + broadcast(world, cur_weights, 0); broadcast(world, converged, 0); world.barrier(); - if (rank == 0) { cerr << " ELAPSED TIME THIS ITERATION=" << timer.elapsed() << endl; } #endif } prev_weights = cur_weights; |