simdata->source = NULL;
simdata->priority = 1.0;
simdata->bound = 0;
+ simdata->affinity_mask = 0;
simdata->rate = -1.0;
simdata->isused = 0;
simcall_host_execution_set_bound(task->simdata->compute,
task->simdata->bound);
}
+
+
+/** \ingroup m_task_management
+ * \brief Changes the CPU affinity of a computation task.
+ *
+ * When pinning the given task to the first CPU core of the given host, use
+ * 0x01 for the mask value. Each bit of the mask value corresponds to each CPU
+ * core. See taskset(1) on Linux.
+ *
+ * \param task a target task
+ * \param host the host having a multi-core CPU
+ * \param mask the value specifying the CPU affinity setting of the task
+ *
+ */
+void MSG_task_set_affinity(msg_task_t task, msg_host_t host, unsigned long mask)
+{
+ xbt_assert(task, "Invalid parameter");
+ xbt_assert(task->simdata, "Invalid parameter");
+
+ task->simdata->affinity_mask = mask;
+ if (task->simdata->compute)
+ simcall_host_execution_set_affinity(task->simdata->compute, host, mask);
+}