Samuel Thibault 16 anni fa
parent
commit
153901a43e

+ 4 - 4
examples/basic-examples/hello-world.c

@@ -30,9 +30,9 @@
 #include <stdint.h>
 #include <starpu.h>
 
-/* When the task is done, call task->callback_func(task->callback_arg). Any
+/* When the task is done, task->callback_func(task->callback_arg) is called. Any
  * callback function must have the prototype void (*)(void *).
- * NB: Callback are NOT allowed to performed potentially blocking operations */
+ * NB: Callback are NOT allowed to perform potentially blocking operations */
 void callback_func(void *callback_arg)
 {
 	printf("Callback function got argument %p\n", callback_arg);
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
 	 * called */
 	struct starpu_task *task = starpu_task_create();
 
-	/* the task implements codelet "cl" */
+	/* the task uses codelet "cl" */
 	task->cl = &cl;
 
 	/* It is possible to use buffers that are not managed by the DSM to the
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
 	 * the codelet is given a pointer to a copy of that buffer: this buffer
 	 * is read-only so that any modification is not passed to other copies
 	 * of the buffer.  For this reason, a buffer passed as a codelet
-	 * argument (cl_arg) is NOT a valid synchronization medium ! */
+	 * argument (cl_arg) is NOT a valid synchronization medium! */
 	float array[2] = {1.0f, -1.0f};
 	task->cl_arg = &array;
 	task->cl_arg_size = 2*sizeof(float);

+ 18 - 14
examples/basic-examples/mult.c

@@ -17,7 +17,7 @@
 /*
  * This example shows a simple implementation of a blocked matrix
  * multiplication. Note that this is NOT intended to be an efficient
- * implementation of sgemm ! In this example, we show:
+ * implementation of sgemm! In this example, we show:
  *  - how to declare dense matrices (starpu_register_blas_data)
  *  - how to manipulate matrices within codelets (eg. descr[0].blas.ld)
  *  - how to use filters to partition the matrices into blocks
@@ -125,7 +125,7 @@ static void cpu_mult(starpu_data_interface_t *descr, __attribute__((unused))  vo
 	 * stands for leading dimension).
 	 * NB: in case some filters were used, the leading dimension is not
 	 * guaranteed to be the same in main memory (on the original matrix)
-	 * and on the accelerator ! */
+	 * and on the accelerator! */
 	nxC = descr[2].blas.nx;
 	nyC = descr[2].blas.ny;
 	nyA = descr[0].blas.ny;
@@ -134,7 +134,7 @@ static void cpu_mult(starpu_data_interface_t *descr, __attribute__((unused))  vo
 	ldB = descr[1].blas.ld;
 	ldC = descr[2].blas.ld;
 
-	/* we assume a FORTRAN-ordering ! */
+	/* we assume a FORTRAN-ordering! */
 	unsigned i,j,k;
 	for (i = 0; i < nyC; i++)
 	{
@@ -185,7 +185,7 @@ static void init_problem_data(void)
 
 static void partition_mult_data(void)
 {
-	/* note that we assume a FORTRAN ordering here ! */
+	/* note that we assume a FORTRAN ordering here! */
 
 	/* The BLAS data interface is described by 4 parameters: 
 	 *  - the location of the first element of the matrix to monitor (3rd
@@ -228,16 +228,19 @@ static void partition_mult_data(void)
 		
 /*
  *	Illustration with nslicex = 4 and nslicey = 2, it is possible to access
- *	sub-data by using the "get_sub_data" method, for instance:
+ *	sub-data by using the "get_sub_data" method, which takes a data handle,
+ *	the number of filters to apply, and the indexes for each filters, for
+ *	instance:
  *
  *		A' handle is get_sub_data(A_handle, 1, 1); 
  *		B' handle is get_sub_data(B_handle, 1, 2); 
  *		C' handle is get_sub_data(C_handle, 2, 2, 1); 
  *
- *	Note that since we apply 2 filters recursively onto C,
- *	"get_sub_data(C_handle, 1, 3)" returns an handle to the 4th column of
- *	blocked matrix C for example.
- * 
+ *	Note that here we applied 2 filters recursively onto C.
+ *
+ *	"get_sub_data(C_handle, 1, 3)" would return a handle to the 4th column
+ *	of blocked matrix C for example.
+ *
  *		              |---|---|---|---|
  *		              |   |   | B'|   | B
  *		              |---|---|---|---|
@@ -256,7 +259,8 @@ static void partition_mult_data(void)
  *	for each of the elements independantly. The tasks should therefore NOT
  *	access inner nodes (eg. one column of C or the whole C) but only the
  *	leafs of the tree (ie. blocks here). Manipulating inner nodes is only
- *	possible by disapplying the filters (using starpu_unpartition_data).
+ *	possible by disapplying the filters (using starpu_unpartition_data), to
+ *	enforce memory consistency.
  */
 
 	starpu_partition_data(B_handle, &f);
@@ -331,7 +335,7 @@ static void launch_tasks(void)
 			 */
 
 			/* there was a single filter applied to matrices A
-			 * (respectively C) so we grab the handle to the chunk
+			 * (respectively B) so we grab the handle to the chunk
 			 * identified by "tasky" (respectively "taskx). The "1"
 			 * tells StarPU that there is a single argument to the
 			 * variable-arity function get_sub_data */
@@ -345,7 +349,7 @@ static void launch_tasks(void)
 			 * must match the order in which the filters were
 			 * applied.
 			 * NB: get_sub_data(C_handle, 1, k) would have returned
-			 * a handle to the k-th column of matrix C.
+			 * a handle to the column number k of matrix C.
 			 * NB2: get_sub_data(C_handle, 2, taskx, tasky) is
 			 * equivalent to
 			 * get_sub_data(get_sub_data(C_handle, 1, taskx), 1, tasky)*/
@@ -378,8 +382,8 @@ int main(__attribute__ ((unused)) int argc,
 	/* submit all tasks in an asynchronous fashion */
 	launch_tasks();
 
-	/* the different tasks are asynchronous so we use a callback to notify
- 	 * the termination of the computation */
+	/* the different tasks are asynchronous so we use a callback to get
+	 * notified of the termination of the computation */
 	pthread_mutex_lock(&mutex);
 	if (!terminated)
 		pthread_cond_wait(&cond, &mutex);

+ 3 - 3
examples/basic-examples/vector-scal.c

@@ -39,7 +39,7 @@ static void scal_func(starpu_data_interface_t *buffers, void *arg)
 	 * The "buffers" array matches the task->buffers one: for instance
 	 * task->buffers[0].handle is a handle that corresponds to a data with
 	 * vector "interface". The starpu_data_interface_t is a union type with
-	 * a field for each interface defined. We therefore manipulate the
+	 * a field for each defined interface. Here, we manipulate the
 	 * buffers[0].vector field: vector.nx gives the number of elements in
 	 * the array, vector.ptr gives the location of the array (that was
 	 * possibly migrated/replicated), and vector.elemsize gives the size of
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
 	/* Initialize StarPU with default configuration */
 	starpu_init(NULL);
 
-	/* Tell StaPU to associate the "tab" vector to the "tab_handle"
+	/* Tell StaPU to associate the "tab" vector with the "tab_handle"
 	 * identifier. When a task needs to access a piece of data, it should
 	 * refer to the handle that is associated to it.
 	 * In the case of the "vector" data interface:
@@ -119,7 +119,7 @@ int main(int argc, char **argv)
 	starpu_submit_task(task);
 
 	/* StarPU does not need to manipulate the array anymore so we can stop
- 	 * to monitor it */
+ 	 * monitoring it */
 	starpu_delete_data(tab_handle);
 
 	/* terminate StarPU, no task can be submitted after */