Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
properly deprecate MSG_task_get_flops_amount() and stop using it ourselves
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 22 Nov 2017 00:25:45 +0000 (01:25 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 22 Nov 2017 00:34:45 +0000 (01:34 +0100)
examples/msg/energy-consumption/energy-consumption.c
examples/msg/trace-masterworker/trace-masterworker.c
include/simgrid/msg.h
src/msg/msg_vm.cpp
teshsuite/msg/task_destroy_cancel/task_destroy_cancel.cpp

index cf5c638..19b93a6 100644 (file)
@@ -26,7 +26,7 @@ static int dvfs(int argc, char *argv[])
   // Run a task
   start = MSG_get_clock();
   msg_task_t task1 = MSG_task_create ("t1", 100E6, 0, NULL);
-  XBT_INFO("Run a task of %.0E flops",MSG_task_get_flops_amount(task1));
+  XBT_INFO("Run a task of %.0E flops", MSG_task_get_initial_flops_amount(task1));
   MSG_task_execute (task1);
   MSG_task_destroy(task1);
   XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Current consumption: from %.0fW to %.0fW"
@@ -43,7 +43,7 @@ static int dvfs(int argc, char *argv[])
   // Run a second task
   start = MSG_get_clock();
   task1 = MSG_task_create ("t2", 100E6, 0, NULL);
-  XBT_INFO("Run a task of %.0E flops",MSG_task_get_flops_amount(task1));
+  XBT_INFO("Run a task of %.0E flops", MSG_task_get_initial_flops_amount(task1));
   MSG_task_execute (task1);
   MSG_task_destroy(task1);
   XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
index 2ebf78d..56cb7a3 100644 (file)
@@ -53,9 +53,9 @@ static int worker(int argc, char *argv[])
       MSG_task_destroy(task);
       break;
     }
-    //adding the value returned by MSG_task_get_compute_duration(task)
-    //to the variable "task_computation"
-    TRACE_host_variable_add(MSG_host_get_name(MSG_host_self()), "task_computation", MSG_task_get_flops_amount(task));
+    // adding the value returned by MSG_task_get_compute_duration(task) to the variable "task_computation"
+    TRACE_host_variable_add(MSG_host_get_name(MSG_host_self()), "task_computation",
+                            MSG_task_get_initial_flops_amount(task));
     MSG_task_execute(task);
     MSG_task_destroy(task);
     task = NULL;
index 9fd43cb..b3284ad 100644 (file)
@@ -379,16 +379,10 @@ XBT_PUBLIC(msg_error_t) MSG_process_join(msg_process_t process, double timeout);
 XBT_PUBLIC(msg_error_t) MSG_process_sleep(double nb_sec);
 
 XBT_PUBLIC(void) MSG_task_set_flops_amount(msg_task_t task, double flops_amount);
-/* Unable to compile that without -Werror=deprecated-declarations
-XBT_ATTRIB_DEPRECATED_v321( "Use MSG_task_get_initial_flops_amount if you want to get initial amounts of flops, or "
-                            "Use MSG_task_get_remaining_work_ratio to get task progress (in order "
-                            "to compute progress in flops)") static inline double MSG_task_get_flops_amount(msg_task_t task)
-{
-  return MSG_task_get_flops_amount(task);
-}
-*/
-
-XBT_PUBLIC(double) MSG_task_get_flops_amount(msg_task_t task);
+XBT_ATTRIB_DEPRECATED_v321("Use MSG_task_get_initial_flops_amount if you want to get initial amounts of flops, or "
+                           "Use MSG_task_get_remaining_work_ratio to get task progress (in order "
+                           "to compute progress in flops)") XBT_PUBLIC(double)
+    MSG_task_get_flops_amount(msg_task_t task);
 XBT_PUBLIC(double) MSG_task_get_initial_flops_amount(msg_task_t task);
 XBT_PUBLIC(double) MSG_task_get_remaining_work_ratio(msg_task_t task);
 XBT_PUBLIC(void) MSG_task_set_bytes_amount(msg_task_t task, double bytes_amount);
index 4e485ba..15c3c47 100644 (file)
@@ -367,7 +367,7 @@ static double lookup_computed_flop_counts(msg_vm_t vm, int stage_for_fancy_debug
   for (auto const& elm : vm->pimpl_vm_->dp_objs) {
     const std::string& key = elm.first;
     dirty_page_t dp  = elm.second;
-    double remaining = MSG_task_get_flops_amount(dp->task);
+    double remaining       = MSG_task_get_remaining_work_ratio(dp->task);
 
     double clock = MSG_get_clock();
 
@@ -396,7 +396,7 @@ void MSG_host_add_task(msg_host_t host, msg_task_t task)
   if (vm == nullptr)
     return;
 
-  double remaining = MSG_task_get_flops_amount(task);
+  double remaining = MSG_task_get_remaining_work_ratio(task);
   std::string key  = simgrid::xbt::string_printf("%s-%p", task->name, task);
 
   dirty_page_t dp = new s_dirty_page;
@@ -426,7 +426,7 @@ void MSG_host_del_task(msg_host_t host, msg_task_t task)
   /* If we are in the middle of dirty page tracking, we record how much computation has been done until now, and keep
    * the information for the lookup_() function that will called soon. */
   if (vm->pimpl_vm_->dp_enabled) {
-    double remaining = MSG_task_get_flops_amount(task);
+    double remaining = MSG_task_get_remaining_work_ratio(task);
     double clock = MSG_get_clock();
     double updated = get_computed(key, vm, dp, remaining, clock); // was host instead of vm
 
index 5c22018..0326f56 100644 (file)
@@ -98,7 +98,7 @@ static int worker(int /*argc*/, char* /*argv*/ [])
     MSG_task_execute(task);
     double end = MSG_get_clock();
     XBT_INFO("Task \"%s\" done in %f (amount %f)", MSG_task_get_name(task), end - start,
-             MSG_task_get_flops_amount(task));
+             MSG_task_get_remaining_work_ratio(task));
 
     MSG_task_destroy(task);
   }