]> AND Private Git Repository - loba.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Do not call flush automatically in communcator::send...
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 12 Jan 2011 12:58:26 +0000 (13:58 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 12 Jan 2011 12:58:26 +0000 (13:58 +0100)
... and insert appropriate calls in process methods.

The goal is here to destroy achieved communications as soon as
possible, and avoid a bug in SimGrid 3.5 that make the simulation
very slow when there are many communications.

communicator.cpp
communicator.h
options.cpp
process.cpp

index 0f9bc7eabb8cac225cf4acf9b0cfff85bc161ae9..753b04a98ed4e529ae31dd38e6d57b85962fd54e 100644 (file)
@@ -21,13 +21,10 @@ std::string message::to_string()
     return oss.str();
 }
 
-int communicator::send_count_before_flush = 4;
-
 communicator::communicator()
     : host((hostdata* )MSG_host_get_data(MSG_host_self()))
     , mutex(xbt_mutex_init())
     , cond(xbt_cond_init())
-    , send_counter(0)
     , ctrl_task(NULL)
     , ctrl_comm(NULL)
     , data_task(NULL)
@@ -83,11 +80,6 @@ void communicator::send(const char* dest, message* msg)
     m_task_t task = MSG_task_create("message", 0.0, msg_size, msg);    
     msg_comm_t comm = MSG_task_isend(task, dest);
     sent_comm.push_back(comm);
-
-    if (++send_counter >= send_count_before_flush) {
-        flush(false);
-        send_counter = 0;
-    }
 }
 
 bool communicator::recv(message*& msg, m_host_t& from, bool wait)
index b04301ad87574aff718d3fc7b8539d1973183bab..a2f94e5bf9cff2b9766334fde6103c7476c66cc0 100644 (file)
@@ -59,8 +59,6 @@ private:
 
     // List of pending send communications
     std::list<msg_comm_t> sent_comm;
-    static int send_count_before_flush;
-    int send_counter;
 
     // Queue of received messages
     std::queue<m_task_t> received;
@@ -83,12 +81,6 @@ private:
 
     // Used to test if a communication is over, and to destroy it if it is
     static bool comm_test_n_destroy(msg_comm_t comm);
-
-    // Make opt::* functions our friends to provide them an access to
-    // send_count_before_flush
-    friend bool opt::parse_args(int*, char* []);
-    friend void opt::print();
-    friend void opt::usage();
 };
 
 #endif // !COMMUNICATOR_H
index fd9b8f7c435ba6c071b355aa40328f9fccb62b1f..c4ae59a5b4a630006e5c317b9a2fb12270ffd530 100644 (file)
@@ -211,9 +211,6 @@ bool opt::parse_args(int* argc, char* argv[])
         case 'N':
             std::istringstream(optarg) >> opt::auto_depl::nhosts;
             break;
-        case 's':
-            std::istringstream(optarg) >> communicator::send_count_before_flush;
-            break;
         case 'T':
             opt::auto_depl::topology = optarg;
             result = opt_helper::nol_find_prefix(opt::topologies, "topology",
@@ -285,8 +282,6 @@ void opt::print()
     DESCR("maximum number of lb. iterations", "%s",
           h.val_or_string(lb_maxiter, "infinity"));
     DESCR("exit on close", "%s",                h.on_off(exit_on_close));
-    DESCR("send count before flush", "%d",
-          communicator::send_count_before_flush);
     INFO0("`----");
 
 #undef DESCR
@@ -376,10 +371,7 @@ void opt::usage()
               << "        proc : messages from base process class\n"
               << "        loba : messages from load-balancer\n";
 
-    std::clog << "\nMiscellaneous low-level parameters\n";
-    std::clog << o("-s count")
-              << "check for finished comm. every `count' send operation"
-              << " (" << communicator::send_count_before_flush << ")\n";
+    // std::clog << "\nMiscellaneous low-level parameters\n";
 
 #undef so_list
 #undef so
index 53cbb59c7434da4a84beb5d2971e8c98ea7ae910..b6afb49d8b23dded44cf25e0f6e958b77e1d3294 100644 (file)
@@ -227,6 +227,7 @@ void process::send()
                       bind(&process::send1_no_bookkeeping, this, _1));
         prev_load_broadcast = load;
     }
+    comm.flush(false);
 }
 
 void process::receive(bool wait)
@@ -263,6 +264,7 @@ void process::receive(bool wait)
         delete msg;
         wait = false;           // only wait on first recv
     }
+    comm.flush(false);
 }
 
 void process::finalize1(neighbor& nb)
@@ -286,8 +288,10 @@ void process::finalize()
 
     DEBUG2("wait for CLOSE from %lu neighbor%s",
            (unsigned long )neigh.size(), ESSE(neigh.size()));
-    while (may_receive())
+    while (may_receive()) {
+        comm.flush(false);
         receive(true);
+    }
 
     comm.flush(true);
 }