From: Raphael Couturier Date: Tue, 20 Sep 2011 12:57:07 +0000 (+0200) Subject: makhoul3 X-Git-Tag: exp_20120216~47 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/0ebfaf6eb40a90d31baa3813c891eb7261e818d2?hp=710cda1670b34cba909612c80f37549a3ede6724 makhoul3 --- diff --git a/Experimentations/rc_test_a_lance b/Experimentations/rc_test_a_lance index 39de54f..eb5876b 100644 --- a/Experimentations/rc_test_a_lance +++ b/Experimentations/rc_test_a_lance @@ -29,7 +29,22 @@ cd Experimentation -#test avec plus de neouds, c'est enfin best qui va plus vite, meme s'il effectue plus d'échange +#test avec plus de noeuds, c'est enfin best qui va plus vite, meme s'il effectue plus d'échange ../loba -c1e6,0 -C1e4,0 -M10 -Tline -a2best -N0 -L-1000 -t10000 cluster256.xml -l100 -b -Z ../loba -c1e6,0 -C1e4,0 -M10 -Tline -abest -N0 -L-1000 -t10000 cluster256.xml -l100 -b -Z -../loba -c1e6,0 -C1e4,0 -M10 -Tline -amakhoul -N0 -L-1000 -t10000 cluster256.xml -l100 -b -Z \ No newline at end of file +../loba -c1e6,0 -C1e4,0 -M10 -Tline -amakhoul -N0 -L-1000 -t10000 cluster256.xml -l100 -b -Z + +#tres leger avant pour best en calcul, avant pour makhoul en comm + +../loba -c1e6,0 -C1e4,0 -M10 -Tline -a2best -N0 -L-1000 -t10000 cluster256.xml -l100 -b -Z -R -r34 +../loba -c1e6,0 -C1e4,0 -M10 -Tline -abest -N0 -L-1000 -t10000 cluster256.xml -l100 -b -Z -R -r 34 +../loba -c1e6,0 -C1e4,0 -M10 -Tline -amakhoul -N0 -L-1000 -t10000 cluster256.xml -l100 -b -Z -R -r34 + +# kifkif +../loba -c1e8,0 -C1e4,0 -M10 -Tline -abest -N0 -L-1000 -t10000 cluster256.xml -l100 -b -Z -R -r 34 +../loba -c1e8,0 -C1e4,0 -M10 -Tline -amakhoul -N0 -L-1000 -t10000 cluster256.xml -l100 -b -Z -R -r34 + + +#idem calcul, makhoul bcp - de comm +../loba -c1e6,0 -C1e4,0 -M10 -Thcube -abest -N0 -L-1000 -t2000 cluster256.xml -l100 -b -Z -R -r 34 +../loba -c1e6,0 -C1e4,0 -M10 -Thcube -amakhoul -N0 -L-1000 -t2000 cluster256.xml -l100 -b -Z -R -r34 \ No newline at end of file diff --git a/loba_makhoul3.cpp b/loba_makhoul3.cpp new file mode 100644 index 0000000..9517002 --- /dev/null +++ b/loba_makhoul3.cpp @@ -0,0 +1,37 @@ +#include + +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(loba); + +#include "loba_makhoul3.h" + +void loba_makhoul3::load_balance() +{ + pneigh_sort_by_load(std::less()); + print_loads_p(false, xbt_log_priority_debug); + + int nb_less_loaded=0; + for (unsigned i = 0 ; i < pneigh.size() ; ++i) { + nb_less_loaded+=(pneigh[i]->get_load()<=get_load()); + } + + double alpha = 1.0 / (nb_less_loaded ); + double my_load = get_load(); + bool cont = true; + for (unsigned i = 0 ; + cont && i < pneigh.size() && pneigh[i]->get_load() < my_load ; ++i) { + + double delta = my_load - pneigh[i]->get_load(); + double transfer = alpha * delta; + XBT_DEBUG("delta = %g ; transfer = %g", delta, transfer); + if (pneigh[i]->get_load() + transfer <= get_load() - transfer) { + send(pneigh[i], transfer); + XBT_DEBUG("sent %g to %s", transfer, pneigh[i]->get_name()); + } else { + cont = false; + } + } +} + +// Local variables: +// mode: c++ +// End: diff --git a/loba_makhoul3.h b/loba_makhoul3.h new file mode 100644 index 0000000..2aa7085 --- /dev/null +++ b/loba_makhoul3.h @@ -0,0 +1,19 @@ +#ifndef LOBA_MAKHOUL3_H +#define LOBA_MAKHOUL3_H + +#include "process.h" + +class loba_makhoul3: public process { +public: + loba_makhoul3(int argc, char* argv[]): process(argc, argv) { } + ~loba_makhoul3() { } + +private: + void load_balance(); +}; + +#endif //!LOBA_MAKHOUL3_H + +// Local variables: +// mode: c++ +// End: diff --git a/options.cpp b/options.cpp index b387267..482d486 100644 --- a/options.cpp +++ b/options.cpp @@ -17,6 +17,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(main); #include "loba_lln.h" #include "loba_makhoul.h" #include "loba_makhoul2.h" +#include "loba_makhoul3.h" #include "loba_simple.h" #include "misc.h" @@ -96,6 +97,8 @@ namespace opt { loba_makhoul); NOL_INSERT("makhoul2", "balance with Makhoul's source code", loba_makhoul2); + NOL_INSERT("makhoul3", "describe your algorithm here...", + loba_makhoul3); NOL_INSERT("none", "no load-balancing (for testing only)", process); NOL_INSERT("simple", "balance with least loaded neighbor",