X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/6f5ec5fdc42f96a8fe95f4b846b163d4dc92e0c8..ba8a9c5fbc92dc95fc99d8078b3474fd2fd5a043:/process.h diff --git a/process.h b/process.h index 586da55..607a6af 100644 --- a/process.h +++ b/process.h @@ -1,25 +1,60 @@ #ifndef PROCESS_H #define PROCESS_H +#define USE_UNORDERED_MAP 1 +//#undef USE_UNORDERED_MAP + #include -#include +#ifdef USE_UNORDERED_MAP +# include +# define MAP_TEMPLATE std::tr1::unordered_map +#else +# include +# define MAP_TEMPLATE std::map +#endif +#include #include "communicator.h" #include "neighbor.h" class process { public: process(int argc, char* argv[]); - ~process() { }; + ~process(); int run(); +protected: + typedef std::vector neigh_type; + typedef std::vector pneigh_type; + + neigh_type neigh; + pneigh_type pneigh; + private: + typedef MAP_TEMPLATE rev_neigh_type; + enum recv_wait_mode { NO_WAIT = 0, WAIT, WAIT_FOR_CLOSE }; + + rev_neigh_type rev_neigh; + communicator comm; - std::vector neigh; + int ctrl_close_pending; + int data_close_pending; + + unsigned iter; + + double prev_load_broadcast; double load; double expected_load; - void receive(); + double sum_of_to_send() const; + virtual double load_balance(double my_load); + void compute(); + void send1_no_bookkeeping(neighbor& nb); + void send1_bookkeeping(neighbor& nb); + void send(); + bool receive(recv_wait_mode wait); + void finalize1(neighbor& nb); + void finalize(); void print_loads(e_xbt_log_priority_t logp = xbt_log_priority_info); };