Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Extend simcall_host_execute() for CPU affinity
[simgrid.git] / src / simix / smx_user.c
index 9fc7d4c..f46a909 100644 (file)
@@ -183,13 +183,13 @@ void simcall_host_set_data(smx_host_t host, void *data)
 
 smx_action_t simcall_host_execute(const char *name, smx_host_t host,
                                     double computation_amount,
-                                    double priority, double bound)
+                                    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(priority), "priority is not finite!");
   
-  return simcall_BODY_host_execute(name, host, computation_amount, priority, bound);
+  return simcall_BODY_host_execute(name, host, computation_amount, priority, bound, affinity_mask);
 }
 
 /**
@@ -312,6 +312,20 @@ void simcall_host_execution_set_bound(smx_action_t execution, double bound)
   simcall_BODY_host_execution_set_bound(execution, bound);
 }
 
+/**
+ * \ingroup simix_host_management
+ * \brief Changes the CPU affinity of an execution action.
+ *
+ * This functions changes the CPU affinity of an execution action. See taskset(1) on Linux.
+ * \param execution The execution action
+ * \param host Host
+ * \param mask Affinity mask
+ */
+void simcall_host_execution_set_affinity(smx_action_t execution, smx_host_t host, unsigned long mask)
+{
+  simcall_BODY_host_execution_set_affinity(execution, host, mask);
+}
+
 /**
  * \ingroup simix_host_management
  * \brief Waits for the completion of an execution action and destroy it.