From: Arnaud Giersch Date: Mon, 2 Jul 2012 11:04:48 +0000 (+0200) Subject: MSG type names got renamed in SimGrid 3.8. X-Git-Tag: v0.3~8 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/bccf459a375af533649be3e8036f5040769cd594?ds=inline MSG type names got renamed in SimGrid 3.8. --- diff --git a/communicator.cpp b/communicator.cpp index 2ba91a0..5abb543 100644 --- a/communicator.cpp +++ b/communicator.cpp @@ -30,7 +30,7 @@ communicator::communicator() communicator::~communicator() { - m_task_t task; + msg_task_t task; XBT_DEBUG("send finalize to receiver/ctrl"); task = MSG_task_create("finalize", 0.0, 0, NULL); @@ -52,7 +52,7 @@ communicator::~communicator() msg_comm_t communicator::real_send(const char* dest, message* msg) { XBT_DEBUG("send %s to %s", msg->to_string().c_str(), dest); - m_task_t task = MSG_task_create("message", 0.0, msg->get_size(), msg); + msg_task_t task = MSG_task_create("message", 0.0, msg->get_size(), msg); // MSG_task_set_category(task, // msg->get_type() == message::DATA ? // TRACE_CAT_DATA : TRACE_CAT_CTRL); @@ -81,7 +81,7 @@ void communicator::receiver() xbt_dynar_t comms = xbt_dynar_new(sizeof(msg_comm_t), NULL); struct channel { msg_comm_t comm; - m_task_t task; + msg_task_t task; const char* mbox; message_queue& received; }; diff --git a/communicator.h b/communicator.h index b79210c..8f3f6bf 100644 --- a/communicator.h +++ b/communicator.h @@ -8,6 +8,7 @@ #include "hostdata.h" #include "messages.h" #include "msg_thread.h" +#include "simgrid_features.h" class communicator { public: @@ -37,10 +38,10 @@ public: // Try to get a message. Returns true on success. // Parameter "timeout" may be 0 for non-blocking operation, -1 for // infinite waiting, or any positive timeout. - bool ctrl_recv(message*& msg, m_host_t& from, double timeout) { + bool ctrl_recv(message*& msg, msg_host_t& from, double timeout) { return ctrl_received.pop(msg, from, timeout); } - bool data_recv(message*& msg, m_host_t& from, double timeout) { + bool data_recv(message*& msg, msg_host_t& from, double timeout) { return data_received.pop(msg, from, timeout); } diff --git a/hostdata.cpp b/hostdata.cpp index 5498ba8..403e13c 100644 --- a/hostdata.cpp +++ b/hostdata.cpp @@ -21,11 +21,11 @@ void hostdata::create() #if SIMGRID_VERSION < MAKE_SIMGRID_VERSION(3, 7, 0) int nhosts = MSG_get_host_number(); - m_host_t* host_list = MSG_get_host_table(); + msg_host_t* host_list = MSG_get_host_table(); #else // API changed with SG 3.7.0 xbt_dynar_t host_dynar = MSG_hosts_as_dynar(); int nhosts = xbt_dynar_length(host_dynar); - m_host_t* host_list = static_cast(xbt_dynar_to_array(host_dynar)); + msg_host_t* host_list = static_cast(xbt_dynar_to_array(host_dynar)); #endif // only sort hosts for automatically created deployment if (opt::auto_depl::enabled) @@ -51,7 +51,7 @@ void hostdata::destroy() // hosts are automatically destroyed... } -hostdata::hostdata(m_host_t host) +hostdata::hostdata(msg_host_t host) : name(MSG_host_get_name(host)) , ctrl_mbox(std::string(name) + "_ctrl") , data_mbox(std::string(name) + "_data") diff --git a/hostdata.h b/hostdata.h index 722b2bc..aa7884c 100644 --- a/hostdata.h +++ b/hostdata.h @@ -4,6 +4,7 @@ #include #include #include +#include "simgrid_features.h" // Helper class that associates instances of itself with each host. // Facilitate global operations on hosts, and retreiving of host name @@ -15,7 +16,7 @@ public: static size_t size() { return hosts.size(); } static const hostdata& at(size_t i) { return hosts[i]; } - hostdata(m_host_t host); + hostdata(msg_host_t host); ~hostdata(); const char* get_name() const { return name; } diff --git a/main.cpp b/main.cpp index 9799ff8..9b0f8bf 100644 --- a/main.cpp +++ b/main.cpp @@ -203,7 +203,7 @@ int main(int argc, char* argv[]) double simulated_time = -1.0; timestamp elapsed_time(timestamp::wallclock_time); timestamp simulation_time(timestamp::cpu_time); - MSG_error_t res; + msg_error_t res; elapsed_time.start(); simulation_time.start(); diff --git a/messages.cpp b/messages.cpp index e9fbced..93bdc4e 100644 --- a/messages.cpp +++ b/messages.cpp @@ -51,7 +51,7 @@ std::string message::to_string() return oss.str(); } -void message_queue::push(m_task_t task) +void message_queue::push(msg_task_t task) { if (queue.push(task)) { // list was empty, the push must be signaled @@ -61,9 +61,9 @@ void message_queue::push(m_task_t task) } } -bool message_queue::pop(message*& msg, m_host_t& from, double timeout) +bool message_queue::pop(message*& msg, msg_host_t& from, double timeout) { - m_task_t task; + msg_task_t task; if (!queue.try_pop(task)) { if (timeout == 0.0) return false; diff --git a/messages.h b/messages.h index 1886301..cc6efbc 100644 --- a/messages.h +++ b/messages.h @@ -4,6 +4,7 @@ #include #include #include +#include "simgrid_features.h" #include "synchro.h" #include "sync_queue.h" @@ -30,12 +31,12 @@ private: class message_queue { public: // Push a message on queue - void push(m_task_t task); + void push(msg_task_t task); // Try to pop a message. Returns true on success. // Parameter "timeout" may be 0 for non-blocking operation, -1 for // infinite waiting, or any positive timeout. - bool pop(message*& msg, m_host_t& from, double timeout); + bool pop(message*& msg, msg_host_t& from, double timeout); bool empty() const { return queue.empty(); } size_t size() const { return queue.size(); } @@ -43,7 +44,7 @@ public: private: mutex_t mutex; condition_t cond; - sync_queue queue; + sync_queue queue; }; #endif // !MESSAGES_H diff --git a/msg_thread.h b/msg_thread.h index 0fee6ea..69ce02b 100644 --- a/msg_thread.h +++ b/msg_thread.h @@ -3,6 +3,7 @@ #include #include +#include "simgrid_features.h" #include "synchro.h" class msg_thread { @@ -20,7 +21,7 @@ private: bool started; mutex_t mutex; condition_t cond; - m_process_t thread; + msg_process_t thread; std::string thread_name; void run_wrapper(); diff --git a/process.cpp b/process.cpp index 6c72d45..6aceea4 100644 --- a/process.cpp +++ b/process.cpp @@ -58,7 +58,7 @@ process::process(int argc, char* argv[]) pneigh.reserve(neigh.size()); for (unsigned i = 0 ; i < neigh.size() ; i++) { neighbor* ptr = &neigh[i]; - m_host_t host = MSG_get_host_by_name(ptr->get_name()); + msg_host_t host = MSG_get_host_by_name(ptr->get_name()); pneigh.push_back(ptr); rev_neigh.insert(std::make_pair(host, ptr)); } @@ -256,7 +256,7 @@ void process::compute_loop() idle_duration += MSG_get_clock() - idle_since_date; ++comp_iter; double flops = opt::comp_cost(real_load); - m_task_t task = MSG_task_create("computation", flops, 0.0, NULL); + msg_task_t task = MSG_task_create("computation", flops, 0.0, NULL); // MSG_task_set_category(task, TRACE_CAT_COMP); XBT_DEBUG("compute %g flop%s", flops, ESSE(flops)); MSG_task_execute(task); @@ -465,7 +465,7 @@ void process::data_close(neighbor& nb) void process::ctrl_receive(double timeout) { message* msg; - m_host_t from; + msg_host_t from; XBT_DEBUG("%sblocking receive on ctrl (%g)", "\0non-" + !timeout, timeout); while (ctrl_close_pending && comm.ctrl_recv(msg, from, timeout)) { @@ -479,7 +479,7 @@ void process::ctrl_receive(double timeout) void process::data_receive(double timeout) { message* msg; - m_host_t from; + msg_host_t from; XBT_DEBUG("%sblocking receive on data (%g)", "\0non-" + !timeout, timeout); while (data_close_pending && comm.data_recv(msg, from, timeout)) { @@ -490,7 +490,7 @@ void process::data_receive(double timeout) } } -void process::handle_message(message* msg, m_host_t from) +void process::handle_message(message* msg, msg_host_t from) { switch (msg->get_type()) { case message::CTRL: { diff --git a/process.h b/process.h index 14d514f..25d6c44 100644 --- a/process.h +++ b/process.h @@ -22,6 +22,7 @@ #include "msg_thread.h" #include "neighbor.h" #include "options.h" +#include "simgrid_features.h" #include "synchro.h" class process { @@ -102,10 +103,10 @@ private: static std::atomic convergence_counter; - typedef MAP_TEMPLATE rev_neigh_type; + typedef MAP_TEMPLATE rev_neigh_type; neigh_type neigh; // list of neighbors (do not alter // after construction!) - rev_neigh_type rev_neigh; // map m_host_t -> neighbor + rev_neigh_type rev_neigh; // map msg_host_t -> neighbor communicator comm; // communicator for this process int ctrl_close_pending; // number of "close" messages to wait @@ -198,7 +199,7 @@ private: // infinite waiting, or any positive timeout. void ctrl_receive(double timeout); void data_receive(double timeout); - void handle_message(message* msg, m_host_t from); + void handle_message(message* msg, msg_host_t from); }; template diff --git a/simgrid_features.h b/simgrid_features.h index 2f32a9b..114fc09 100644 --- a/simgrid_features.h +++ b/simgrid_features.h @@ -9,6 +9,10 @@ #if SIMGRID_VERSION < MAKE_SIMGRID_VERSION(3, 8, 0) // ==== SG < 3.8 === // # define MSG_init(argc, argv) MSG_global_init(argc, argv) +# define msg_error_t MSG_error_t +# define msg_host_t m_host_t +# define msg_process_t m_process_t +# define msg_task_t m_task_t #endif // ============================================================== // #endif // !SIMGRID_FEATURES_H