Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Improve the doc of parallel executions
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 9 Oct 2018 23:28:33 +0000 (01:28 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 9 Oct 2018 23:31:23 +0000 (01:31 +0200)
This fixes https://github.com/simgrid/simgrid/issues/261

ChangeLog
examples/s4u/README.rst
include/simgrid/msg.h
include/simgrid/s4u/Actor.hpp
src/msg/msg_task.cpp

index 3fe5f93..622c291 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 SimGrid (3.22) NOT RELEASED (Release Target: December 21. 2018, 22:23 UTC)
 
+Fixed bugs:
+ - #261: Document the parameters of parallel execution's constructor
+
+----------------------------------------------------------------------------
+
 SimGrid (3.21) October 3. 2018
 
 The Restarting Documentation (TRD) Release.
index f672f35..b1b996d 100644 (file)
@@ -140,6 +140,8 @@ Communications on the Network
 
 .. todo:: add the `ready` example here
    
+.. _s4u_ex_execution:
+
 Executions on the CPU
 ---------------------
 
@@ -171,9 +173,10 @@ Executions on the CPU
     |br| `examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp>`_
     |br| `examples/platforms/energy_platform.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/energy_platform.xml>`_
 
-  - **Parallel tasks:**
+  - **Parallel executions:**
     These objects are convenient abstractions of parallel
-    computational kernels that span over several machines. 
+    computational kernels that span over several machines, such as a
+    PDGEM and the other ScaLAPACK routines.
     |br| `examples/s4u/exec-ptask/s4u-exec-ptask.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-ptask/s4u-exec-ptask.cpp>`_
 
 I/O on Disks and Files
index 1df82a2..515b066 100644 (file)
@@ -241,8 +241,6 @@ typedef struct msg_task* msg_task_t;
 #define MSG_TASK_UNINITIALIZED NULL
 
 /** @brief Return code of most MSG functions
-    @ingroup msg_simulation
-    @{ */
 /* Keep these code as binary values: java bindings manipulate | of these values */
 typedef enum {
   MSG_OK = 0,                 /**< @brief Everything is right. Keep on going this way ! */
@@ -255,7 +253,6 @@ typedef enum {
       return now !*/
   MSG_TASK_CANCELED = 8      /**< @brief Canceled task. This task has been canceled by somebody!*/
 } msg_error_t;
-/** @} */
 
 /************************** Global ******************************************/
 /** @brief set a configuration variable
index a951265..5cc2bca 100644 (file)
@@ -410,8 +410,56 @@ XBT_PUBLIC void execute(double flop);
  *  An execution of priority 2 computes twice as fast as an execution at priority 1. */
 XBT_PUBLIC void execute(double flop, double priority);
 
-XBT_PUBLIC void parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount);
-XBT_PUBLIC void parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount,
+/** Block the actor until the built parallel execution terminates
+ *
+ * \rst
+ * .. _API_s4u_parallel_execute:
+ *
+ * Parallel executions convenient abstractions of parallel computational kernels that span over several machines,
+ * such as a PDGEM and the other ScaLAPACK routines. If you are interested in the effects of such parallel kernel
+ * on the platform (e.g. to schedule them wisely), there is no need to model them in all details of their internal
+ * execution and communications. It is much more convenient to model them as a single execution activity that spans
+ * over several hosts. This is exactly what s4u's Parallel Executions are.
+ *
+ * To build such an object, you need to provide a list of hosts that are involved in the parallel kernel (the
+ * actor's own host may or may not be in this list) and specify the amount of computations that should be done by
+ * each host, using a vector of flops amount. Then, you should specify the amount of data exchanged between each
+ * hosts during the parallel kernel. For that, a matrix of values is expected.
+ *
+ * For example, if your list of hosts is ``[host0, host1]``, passing a vector ``[1000, 2000]`` as a `flops_amount`
+ * vector means that `host0` should compute 1000 flops while `host1` will compute 2000 flops. A matrix of
+ * communications' sizes of ``[0, 1, 2, 3]`` specifies the following data exchanges:
+ *
+ *   +-----------+-------+------+
+ *   |from \\ to | host0 | host1|
+ *   +===========+=======+======+
+ *   |host0      |   0   |  1   |
+ *   +-----------+-------+------+
+ *   |host1      |   2   |  3   |
+ *   +-----------+-------+------+
+ *
+ * - From host0 to host0: 0 bytes are exchanged
+ * - From host0 to host1: 1 byte is exchanged
+ * - From host1 to host0: 2 bytes are exchanged
+ * - From host1 to host1: 3 bytes are exchanged
+ *
+ * In a parallel execution, all parts (all executions on each hosts, all communications) progress exactly at the
+ * same pace, so they all terminate at the exact same pace. If one part is slow because of a slow resource or
+ * because of contention, this slows down the parallel execution as a whole.
+ *
+ * These objects are somewhat surprising from a modeling point of view. For example, the unit of their speed is
+ * somewhere between flop/sec and byte/sec. It is **strongly advised** to only use the LV08 host model when using
+ * parallel executions. Note that you can mix regular executions and communications with parallel executions,
+ * provided that the platform model is LV08.
+ *
+ * \endrst
+ */
+
+XBT_PUBLIC void parallel_execute(int host_nb, s4u::Host* host_list, double* flops_amount, double* bytes_amount);
+/** \rst
+ * Block the actor until the built :ref:`parallel execution <API_s4u_parallel_execute>` completes, or until the timeout.
+ * \endrst*/
+XBT_PUBLIC void parallel_execute(int host_nb, s4u::Host* host_list, double* flops_amount, double* bytes_amount,
                                  double timeout);
 
 XBT_PUBLIC ExecPtr exec_init(double flops_amounts);
index 7a51afd..07e6db9 100644 (file)
@@ -59,6 +59,12 @@ msg_task_t MSG_task_create(const char *name, double flop_amount, double message_
 /** @brief Creates a new #msg_task_t (a parallel one....).
  *
  * A constructor for #msg_task_t taking six arguments and returning the corresponding object.
+ *
+ * \rst
+ * See :cpp:func:`void simgrid::s4u::this_actor::parallel_execute(int, s4u::Host*, double*, double*)` for
+ * the exact semantic of the parameters.
+ * \endrst
+ *
  * @param name a name for the object. It is for user-level information and can be nullptr.
  * @param host_nb the number of hosts implied in the parallel task.
  * @param host_list an array of @p host_nb msg_host_t.
@@ -67,9 +73,7 @@ msg_task_t MSG_task_create(const char *name, double flop_amount, double message_
  * @param bytes_amount an array of @p host_nb* @p host_nb doubles.
  * @param data a pointer to any data may want to attach to the new object.
  *             It is for user-level information and can be nullptr.
- *             It can be retrieved with the function @ref MSG_task_get_data.
- * @see msg_task_t
- * @return The new corresponding object.
+ *             It can be retrieved with the function @ref MSG_task_get_data().
  */
 msg_task_t MSG_parallel_task_create(const char *name, int host_nb, const msg_host_t * host_list,
                                     double *flops_amount, double *bytes_amount, void *data)