From 648c350aa8b90bd60ca1448bd3bb702004b9ad26 Mon Sep 17 00:00:00 2001 From: philblunsom Date: Mon, 19 Jul 2010 21:07:39 +0000 Subject: MPI stuff: hierarchical topics should work. git-svn-id: https://ws10smt.googlecode.com/svn/trunk@321 ec762483-ff6d-05da-a07a-a48fb63a330f --- gi/pyp-topics/src/mpi-pyp-topics.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gi/pyp-topics/src/mpi-pyp-topics.cc b/gi/pyp-topics/src/mpi-pyp-topics.cc index 50db61c1..3a3c4d67 100644 --- a/gi/pyp-topics/src/mpi-pyp-topics.cc +++ b/gi/pyp-topics/src/mpi-pyp-topics.cc @@ -264,6 +264,19 @@ void MPIPYPTopics::synchronise() { //if (m_am_root) boost::mpi::communicator().barrier(); } // } + // Synchronise the hierarchical topic pyp + MPIPYP::dish_delta_type topic_delta; + m_topic_pyp.synchronise(&topic_delta); + for (MPIPYP::dish_delta_type::const_iterator it=topic_delta.begin(); it != topic_delta.end(); ++it) { + int count = it->second; + if (count > 0) + for (int i=0; i < count; ++i) + m_topic_pyp.increment(it->first, m_topic_p0, rnd); + if (count < 0) + for (int i=0; i > count; --i) + m_topic_pyp.decrement(it->first, rnd); + } + m_topic_pyp.reset_deltas(); } void MPIPYPTopics::decrement(const Term& term, int topic, int level) { -- cgit v1.2.3