Browse Source

fix type conversion

Nathalie Furmento 12 years ago
parent
commit
660641a5d4

+ 2 - 2
examples/basic_examples/block_cpu.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 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
@@ -26,7 +26,7 @@ void cpu_codelet(void *descr[], void *_args)
         unsigned ldy = STARPU_BLOCK_GET_LDY(descr[0]);
         unsigned ldz = STARPU_BLOCK_GET_LDZ(descr[0]);
         float *multiplier = (float *)_args;
-        unsigned i, j, k;
+        int i, j, k;
 
         for(k=0; k<nz ; k++)
 	{

+ 2 - 2
examples/filters/custom_mf/custom_conversion_codelets.c

@@ -21,7 +21,7 @@
 #ifdef STARPU_USE_CUDA
 void cuda_to_cpu(void *buffers[], void *arg)
 {
-	unsigned int n = CUSTOM_GET_NX(buffers[0]);
+	int n = CUSTOM_GET_NX(buffers[0]);
 	float *x = (float*) CUSTOM_GET_X_PTR(buffers[0]);
 	float *y = (float*) CUSTOM_GET_Y_PTR(buffers[0]);
 	struct point *aop;
@@ -60,7 +60,7 @@ struct starpu_codelet cuda_to_cpu_cl =
 #ifdef STARPU_USE_OPENCL
 void opencl_to_cpu_cpu_func(void *buffers[], void *arg)
 {
-	unsigned int n = CUSTOM_GET_NX(buffers[0]);
+	int n = CUSTOM_GET_NX(buffers[0]);
 	float *x = (float *) CUSTOM_GET_OPENCL_X_PTR(buffers[0]);
 	struct point *aop;
 	aop = (struct point *) CUSTOM_GET_CPU_PTR(buffers[0]);

+ 2 - 2
examples/filters/fblock_cpu.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 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
@@ -18,7 +18,7 @@
 
 void cpu_func(void *buffers[], void *cl_arg)
 {
-        unsigned i, j, k;
+        int i, j, k;
         int *factor = (int *) cl_arg;
 	int *block = (int *)STARPU_BLOCK_GET_PTR(buffers[0]);
 	int nx = (int)STARPU_BLOCK_GET_NX(buffers[0]);

+ 3 - 3
examples/filters/fmatrix.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * 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
@@ -43,9 +43,9 @@ void cpu_func(void *buffers[], void *cl_arg)
 
 int main(int argc, char **argv)
 {
-	unsigned i, j, n=1;
+	unsigned j, n=1;
         int matrix[NX*NY];
-	int ret;
+	int ret, i;
 
         FPRINTF(stderr,"IN  Matrix: \n");
         for(j=0 ; j<NY ; j++)

+ 2 - 2
examples/filters/fvector.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * 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
@@ -37,7 +37,7 @@ void cpu_func(void *buffers[], void *cl_arg)
 
 int main(int argc, char **argv)
 {
-	unsigned i;
+	int i;
         int vector[NX];
         starpu_data_handle_t handle;
         int factor=1;

+ 3 - 3
examples/filters/shadow.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 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
@@ -91,11 +91,11 @@ void cuda_func(void *buffers[], void *cl_arg)
 
 int main(int argc, char **argv)
 {
-	unsigned i, j;
+	unsigned j;
         int vector[NX + 2*SHADOW];
         int vector2[NX + PARTS*2*SHADOW];
 	starpu_data_handle_t handle, handle2;
-	int ret;
+	int ret, i;
 
         struct starpu_codelet cl =
 	{

+ 3 - 3
examples/ppm_downscaler/ppm_downscaler.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 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
@@ -75,7 +75,7 @@ struct ppm_image *file_to_ppm(char *filename)
 	ret = fread(ppm->data, sizeof(struct ppm_color), ppm->ncols*ppm->nlines, file);
 	STARPU_ASSERT(ret == ppm->ncols*ppm->nlines);
 
-	unsigned i;
+	int i;
 	for (i = 0; i < ppm->ncols*ppm->nlines; i++)
 	{
 /*		fprintf(stderr, "READ (index %d) -> r %d g %d b %d\n", i, ppm->data[i].r, ppm->data[i].g, ppm->data[i].b); */
@@ -121,7 +121,7 @@ void dummy_downscale(struct ppm_image *input_ppm, struct ppm_image *output_ppm)
 	struct ppm_color *in = input_ppm->data;
 	struct ppm_color *out = output_ppm->data;
 
-	unsigned line, col;
+	int line, col;
 	for (line = 0; line < output_ppm->nlines; line++)
 	{
 		for (col = 0; col < output_ppm->ncols; col++)

+ 2 - 2
examples/profiling/profiling.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
@@ -107,7 +107,7 @@ int main(int argc, char **argv)
 	FPRINTF(stderr, "Avg. length : %2.2lf us\n", (length_sum)/niter);
 
 	/* Display the occupancy of all workers during the test */
-	int worker;
+	unsigned worker;
 	for (worker = 0; worker < starpu_worker_get_count(); worker++)
 	{
 		struct starpu_worker_profiling_info worker_info;

+ 2 - 2
examples/sched_ctx/sched_ctx.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2012  Université de Bordeaux 1
- * Copyright (C) 2010-2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010-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
@@ -79,7 +79,7 @@ int main(int argc, char **argv)
 	/*indicate what to do with the resources when context 2 finishes (it depends on your application)*/
 	starpu_sched_ctx_set_inheritor(sched_ctx2, sched_ctx1);
 
-	unsigned i;
+	int i;
 	for (i = 0; i < ntasks/2; i++)
 	{
 		struct starpu_task *task = starpu_task_create();

+ 2 - 2
examples/scheduler/dummy_sched.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2012  Université de Bordeaux 1
- * Copyright (C) 2010-2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010-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
@@ -159,7 +159,7 @@ int main(int argc, char **argv)
 	ntasks /= 100;
 #endif
 
-	unsigned i;
+	int i;
 	for (i = 0; i < ntasks; i++)
 	{
 		struct starpu_task *task = starpu_task_create();

+ 1 - 1
examples/stencil/life.c

@@ -20,7 +20,7 @@
 
 void life_update(int bz, const TYPE *old, TYPE *newp, int nx, int ny, int nz, int ldy, int ldz, int iter)
 {
-	unsigned x, y, z, num, alive;
+	int x, y, z, num, alive;
 
 	for (z = iter; z < nz - iter; z++)
 	{

+ 5 - 5
examples/stencil/stencil-blocks.c

@@ -121,7 +121,7 @@ struct block_description *get_block_description(int z)
 	return &blocks[z];
 }
 
-unsigned get_block_mpi_node(int z)
+int get_block_mpi_node(int z)
 {
 	z = (z + nbz)%nbz;
 	return blocks[z].mpi_node;
@@ -277,7 +277,7 @@ void allocate_memory_on_node(int rank)
 	{
 		struct block_description *block = get_block_description(bz);
 
-		unsigned node = block->mpi_node;
+		int node = block->mpi_node;
 
 		unsigned size_bz = block_sizes_z[bz];
 	
@@ -301,7 +301,7 @@ void allocate_memory_on_node(int rank)
 		}
 
 		/* Boundary blocks : Top */
-		unsigned top_node = block->boundary_blocks[T]->mpi_node;
+		int top_node = block->boundary_blocks[T]->mpi_node;
 		if ((node == rank) || (top_node == rank))
 		{
 			allocate_block_on_node(&block->boundaries_handle[T][0], &block->boundaries[T][0],
@@ -311,7 +311,7 @@ void allocate_memory_on_node(int rank)
 		} 
 
 		/* Boundary blocks : Bottom */
-		unsigned bottom_node = block->boundary_blocks[B]->mpi_node;
+		int bottom_node = block->boundary_blocks[B]->mpi_node;
 		if ((node == rank) || (bottom_node == rank))
 		{
 			allocate_block_on_node(&block->boundaries_handle[B][0], &block->boundaries[B][0],
@@ -330,7 +330,7 @@ void check(int rank)
 	{
 		struct block_description *block = get_block_description(bz);
 
-		unsigned node = block->mpi_node;
+		int node = block->mpi_node;
 
 		/* Main blocks */
 		if (node == rank)

+ 8 - 8
examples/stencil/stencil-tasks.c

@@ -40,7 +40,7 @@
  */
 
 /* R(z) = R(z+d) = local, just call the save kernel */
-static void create_task_save_local(unsigned iter, unsigned z, int dir, unsigned local_rank)
+static void create_task_save_local(unsigned iter, unsigned z, int dir, int local_rank)
 {
 	struct starpu_task *save_task = starpu_task_create();
 	struct block_description *descr = get_block_description(z);
@@ -81,7 +81,7 @@ static void send_done(void *arg)
 
 #ifdef STARPU_USE_MPI
 /* Post MPI send */
-static void create_task_save_mpi_send(unsigned iter, unsigned z, int dir, unsigned local_rank)
+static void create_task_save_mpi_send(unsigned iter, unsigned z, int dir, int local_rank)
 {
 	struct block_description *descr = get_block_description(z);
 	STARPU_ASSERT(descr->mpi_node == local_rank);
@@ -108,7 +108,7 @@ static void recv_done(void *arg)
 }
 
 /* Post MPI recv */
-static void create_task_save_mpi_recv(unsigned iter, unsigned z, int dir, unsigned local_rank)
+static void create_task_save_mpi_recv(unsigned iter, unsigned z, int dir, int local_rank)
 {
 	struct block_description *descr = get_block_description(z);
 	STARPU_ASSERT(descr->mpi_node != local_rank);
@@ -129,10 +129,10 @@ static void create_task_save_mpi_recv(unsigned iter, unsigned z, int dir, unsign
 /*
  * Schedule saving boundaries of blocks to communication buffers
  */
-void create_task_save(unsigned iter, unsigned z, int dir, unsigned local_rank)
+void create_task_save(unsigned iter, unsigned z, int dir, int local_rank)
 {
-	unsigned node_z = get_block_mpi_node(z);
-	unsigned node_z_and_d = get_block_mpi_node(z+dir);
+	int node_z = get_block_mpi_node(z);
+	int node_z_and_d = get_block_mpi_node(z+dir);
 
 #ifdef STARPU_USE_MPI
 	if (node_z == local_rank)
@@ -168,7 +168,7 @@ void create_task_save(unsigned iter, unsigned z, int dir, unsigned local_rank)
  * Schedule update computation in computation buffer
  */
 
-void create_task_update(unsigned iter, unsigned z, unsigned local_rank)
+void create_task_update(unsigned iter, unsigned z, int local_rank)
 {
 	STARPU_ASSERT(iter != 0);
 
@@ -288,7 +288,7 @@ void create_tasks(int rank)
  */
 void wait_end_tasks(int rank)
 {
-	unsigned bz;
+	int bz;
 	int nbz = get_nbz();
 
 	for (bz = 0; bz < nbz; bz++)

+ 4 - 4
examples/stencil/stencil.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  * Copyright (C) 2010-2012  Université de Bordeaux 1
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -221,7 +221,7 @@ int main(int argc, char **argv)
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 #ifdef STARPU_USE_MPI
-	starpu_mpi_initialize();
+	starpu_mpi_init(NULL, NULL, 0);
 #endif
 
 #ifdef STARPU_USE_OPENCL
@@ -312,8 +312,8 @@ int main(int argc, char **argv)
 #if 1
 		unsigned nzblocks_per_process = (nbz + world_size - 1) / world_size;
 
-		unsigned bz, iter;
-		unsigned last;
+		int iter;
+		unsigned last, bz;
 		for (iter = 0; iter < who_runs_what_len; iter++)
 		{
 			last = 1;

+ 6 - 6
examples/stencil/stencil.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  * Copyright (C) 2010-2011  Université de Bordeaux 1
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -56,8 +56,8 @@ typedef enum
 struct block_description
 {
 	/* Which MPI node should process that block ? */
-	unsigned mpi_node;
-	
+	int mpi_node;
+
 	unsigned preferred_worker;
 
 	unsigned bz;
@@ -101,7 +101,7 @@ void check(int rank);
 
 void display_memory_consumption(int rank);
 
-unsigned get_block_mpi_node(int z);
+int get_block_mpi_node(int z);
 unsigned get_block_size(int z);
 unsigned get_bind_tasks(void);
 
@@ -111,8 +111,8 @@ unsigned get_ticks(void);
 
 unsigned global_workerid(unsigned local_workerid);
 
-void create_task_update(unsigned iter, unsigned z, unsigned local_rank);
-void create_task_save(unsigned iter, unsigned z, int dir, unsigned local_rank);
+void create_task_update(unsigned iter, unsigned z, int local_rank);
+void create_task_save(unsigned iter, unsigned z, int dir, int local_rank);
 
 extern int starpu_mpi_initialize(void);
 extern int starpu_mpi_shutdown(void);

+ 1 - 1
examples/tag_example/tag_example2.c

@@ -76,7 +76,7 @@ static void tag_cleanup_grid(unsigned ni, unsigned iter)
 
 static int create_task_grid(unsigned iter)
 {
-	int i;
+	unsigned i;
 	int ret;
 
 /*	FPRINTF(stderr, "start iter %d ni %d...\n", iter, ni); */

+ 1 - 2
mpi/examples/matrix_decomposition/mpi_cholesky_codelets.c

@@ -72,10 +72,9 @@ void dw_cholesky(float ***matA, unsigned size, unsigned ld, unsigned nblocks, in
 	struct timeval start;
 	struct timeval end;
 	starpu_data_handle_t **data_handles;
-	int x, y;
+	unsigned x,y,i,j,k;
 
 	/* create all the DAG nodes */
-	unsigned i,j,k;
 
 	data_handles = malloc(nblocks*sizeof(starpu_data_handle_t *));
 	for(x=0 ; x<nblocks ; x++) data_handles[x] = malloc(nblocks*sizeof(starpu_data_handle_t));

+ 3 - 3
mpi/examples/mpi_lu/plu_example.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2011, 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
@@ -32,8 +32,8 @@
 static unsigned long size = 4096;
 static unsigned nblocks = 16;
 static unsigned check = 0;
-static unsigned p = 1;
-static unsigned q = 1;
+static int p = 1;
+static int q = 1;
 static unsigned display = 0;
 
 #ifdef STARPU_HAVE_LIBNUMA

+ 2 - 2
mpi/examples/mpi_lu/pxlu.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010, 2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -101,7 +101,7 @@ static void send_data_to_mask(starpu_data_handle_t handle, int *rank_mask, int m
 	int mpi_tag_array[world_size];
 	starpu_data_handle_t handle_array[world_size];
 
-	unsigned r;
+	int r;
 	for (r = 0; r < world_size; r++)
 	{
 		if (rank_mask[r]) {

+ 3 - 3
tests/datawizard/gpu_register.c

@@ -65,12 +65,12 @@ find_a_worker(enum starpu_archtype type)
 static int
 check_result(unsigned *t, size_t size)
 {
-	int i;
-	for (i = 0; i < (int)size; i++)
+	unsigned i;
+	for (i = 0; i < size; i++)
 	{
 		if (t[i] != i*2)
 		{
-			FPRINTF(stderr,"t[%d] is %u instead of %d\n", i, t[i], 2*i);
+			FPRINTF(stderr,"t[%d] is %u instead of %u\n", i, t[i], 2*i);
 			return 1;
 		}
 	}

+ 4 - 4
tests/datawizard/handle_to_pointer.c

@@ -25,7 +25,7 @@ static void cpu_task(void **buffers, void *args)
 {
 	int *numbers;
 	int i;
-	size_t size;
+	int size;
 
 	numbers = (int *) STARPU_VECTOR_GET_PTR(buffers[0]);
 	starpu_codelet_unpack_args (args, &size);
@@ -41,7 +41,7 @@ static void cuda_task(void **buffers, void *args)
 {
 	int *numbers;
 	int i;
-	size_t size;
+	int size;
 
 	numbers = (int *)STARPU_VECTOR_GET_PTR(buffers[0]);
 	starpu_codelet_unpack_args (args, &size);
@@ -98,10 +98,10 @@ static struct starpu_codelet cl =
 int main(int argc, char *argv[])
 {
 	int err, ret;
-	size_t i;
+	int i;
 	int *pointer;
 	starpu_data_handle_t handle;
-	static const size_t count = 123;
+	static const int count = 123;
 
 	ret = starpu_init(NULL);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;

+ 5 - 6
tests/datawizard/in_place_partition.c

@@ -23,8 +23,7 @@ int main(int argc, char **argv)
 	unsigned *foo;
 	starpu_data_handle_t handle;
 	int ret;
-	int n, i, size;
-	unsigned j;
+	unsigned n, i, size;
 
 	ret = starpu_init(NULL);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
@@ -62,14 +61,14 @@ int main(int argc, char **argv)
 
 	starpu_data_partition(handle, &f);
 
-	for (j = 0; j < f.nchildren; j++)
+	for (i = 0; i < f.nchildren; i++)
 	{
 		struct starpu_task *task = starpu_task_create();
 
-		task->handles[0] = starpu_data_get_sub_data(handle, 1, j);
+		task->handles[0] = starpu_data_get_sub_data(handle, 1, i);
 		task->cl = &scal_codelet;
 		task->execute_on_a_specific_worker = 1;
-		task->workerid = j;
+		task->workerid = i;
 
 		ret = starpu_task_submit(task);
 		if (ret == -ENODEV) goto enodev;
@@ -88,7 +87,7 @@ int main(int argc, char **argv)
 	{
 		if (foo[i] != i*2)
 		{
-			FPRINTF(stderr,"value %d is %u instead of %d\n", i, foo[i], 2*i);
+			FPRINTF(stderr,"value %u is %u instead of %u\n", i, foo[i], 2*i);
 			ret = EXIT_FAILURE;
 		}
 	}