Browse Source

doc: fixes to follow coding style

Nathalie Furmento 8 years ago
parent
commit
5b37f9329b

+ 3 - 2
doc/doxygen/chapters/110_basic_examples.doxy

@@ -1,7 +1,7 @@
 /*
  * This file is part of the StarPU Handbook.
  * Copyright (C) 2009--2011  Universit@'e de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2016  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2016, 2017  CNRS
  * Copyright (C) 2011, 2012 INRIA
  * See the file version.doxy for copying conditions.
  */
@@ -632,7 +632,8 @@ tools to compile a OpenCL kernel stored in a file.
 __kernel void vector_mult_opencl(int nx, __global float* val, float factor)
 {
         const int i = get_global_id(0);
-        if (i < nx) {
+        if (i < nx)
+	{
                 val[i] *= factor;
         }
 }

+ 9 - 5
doc/doxygen/chapters/210_check_list_performance.doxy

@@ -1,7 +1,7 @@
 /*
  * This file is part of the StarPU Handbook.
  * Copyright (C) 2009--2011  Universit@'e de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2016  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2016, 2017  CNRS
  * Copyright (C) 2011, 2012, 2017  INRIA
  * See the file version.doxy for copying conditions.
  */
@@ -315,26 +315,30 @@ measurements. This can be done by using starpu_perfmodel_update_history(),
 for instance:
 
 \code{.c}
-static struct starpu_perfmodel perf_model = {
+static struct starpu_perfmodel perf_model =
+{
     .type = STARPU_HISTORY_BASED,
     .symbol = "my_perfmodel",
 };
 
-struct starpu_codelet cl = {
+struct starpu_codelet cl =
+{
     .cuda_funcs = { cuda_func1, cuda_func2 },
     .nbuffers = 1,
     .modes = {STARPU_W},
     .model = &perf_model
 };
 
-void feed(void) {
+void feed(void)
+{
     struct my_measure *measure;
     struct starpu_task task;
     starpu_task_init(&task);
 
     task.cl = &cl;
 
-    for (measure = &measures[0]; measure < measures[last]; measure++) {
+    for (measure = &measures[0]; measure < measures[last]; measure++)
+    {
         starpu_data_handle_t handle;
 	starpu_vector_data_register(&handle, -1, 0, measure->size, sizeof(float));
 	task.handles[0] = handle;

+ 14 - 7
doc/doxygen/chapters/301_tasks.doxy

@@ -56,7 +56,8 @@ the field starpu_task::dyn_handles when defining a task and the field
 starpu_codelet::dyn_modes when defining the corresponding codelet.
 
 \code{.c}
-enum starpu_data_access_mode modes[STARPU_NMAXBUFS+1] = {
+enum starpu_data_access_mode modes[STARPU_NMAXBUFS+1] =
+{
 	STARPU_R, STARPU_R, ...
 };
 
@@ -132,7 +133,8 @@ void scal_sse_func(void *buffers[], void *cl_arg)
 \endcode
 
 \code{.c}
-struct starpu_codelet cl = {
+struct starpu_codelet cl =
+{
     .cpu_funcs = { scal_cpu_func, scal_sse_func },
     .cpu_funcs_name = { "scal_cpu_func", "scal_sse_func" },
     .nbuffers = 1,
@@ -167,7 +169,8 @@ static int can_execute(unsigned workerid, struct starpu_task *task, unsigned nim
   return 0;
 }
 
-struct starpu_codelet cl = {
+struct starpu_codelet cl =
+{
     .can_execute = can_execute,
     .cpu_funcs = { cpu_func },
     .cpu_funcs_name = { "cpu_func" },
@@ -212,7 +215,8 @@ static int can_execute(unsigned workerid, struct starpu_task *task, unsigned nim
   return 0;
 }
 
-struct starpu_codelet cl = {
+struct starpu_codelet cl =
+{
     .can_execute = can_execute,
     .cpu_funcs = { cpu_func },
     .cpu_funcs_name = { "cpu_func" },
@@ -247,7 +251,8 @@ static int can_execute(unsigned workerid, struct starpu_task *task, unsigned nim
   }
 }
 
-struct starpu_codelet cl = {
+struct starpu_codelet cl =
+{
     .can_execute = can_execute,
     .cpu_funcs = { cpu_func },
     .cpu_funcs_name = { "cpu_func" },
@@ -280,7 +285,8 @@ void func_cpu(void *descr[], void *_args)
         *x1 = *x1 * ffactor;
 }
 
-struct starpu_codelet mycodelet = {
+struct starpu_codelet mycodelet =
+{
         .cpu_funcs = { func_cpu },
         .cpu_funcs_name = { "func_cpu" },
         .nbuffers = 2,
@@ -544,7 +550,8 @@ An intermediate solution is to define a codelet with its
 starpu_codelet::where field set to \ref STARPU_NOWHERE, for instance:
 
 \code{.c}
-struct starpu_codelet cl = {
+struct starpu_codelet cl =
+{
 	.where = STARPU_NOWHERE,
 	.nbuffers = 1,
 	.modes = { STARPU_R },

+ 5 - 3
doc/doxygen/chapters/310_data_management.doxy

@@ -1,7 +1,7 @@
 /*
  * This file is part of the StarPU Handbook.
  * Copyright (C) 2009--2011  Universit@'e de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017  CNRS
  * Copyright (C) 2011, 2012 INRIA
  * See the file version.doxy for copying conditions.
  */
@@ -140,7 +140,8 @@ to retrieve the sub-handles to be passed as tasks parameters.
 
 \code{.c}
 /* Submit a task on each sub-vector */
-for (i=0; i<starpu_data_get_nb_children(handle); i++) {
+for (i=0; i<starpu_data_get_nb_children(handle); i++)
+{
     /* Get subdata number i (there is only 1 dimension) */
     starpu_data_handle_t sub_handle = starpu_data_get_sub_data(handle, 1, i);
     struct starpu_task *task = starpu_task_create();
@@ -404,7 +405,8 @@ into data <c>res</c>, then uses it for other computation, before looping again
 with a new reduction:
 
 \code{.c}
-for (i = 0; i < 100; i++) {
+for (i = 0; i < 100; i++)
+{
     starpu_mpi_task_insert(MPI_COMM_WORLD, &init_res, STARPU_W, res, 0);
     starpu_mpi_task_insert(MPI_COMM_WORLD, &work, STARPU_RW, A,
                STARPU_R, B, STARPU_REDUX, res, 0);

+ 3 - 2
doc/doxygen/chapters/320_scheduling.doxy

@@ -1,7 +1,7 @@
 /*
  * This file is part of the StarPU Handbook.
  * Copyright (C) 2009--2011  Universit@'e de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2016  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2016, 2017  CNRS
  * Copyright (C) 2011, 2012 INRIA
  * See the file version.doxy for copying conditions.
  */
@@ -205,7 +205,8 @@ the StarPU sources in the directory <c>examples/scheduler/</c>.
 The scheduler has to provide methods:
 
 \code{.c}
-static struct starpu_sched_policy dummy_sched_policy = {
+static struct starpu_sched_policy dummy_sched_policy =
+{
     .init_sched = init_dummy_sched,
     .deinit_sched = deinit_dummy_sched,
     .add_workers = dummy_sched_add_workers,

+ 6 - 3
doc/doxygen/chapters/370_online_performance_tools.doxy

@@ -198,7 +198,8 @@ starpu_top_register_parameter_float("alpha", &alpha, 0, 10, modif_hook);
 <c>modif_hook</c> is a function which will be called when the parameter is being modified, it can for instance print the new value:
 
 \code{.c}
-void modif_hook(struct starpu_top_param *d) {
+void modif_hook(struct starpu_top_param *d)
+{
     fprintf(stderr,"%s has been modified: %f\n", d->name, alpha);
 }
 \endcode
@@ -341,12 +342,14 @@ be constructed dynamically at execution time, as long as this is done before
 submitting any task using it.
 
 \code{.c}
-static struct starpu_perfmodel mult_perf_model = {
+static struct starpu_perfmodel mult_perf_model =
+{
     .type = STARPU_HISTORY_BASED,
     .symbol = "mult_perf_model"
 };
 
-struct starpu_codelet cl = {
+struct starpu_codelet cl =
+{
     .cpu_funcs = { cpu_mult },
     .cpu_funcs_name = { "cpu_mult" },
     .nbuffers = 3,

+ 19 - 10
doc/doxygen/chapters/390_faq.doxy

@@ -1,7 +1,7 @@
 /*
  * This file is part of the StarPU Handbook.
  * Copyright (C) 2009--2011  Universit@'e de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2016  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2016, 2017  CNRS
  * Copyright (C) 2011, 2012 INRIA
  * See the file version.doxy for copying conditions.
  */
@@ -27,8 +27,10 @@ At initialisation time of libstarpu, the objects are initialized:
 
 \code{.c}
 int workerid;
-for (workerid = 0; workerid < starpu_worker_get_count(); workerid++) {
-    switch (starpu_worker_get_type(workerid)) {
+for (workerid = 0; workerid < starpu_worker_get_count(); workerid++)
+{
+    switch (starpu_worker_get_type(workerid))
+    {
         case STARPU_CPU_WORKER:
             plan_cpu[workerid] = fftw_plan(...);
             break;
@@ -75,14 +77,16 @@ void starpufft_plan(void)
 
 \code{.c}
 int ret;
-struct starpu_driver = {
+struct starpu_driver =
+{
     .type = STARPU_CUDA_WORKER,
     .id.cuda_id = 0
 };
 ret = starpu_driver_init(&d);
 if (ret != 0)
     error();
-while (some_condition) {
+while (some_condition)
+{
     ret = starpu_driver_run_once(&d);
     if (ret != 0)
         error();
@@ -258,7 +262,8 @@ run the following program with -lcudart:
 #include <cuda.h>
 #include <cuda_runtime.h>
 
-int main(void) {
+int main(void)
+{
 	int n, i, version;
 	cudaError_t err;
 
@@ -274,7 +279,8 @@ int main(void) {
 	printf("runtime version %d\n", version);
 	printf("\n");
 
-	for (i = 0; i < n; i++) {
+	for (i = 0; i < n; i++)
+	{
 		struct cudaDeviceProp props;
 		printf("CUDA%d\n", i);
 		err = cudaGetDeviceProperties(&props, i);
@@ -306,7 +312,8 @@ run the following program with -lOpenCL:
 #include <stdio.h>
 #include <assert.h>
 
-int main(void) {
+int main(void)
+{
     cl_device_id did[16];
     cl_int err;
     cl_platform_id pid, pids[16];
@@ -318,7 +325,8 @@ int main(void) {
     err = clGetPlatformIDs(sizeof(pids)/sizeof(pids[0]), pids, &nbplat);
     assert(err == CL_SUCCESS);
     printf("%u platforms\n", nbplat);
-    for (j = 0; j < nbplat; j++) {
+    for (j = 0; j < nbplat; j++)
+    {
         pid = pids[j];
         printf("    platform %d\n", j);
         err = clGetPlatformInfo(pid, CL_PLATFORM_VERSION, sizeof(buf)-1, buf, &size);
@@ -329,7 +337,8 @@ int main(void) {
         err = clGetDeviceIDs(pid, CL_DEVICE_TYPE_ALL, sizeof(did)/sizeof(did[0]), did, &nb);
         assert(err == CL_SUCCESS);
         printf("%d devices\n", nb);
-        for (i = 0; i < nb; i++) {
+        for (i = 0; i < nb; i++)
+	{
             err = clGetDeviceInfo(did[i], CL_DEVICE_VERSION, sizeof(buf)-1, buf, &size);
             buf[size] = 0;
             printf("    device %d version %s\n", i, buf);

+ 38 - 19
doc/doxygen/chapters/410_mpi_support.doxy

@@ -28,7 +28,8 @@ initializes a token on node 0, and the token is passed from node to node,
 incremented by one on each step. The code is not using StarPU yet.
 
 \code{.c}
-    for (loop = 0; loop < nloops; loop++) {
+    for (loop = 0; loop < nloops; loop++)
+    {
         int tag = loop*size + rank;
 
         if (loop == 0 && rank == 0)
@@ -62,7 +63,8 @@ execution to StarPU.  This is possible by just using starpu_data_acquire(), for
 instance:
 
 \code{.c}
-    for (loop = 0; loop < nloops; loop++) {
+    for (loop = 0; loop < nloops; loop++)
+    {
         int tag = loop*size + rank;
 
 	/* Acquire the data to be able to write to it */
@@ -412,7 +414,8 @@ communication cache when unregistering the data.
 
 \code{.c}
 /* Returns the MPI node number where data is */
-int my_distrib(int x, int y, int nb_nodes) {
+int my_distrib(int x, int y, int nb_nodes)
+{
   /* Block distrib */
   return ((int)(x / sqrt(nb_nodes) + (y / sqrt(nb_nodes)) * sqrt(nb_nodes))) % nb_nodes;
 
@@ -439,8 +442,10 @@ data which will be needed by the tasks that we will execute.
     unsigned matrix[X][Y];
     starpu_data_handle_t data_handles[X][Y];
 
-    for(x = 0; x < X; x++) {
-        for (y = 0; y < Y; y++) {
+    for(x = 0; x < X; x++)
+    {
+        for (y = 0; y < Y; y++)
+	{
             int mpi_rank = my_distrib(x, y, size);
             if (mpi_rank == my_rank)
                 /* Owning data */
@@ -454,7 +459,8 @@ data which will be needed by the tasks that we will execute.
             else
                 /* I know it's useless to allocate anything for this */
                 data_handles[x][y] = NULL;
-            if (data_handles[x][y]) {
+            if (data_handles[x][y])
+	    {
                 starpu_mpi_data_register(data_handles[x][y], x*X+y, mpi_rank);
             }
         }
@@ -604,8 +610,10 @@ register any data that wasn't registered already and will be needed, then
 migrate the data, and register the new location.
 
 \code{.c}
-    for(x = 0; x < X; x++) {
-        for (y = 0; y < Y; y++) {
+    for(x = 0; x < X; x++)
+    {
+        for (y = 0; y < Y; y++)
+	{
             int mpi_rank = my_distrib2(x, y, size);
             if (!data_handles[x][y] && (mpi_rank == my_rank
                   || my_rank == my_distrib(x+1, y, size) || my_rank == my_distrib(x-1, y, size)
@@ -613,7 +621,8 @@ migrate the data, and register the new location.
                 /* Register newly-needed data */
                 starpu_variable_data_register(&data_handles[x][y], -1,
                                               (uintptr_t)NULL, sizeof(unsigned));
-            if (data_handles[x][y]) {
+            if (data_handles[x][y])
+	    {
                 /* Migrate the data */
                 starpu_mpi_data_migrate(MPI_COMM_WORLD, data_handles[x][y], mpi_rank);
             }
@@ -636,9 +645,12 @@ resides. Otherwise the unregistration will complain that it does not have the
 latest value on the original home node.
 
 \code{.c}
-    for(x = 0; x < X; x++) {
-        for (y = 0; y < Y; y++) {
-            if (data_handles[x][y]) {
+    for(x = 0; x < X; x++)
+    {
+        for (y = 0; y < Y; y++)
+	{
+            if (data_handles[x][y])
+	    {
                 int mpi_rank = my_distrib(x, y, size);
                 /* Get back data to original place where the user-provided buffer is.  */
                 starpu_mpi_get_data_on_node_detached(MPI_COMM_WORLD, data_handles[x][y], mpi_rank, NULL, NULL);
@@ -669,20 +681,24 @@ data_handles = malloc(nblocks*sizeof(starpu_data_handle_t *));
 for(x = 0; x < nblocks ;  x++)
 {
     int mpi_rank = my_distrib(x, nodes);
-    if (rank == root) {
+    if (rank == root)
+    {
         starpu_vector_data_register(&data_handles[x], STARPU_MAIN_RAM, (uintptr_t)vector[x],
                                     blocks_size, sizeof(float));
     }
-    else if ((mpi_rank == rank) || ((rank == mpi_rank+1 || rank == mpi_rank-1))) {
+    else if ((mpi_rank == rank) || ((rank == mpi_rank+1 || rank == mpi_rank-1)))
+    {
         /* I own that index, or i will need it for my computations */
         starpu_vector_data_register(&data_handles[x], -1, (uintptr_t)NULL,
                                    block_size, sizeof(float));
     }
-    else {
+    else
+    {
         /* I know it's useless to allocate anything for this */
         data_handles[x] = NULL;
     }
-    if (data_handles[x]) {
+    if (data_handles[x])
+    {
         starpu_mpi_data_register(data_handles[x], x*nblocks+y, mpi_rank);
     }
 }
@@ -691,10 +707,13 @@ for(x = 0; x < nblocks ;  x++)
 starpu_mpi_scatter_detached(data_handles, nblocks, root, MPI_COMM_WORLD);
 
 /* Calculation */
-for(x = 0; x < nblocks ;  x++) {
-    if (data_handles[x]) {
+for(x = 0; x < nblocks ;  x++)
+{
+    if (data_handles[x])
+    {
         int owner = starpu_data_get_rank(data_handles[x]);
-        if (owner == rank) {
+        if (owner == rank)
+	{
             starpu_task_insert(&cl, STARPU_RW, data_handles[x], 0);
         }
     }

+ 3 - 2
doc/doxygen/chapters/430_mic_scc_support.doxy

@@ -1,7 +1,7 @@
 /*
  * This file is part of the StarPU Handbook.
  * Copyright (C) 2009--2011  Universit@'e de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2016  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2016, 2017  CNRS
  * Copyright (C) 2011, 2012 INRIA
  * See the file version.doxy for copying conditions.
  */
@@ -49,7 +49,8 @@ starpu_codelet::cpu_funcs_name, to provide StarPU with the function
 name of the CPU implementation, so for instance:
 
 \verbatim
-struct starpu_codelet cl = {
+struct starpu_codelet cl =
+{
     .cpu_funcs = {myfunc},
     .cpu_funcs_name = {"myfunc"},
     .nbuffers = 1,

+ 4 - 2
doc/doxygen/chapters/api/data_partition.doxy

@@ -42,7 +42,8 @@ according to the filter \p f.
 
 Here an example of how to use the function.
 \code{.c}
-struct starpu_data_filter f = {
+struct starpu_data_filter f =
+{
         .filter_func = starpu_matrix_filter_block,
         .nchildren = nslicesx
 };
@@ -119,7 +120,8 @@ Here is an example of how to use the function:
 
 \code{.c}
 starpu_data_handle_t children[nslicesx];
-struct starpu_data_filter f = {
+struct starpu_data_filter f =
+{
         .filter_func = starpu_matrix_filter_block,
         .nchildren = nslicesx
 };

+ 6 - 3
doc/doxygen/chapters/code/multiformat.c

@@ -30,7 +30,8 @@ starpu_data_handle_t handle;
  */
 #ifdef STARPU_USE_OPENCL
 void cpu_to_opencl_opencl_func(void *buffers[], void *args);
-struct starpu_codelet cpu_to_opencl_cl = {
+struct starpu_codelet cpu_to_opencl_cl =
+{
     .where = STARPU_OPENCL,
     .opencl_funcs = { cpu_to_opencl_opencl_func },
     .nbuffers = 1,
@@ -38,7 +39,8 @@ struct starpu_codelet cpu_to_opencl_cl = {
 };
 
 void opencl_to_cpu_func(void *buffers[], void *args);
-struct starpu_codelet opencl_to_cpu_cl = {
+struct starpu_codelet opencl_to_cpu_cl =
+{
     .where = STARPU_CPU,
     .cpu_funcs = { opencl_to_cpu_func },
     .cpu_funcs_name = { "opencl_to_cpu_func" },
@@ -47,7 +49,8 @@ struct starpu_codelet opencl_to_cpu_cl = {
 };
 #endif
 
-struct starpu_multiformat_data_interface_ops format_ops = {
+struct starpu_multiformat_data_interface_ops format_ops =
+{
 #ifdef STARPU_USE_OPENCL
     .opencl_elemsize = 2 * sizeof(float),
     .cpu_to_opencl_cl = &cpu_to_opencl_cl,

+ 2 - 1
doc/doxygen/chapters/code/vector_scal_c.c

@@ -32,7 +32,8 @@ extern void scal_sse_func(void *buffers[], void *_args);
 extern void scal_cuda_func(void *buffers[], void *_args);
 extern void scal_opencl_func(void *buffers[], void *_args);
 
-static struct starpu_codelet cl = {
+static struct starpu_codelet cl =
+{
     .where = STARPU_CPU | STARPU_CUDA | STARPU_OPENCL,
     /* CPU implementation of the codelet */
     .cpu_funcs = { scal_cpu_func, scal_sse_func },

+ 2 - 1
doc/doxygen/chapters/code/vector_scal_opencl_codelet.cl

@@ -18,7 +18,8 @@
 __kernel void vector_mult_opencl(int nx, __global float* val, float factor)
 {
         const int i = get_global_id(0);
-        if (i < nx) {
+        if (i < nx)
+	{
                 val[i] *= factor;
         }
 }

+ 1 - 1
tools/dev/internal/starpu_check_braces.sh

@@ -21,7 +21,7 @@ SHOW=less
 DIRS="tools src tests examples mpi"
 for d in ${1:-$DIRS}
 do
-    for ext in c h cl cu
+    for ext in c h cl cu doxy
     do
 	grep -rsn "{" $d |grep ".${ext}:" | grep -v "}" | grep -v ".${ext}:[0-9]*:[[:space:]]*{$" > /tmp/braces
 	if test -s /tmp/braces