Ver código fonte

tests: fix coding style

Nathalie Furmento 12 anos atrás
pai
commit
8c1f17b7a9

+ 2 - 2
tests/datawizard/copy.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -69,7 +69,7 @@ int main(int argc, char **argv)
 	starpu_variable_data_register(&float_array_handle, 0, (uintptr_t)&foo, sizeof(foo));
 
         for (i = 0; i < nloops; i++)
-        {
+	{
 		struct starpu_task *task_cpu, *task_gpu;
 
 		task_cpu = starpu_task_create();

+ 6 - 3
tests/datawizard/in_place_partition.c

@@ -61,7 +61,8 @@ int main(int argc, char **argv)
 
 	starpu_data_partition(handle, &f);
 
-	for (i = 0; i < f.nchildren; i++) {
+	for (i = 0; i < f.nchildren; i++)
+	{
 		struct starpu_task *task = starpu_task_create();
 
 		task->handles[0] = starpu_data_get_sub_data(handle, 1, i);
@@ -82,8 +83,10 @@ int main(int argc, char **argv)
 	starpu_shutdown();
 
 	ret = EXIT_SUCCESS;
-	for (i = 0; i < size; i++) {
-		if (foo[i] != i*2) {
+	for (i = 0; i < size; i++)
+	{
+		if (foo[i] != i*2)
+		{
 			FPRINTF(stderr,"value %d is %u instead of %d\n", i, foo[i], 2*i);
 			ret = EXIT_FAILURE;
 		}

+ 2 - 1
tests/datawizard/interfaces/test_interfaces.c

@@ -578,7 +578,8 @@ static void
 run_async(void)
 {
 	int async = starpu_asynchronous_copy_disabled();
-	if (async == 1) {
+	if (async == 1)
+	{
 		FPRINTF(stderr, "Asynchronous copies have been disabled\n");
 		return;
 	}

+ 2 - 1
tests/datawizard/partition_lazy.c

@@ -69,7 +69,8 @@ int main(int argc, char **argv)
 
 	starpu_data_partition(handle, &f);
 
-	for (i = 0; i < f.nchildren; i++) {
+	for (i = 0; i < f.nchildren; i++)
+	{
 		ret = starpu_insert_task(&mycodelet,
 					 STARPU_W,
 					 starpu_data_get_sub_data(handle, 1, i),

+ 19 - 17
tests/loader.c

@@ -123,25 +123,27 @@ static void test_cleaner(int sig)
 
 static void decode(char **src, char *motif, const char *value)
 {
-     if (*src) {
-	  char *y = strstr(*src, motif);
-	  if (y && value == NULL)
-	  {
-	       fprintf(stderr, "error: $%s undefined\n", motif);
-	       exit(EXIT_FAILURE);
-	  }
-	  while (y) {
-	       char *neo = malloc((strlen(*src)-strlen(motif)+strlen(value)) * sizeof(char));
-	       char *to = neo;
+	if (*src)
+	{
+		char *y = strstr(*src, motif);
+		if (y && value == NULL)
+		{
+			fprintf(stderr, "error: $%s undefined\n", motif);
+			exit(EXIT_FAILURE);
+		}
+		while (y)
+		{
+			char *neo = malloc((strlen(*src)-strlen(motif)+strlen(value)) * sizeof(char));
+			char *to = neo;
 
-	       to = strncpy(to, *src, strlen(*src)-strlen(y)); to += strlen(*src)-strlen(y);
-	       to = strcpy(to, value); to += strlen(value);
-	       strcpy(to, y+strlen(motif));
+			to = strncpy(to, *src, strlen(*src)-strlen(y)); to += strlen(*src)-strlen(y);
+			to = strcpy(to, value); to += strlen(value);
+			strcpy(to, y+strlen(motif));
 
-	       *src = strdup(neo);
-	       y = strstr(*src, motif);
-	  }
-     }
+			*src = strdup(neo);
+			y = strstr(*src, motif);
+		}
+	}
 }
 
 int main(int argc, char *argv[])

+ 3 - 2
tests/main/insert_task_array.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -80,7 +80,8 @@ enodev:
 		 * could perform the kernel, so this is not an error from StarPU */
 		return STARPU_TEST_SKIPPED;
 	}
-	else {
+	else
+	{
 		FPRINTF(stderr, "VALUES: %d %f\n", x, f);
 		ret = !(x == 12 && f == 24.0);
 		STARPU_RETURN(ret);

+ 24 - 14
tests/main/tag_task_data_deps.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2013  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -33,7 +33,7 @@ static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg)
 		usleep(duration);
 }
 
-static struct starpu_codelet dummy_Rcodelet = 
+static struct starpu_codelet dummy_Rcodelet =
 {
 	.cpu_funcs = {dummy_func, NULL},
 	.model = NULL,
@@ -41,7 +41,7 @@ static struct starpu_codelet dummy_Rcodelet =
 	.modes = {STARPU_R}
 };
 
-static struct starpu_codelet dummy_Wcodelet = 
+static struct starpu_codelet dummy_Wcodelet =
 {
 	.cpu_funcs = {dummy_func, NULL},
 	.model = NULL,
@@ -49,7 +49,7 @@ static struct starpu_codelet dummy_Wcodelet =
 	.modes = {STARPU_W}
 };
 
-static struct starpu_codelet dummy_codelet = 
+static struct starpu_codelet dummy_codelet =
 {
 	.cpu_funcs = {dummy_func, NULL},
 	.model = NULL,
@@ -102,7 +102,8 @@ int main(int argc, char **argv)
 	{
 #else
 	loop = 0x258;
-	do {
+	do
+	{
 #endif
 		int durationA = loop & 1 ? duration:0;
 		int durationB = loop & 2 ? duration:0;
@@ -115,21 +116,24 @@ int main(int argc, char **argv)
 		handleA = handle1;
 		writeA = !!(loop & 8);
 		dataA = !!(loop & 16);
-		if (!dataA && writeA) {
+		if (!dataA && writeA)
+		{
 			handleA = handle2;
 			dataA = 1;
 		}
 		handleB = handle1;
 		writeB = !!(loop & 32);
 		dataB = !!(loop & 64);
-		if (!dataB && writeB) {
+		if (!dataB && writeB)
+		{
 			handleB = handle2;
 			dataB = 1;
 		}
 		handleC = handle1;
 		writeC = !!(loop & 128);
 		dataC = !!(loop & 256);
-		if (!dataC && writeC) {
+		if (!dataC && writeC)
+		{
 			handleC = handle2;
 			dataC = 1;
 		}
@@ -142,26 +146,32 @@ int main(int argc, char **argv)
 			FPRINTF(stderr, " longB ");
 		if (durationC)
 			FPRINTF(stderr, " longC ");
-		if (dataA) {
+		if (dataA)
+		{
 			if (writeA)
 				FPRINTF(stderr, " WA");
 			else
 				FPRINTF(stderr, " RA");
-		} else if (writeA)
+		}
+		else if (writeA)
 			FPRINTF(stderr, " wA");
-		if (dataB) {
+		if (dataB)
+		{
 			if (writeB)
 				FPRINTF(stderr, " WB");
 			else
 				FPRINTF(stderr, " RB");
-		} else if (writeB)
+		}
+		else if (writeB)
 			FPRINTF(stderr, " wB");
-		if (dataC) {
+		if (dataC)
+		{
 			if (writeC)
 				FPRINTF(stderr, " WC");
 			else
 				FPRINTF(stderr, " RC");
-		} else if (writeC)
+		}
+		else if (writeC)
 			FPRINTF(stderr, " wC");
 		if (loop & 512)
 			FPRINTF(stderr, " Tag AB");

+ 3 - 3
tests/microbenchs/async_tasks_overhead.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -34,7 +34,7 @@ static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attri
 {
 }
 
-static struct starpu_codelet dummy_codelet = 
+static struct starpu_codelet dummy_codelet =
 {
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL|STARPU_GORDON,
 	.cpu_funcs = {dummy_func, NULL},
@@ -50,7 +50,7 @@ static struct starpu_codelet dummy_codelet =
 static void init_gordon_kernel(void)
 {
 #ifdef STARPU_USE_GORDON
-	unsigned elf_id = 
+	unsigned elf_id =
 		gordon_register_elf_plugin("./microbenchs/null_kernel_gordon.spuelf");
 	gordon_load_plugin_on_all_spu(elf_id);
 

+ 2 - 2
tests/microbenchs/tasks_overhead.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -35,7 +35,7 @@ static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attri
 {
 }
 
-static struct starpu_codelet dummy_codelet = 
+static struct starpu_codelet dummy_codelet =
 {
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
 	.cpu_funcs = {dummy_func, NULL},

+ 12 - 7
tests/microbenchs/tasks_size_overhead.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -56,18 +56,21 @@ static void func(void *descr[] __attribute__ ((unused)), void *arg)
 	unsigned n = (uintptr_t)arg;
 	long usec = 0;
 	gettimeofday(&tv1, NULL);
-	do {
+	do
+	{
 		gettimeofday(&tv2, NULL);
-		if (tv2.tv_usec < tv1.tv_usec) {
+		if (tv2.tv_usec < tv1.tv_usec)
+		{
 			tv2.tv_usec += 1000000;
 			tv2.tv_sec--;
 		}
 		usec = (tv2.tv_sec-tv1.tv_sec)*1000000
 			+ (tv2.tv_usec - tv1.tv_usec);
-	} while (usec < n);
+	}
+	while (usec < n);
 }
 
-static struct starpu_codelet codelet = 
+static struct starpu_codelet codelet =
 {
 	.where = STARPU_CPU,
 	.cpu_funcs = {func, NULL},
@@ -136,7 +139,8 @@ int main(int argc, char **argv)
 		FPRINTF(stdout, "%u iters(us)\ttotal(s)\t", size);
 	FPRINTF(stdout, "\n");
 	FPRINTF(stdout, "\"seq\"\t");
-	for (size = START; size <= STOP; size *= FACTOR) {
+	for (size = START; size <= STOP; size *= FACTOR)
+	{
 		double dstart, dend;
 		dstart = starpu_timing_now();
 		for (i = 0; i < ntasks; i++)
@@ -148,7 +152,8 @@ int main(int argc, char **argv)
 	fflush(stdout);
 
 	/* For each number of cpus, benchmark */
-	for (ncpus= 1; ncpus <= totcpus; ncpus++) {
+	for (ncpus= 1; ncpus <= totcpus; ncpus++)
+	{
 		FPRINTF(stdout, "%u\t", ncpus);
 		fflush(stdout);