Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
More progress toward the atomic simcall for vm migration - Ad(rien)
[simgrid.git] / src / simix / libsmx.c
index 199f085..d5a78fa 100644 (file)
@@ -223,21 +223,21 @@ double simcall_host_get_consumed_energy(smx_host_t host)
  *
  * \param name Name of the execution synchro to create
  * \param host SIMIX host where the synchro will be executed
- * \param computation_amount amount Computation amount (in bytes)
+ * \param flops_amount amount Computation amount (in flops)
  * \param priority computation priority
  * \param bound
  * \param affinity_mask
  * \return A new SIMIX execution synchronization
  */
 smx_synchro_t simcall_host_execute(const char *name, smx_host_t host,
-                                    double computation_amount,
+                                    double flops_amount,
                                     double priority, double bound, unsigned long affinity_mask)
 {
   /* checking for infinite values */
-  xbt_assert(isfinite(computation_amount), "computation_amount is not finite!");
+  xbt_assert(isfinite(flops_amount), "flops_amount is not finite!");
   xbt_assert(isfinite(priority), "priority is not finite!");
 
-  return simcall_BODY_host_execute(name, host, computation_amount, priority, bound, affinity_mask);
+  return simcall_BODY_host_execute(name, host, flops_amount, priority, bound, affinity_mask);
 }
 
 /**
@@ -248,8 +248,8 @@ smx_synchro_t simcall_host_execute(const char *name, smx_host_t host,
  * \param name Name of the execution synchro to create
  * \param host_nb Number of hosts where the synchro will be executed
  * \param host_list Array (of size host_nb) of hosts where the synchro will be executed
- * \param computation_amount Array (of size host_nb) of computation amount of hosts (in bytes)
- * \param communication_amount Array (of size host_nb * host_nb) representing the communication
+ * \param flops_amount Array (of size host_nb) of computation amount of hosts (in bytes)
+ * \param bytes_amount Array (of size host_nb * host_nb) representing the communication
  * amount between each pair of hosts
  * \param amount the SURF action amount
  * \param rate the SURF action rate
@@ -258,18 +258,18 @@ smx_synchro_t simcall_host_execute(const char *name, smx_host_t host,
 smx_synchro_t simcall_host_parallel_execute(const char *name,
                                          int host_nb,
                                          smx_host_t *host_list,
-                                         double *computation_amount,
-                                         double *communication_amount,
+                                         double *flops_amount,
+                                         double *bytes_amount,
                                          double amount,
                                          double rate)
 {
   int i,j;
   /* checking for infinite values */
   for (i = 0 ; i < host_nb ; ++i) {
-     xbt_assert(isfinite(computation_amount[i]), "computation_amount[%d] is not finite!", i);
+     xbt_assert(isfinite(flops_amount[i]), "flops_amount[%d] is not finite!", i);
      for (j = 0 ; j < host_nb ; ++j) {
-        xbt_assert(isfinite(communication_amount[i + host_nb * j]),
-             "communication_amount[%d+%d*%d] is not finite!", i, host_nb, j);
+        xbt_assert(isfinite(bytes_amount[i + host_nb * j]),
+             "bytes_amount[%d+%d*%d] is not finite!", i, host_nb, j);
      }
   }
 
@@ -277,8 +277,8 @@ smx_synchro_t simcall_host_parallel_execute(const char *name,
   xbt_assert(isfinite(rate), "rate is not finite!");
 
   return simcall_BODY_host_parallel_execute(name, host_nb, host_list,
-                                            computation_amount,
-                                            communication_amount,
+                                            flops_amount,
+                                            bytes_amount,
                                             amount, rate);
 
 }
@@ -532,6 +532,24 @@ void simcall_vm_destroy(smx_host_t vm)
   simcall_BODY_vm_destroy(vm);
 }
 
+/**
+ * \ingroup simix_vm_management
+ * \brief Encompassing simcall to prevent the removal of the src or the dst node at the end of a VM migration
+ *  The simcall actually invokes the following calls: 
+ *     simcall_vm_set_affinity(vm, src_pm, 0); 
+ *     simcall_vm_migrate(vm, dst_pm); 
+ *     simcall_vm_resume(vm);
+ *
+ * It is called at the end of the migration_rx_fun function from msg/msg_vm.c
+ *
+ * \param vm VM to migrate
+ * \param src_pm  Source physical host
+ * \param dst_pmt Destination physical host
+ */
+void simcall_vm_migratefrom_resumeto(smx_host_t vm, smx_host_t src_pm, smx_host_t dst_pm)
+{
+  simcall_BODY_vm_migratefrom_resumeto(vm, src_pm, dst_pm);
+}
 
 /**
  * \ingroup simix_process_management
@@ -928,7 +946,7 @@ void simcall_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, doubl
 
   xbt_assert(rdv, "No rendez-vous point defined for send");
 
-  if (MC_is_active()) {
+  if (MC_is_active() || MC_record_replay_is_active()) {
     /* the model-checker wants two separate simcalls */
     smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */
     comm = simcall_comm_isend(src, rdv, task_size, rate,
@@ -975,7 +993,7 @@ void simcall_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size,
   xbt_assert(isfinite(timeout), "timeout is not finite!");
   xbt_assert(rdv, "No rendez-vous point defined for recv");
 
-  if (MC_is_active()) {
+  if (MC_is_active() || MC_record_replay_is_active()) {
     /* the model-checker wants two separate simcalls */
     smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */
     comm = simcall_comm_irecv(rdv, dst_buff, dst_buff_size,
@@ -1048,7 +1066,6 @@ void simcall_comm_wait(smx_synchro_t comm, double timeout)
   simcall_BODY_comm_wait(comm, timeout);
 }
 
-#ifdef HAVE_TRACING
 /**
  * \brief Set the category of an synchro.
  *
@@ -1063,7 +1080,6 @@ void simcall_set_category(smx_synchro_t synchro, const char *category)
   }
   simcall_BODY_set_category(synchro, category);
 }
-#endif
 
 /**
  * \ingroup simix_comm_management
@@ -1471,12 +1487,12 @@ int simcall_mc_compare_snapshots(void *s1, void *s2) {
   return simcall_BODY_mc_compare_snapshots(s1, s2);
 }
 
+#endif /* HAVE_MC */
+
 int simcall_mc_random(int min, int max) {
   return simcall_BODY_mc_random(min, max);
 }
 
-#endif /* HAVE_MC */
-
 /* ************************************************************************** */
 
 /** @brief returns a printable string representing a simcall */