- Algorithme 6 (p.111) dans la thèse de Abdallah Makhoul.
+makhoul2
+========
+Comme makhoul, mais la différence est calculée avec la charge courante
+(intégrant donc les envois déjà faits).
+
+Références:
+ - le code source :-(
+ cf. makhoul.txt
+
+
none
====
Aucun équilibrage. Peut-être utile pour tester/déboguer le code.
--- /dev/null
+#include <xbt/log.h>
+
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(loba);
+
+#include "loba_makhoul2.h"
+
+// Note: adapted from Makhoul's code
+
+void loba_makhoul2::load_balance()
+{
+ pneigh_sort_by_load(std::less<double>());
+
+ print_loads_p(false, xbt_log_priority_debug);
+
+ double alpha = 1.0 / (pneigh.size() + 1.0);
+ double neighborLoadMax = 0.0; // maximum load of neighbors to
+ // which something has been sent
+ for (unsigned i = 0;
+ i < pneigh.size() && pneigh[i]->get_load() < get_load(); i++) {
+ double delta = get_load() - pneigh[i]->get_load();
+
+ // do not violate ping-pong condition
+ double transfer = std::min(alpha * delta, get_load() - neighborLoadMax);
+ XBT_DEBUG("delta = %g ; transfer = %g", delta, transfer);
+
+ send(pneigh[i], transfer);
+ XBT_DEBUG("sent %g to %s", transfer, pneigh[i]->get_name());
+
+ double newNeighborLoad = pneigh[i]->get_load();
+ if (newNeighborLoad > neighborLoadMax)
+ neighborLoadMax = newNeighborLoad;
+ }
+}
+
+// Local variables:
+// mode: c++
+// End:
--- /dev/null
+#ifndef LOBA_MAKHOUL2_H
+#define LOBA_MAKHOUL2_H
+
+#include "process.h"
+
+class loba_makhoul2: public process {
+public:
+ loba_makhoul2(int argc, char* argv[]): process(argc, argv) { }
+ ~loba_makhoul2() { }
+
+private:
+ void load_balance();
+};
+
+#endif //!LOBA_MAKHOUL2_H
+
+// Local variables:
+// mode: c++
+// End:
#include "loba_simple.h"
#include "loba_fairstrategy.h"
#include "loba_makhoul.h"
+#include "loba_makhoul2.h"
#include "misc.h"
#include "options.h"
loba_fairstrategy);
NOL_INSERT("makhoul", "balance with Makhoul's PhD algorithm",
loba_makhoul);
+ NOL_INSERT("makhoul2", "balance with Makhoul's source code",
+ loba_makhoul2);
NOL_INSERT("none", "no load-balancing (for testing only)",
process);
NOL_INSERT("simple", "balance with least loaded neighbor",