瀏覽代碼

src: fix cppcheck warnings

Nathalie Furmento 8 年之前
父節點
當前提交
b9cd261dbb

+ 1 - 1
src/core/dependencies/task_deps.c

@@ -74,7 +74,7 @@ void _starpu_task_declare_deps_array(struct starpu_task *task, unsigned ndeps, s
 #ifdef STARPU_OPENMP
 				|| job->continuation
 #endif
-				, "Task dependencies have to be set before submission (submitted %u destroy %d detach %d)", job->submitted, task->destroy, task->detach);
+				, "Task dependencies have to be set before submission (submitted %u destroy %u detach %u)", job->submitted, task->destroy, task->detach);
 	else
 		STARPU_ASSERT_MSG(job->terminated <= 1, "Task dependencies have to be set before termination (terminated %u)", job->terminated);
 

+ 8 - 10
src/core/detect_combined_workers.c

@@ -265,10 +265,9 @@ static void find_and_assign_combinations_without_hwloc(int *workerids, int nwork
 	}
 #endif /* STARPU_USE_MIC */
 
-	struct _starpu_worker *worker;
 	for (i = 0; i < nworkers; i++)
 	{
-		worker = _starpu_get_worker_struct(workerids[i]);
+		struct _starpu_worker *worker = _starpu_get_worker_struct(workerids[i]);
 		if (worker->arch == STARPU_CPU_WORKER)
 			cpu_workers[ncpus++] = i;
 #ifdef STARPU_USE_MIC
@@ -299,14 +298,15 @@ static void find_and_assign_combinations_without_hwloc(int *workerids, int nwork
 	assign_combinations_without_hwloc(workers,cpu_workers,ncpus,min,max);
 #ifdef STARPU_USE_MIC
 	mic_min = starpu_get_env_number("STARPU_MIN_WORKERSIZE");
+	mic_max = starpu_get_env_number("STARPU_MAX_WORKERSIZE");
 	if (mic_min < 2)
 		mic_min = 2;
 	for(j=0; j<nb_mics; j++)
 	{
-		mic_max = starpu_get_env_number("STARPU_MAX_WORKERSIZE");
-		if (mic_max == -1 || mic_max > (int) nmics_table[j])
-			mic_max = nmics_table[j];
-		assign_combinations_without_hwloc(workers,mic_workers[j],nmics_table[j],mic_min,mic_max);
+		int _mic_max = mic_max;
+		if (_mic_max == -1 || _mic_max > (int) nmics_table[j])
+			_mic_max = nmics_table[j];
+		assign_combinations_without_hwloc(workers,mic_workers[j],nmics_table[j],mic_min,_mic_max);
 		free(mic_workers[j]);
 	}
 	free(mic_id);
@@ -325,14 +325,13 @@ static void combine_all_cpu_workers(int *workerids, int nworkers)
 	struct starpu_worker_collection* workers = starpu_sched_ctx_get_worker_collection(sched_ctx_id);
 	int cpu_workers[STARPU_NMAXWORKERS];
 	int ncpus = 0;
-	struct _starpu_worker *worker;
 	int i;
 	int min;
 	int max;
 
 	for (i = 0; i < nworkers; i++)
 	{
-		worker = _starpu_get_worker_struct(workerids[i]);
+		struct _starpu_worker *worker = _starpu_get_worker_struct(workerids[i]);
 
 		if (worker->arch == STARPU_CPU_WORKER)
 			cpu_workers[ncpus++] = workerids[i];
@@ -347,8 +346,7 @@ static void combine_all_cpu_workers(int *workerids, int nworkers)
 
 	for (i = min; i <= max; i++)
 	{
-		int newworkerid;
-		newworkerid = starpu_combined_worker_assign_workerid(i, cpu_workers);
+		int newworkerid = starpu_combined_worker_assign_workerid(i, cpu_workers);
 		STARPU_ASSERT(newworkerid >= 0);
 		workers->add(workers, newworkerid);
 	}

+ 2 - 2
src/core/disk_ops/disk_unistd_o_direct.c

@@ -53,7 +53,7 @@ static void *starpu_unistd_o_direct_open(void *base, void *pos, size_t size)
 /* read the memory disk */
 static int starpu_unistd_o_direct_read(void *base, void *obj, void *buf, off_t offset, size_t size)
 {
-	STARPU_ASSERT_MSG((size % getpagesize()) == 0, "You can only read a multiple of page size %u Bytes (Here %u)", getpagesize(), (int) size);
+	STARPU_ASSERT_MSG((size % getpagesize()) == 0, "You can only read a multiple of page size %u Bytes (Here %d)", getpagesize(), (int) size);
 
 	STARPU_ASSERT_MSG((((uintptr_t) buf) % getpagesize()) == 0, "You have to use starpu_malloc function");
 
@@ -63,7 +63,7 @@ static int starpu_unistd_o_direct_read(void *base, void *obj, void *buf, off_t o
 /* write on the memory disk */
 static int starpu_unistd_o_direct_write(void *base, void *obj, const void *buf, off_t offset, size_t size)
 {
-	STARPU_ASSERT_MSG((size % getpagesize()) == 0, "You can only write a multiple of page size %u Bytes (Here %u)", getpagesize(), (int) size);
+	STARPU_ASSERT_MSG((size % getpagesize()) == 0, "You can only write a multiple of page size %u Bytes (Here %d)", getpagesize(), (int) size);
 
 	STARPU_ASSERT_MSG((((uintptr_t)buf) % getpagesize()) == 0, "You have to use starpu_malloc function");
 

+ 5 - 6
src/core/jobs.c

@@ -436,9 +436,9 @@ void _starpu_handle_job_termination(struct _starpu_job *j)
 	/* NB: we do not save those values before the callback, in case the
 	 * application changes some parameters eventually (eg. a task may not
 	 * be generated if the application is terminated). */
-	int destroy = task->destroy;
-	int detach = task->detach;
-	int regenerate = task->regenerate;
+	unsigned destroy = task->destroy;
+	unsigned detach = task->detach;
+	unsigned regenerate = task->regenerate;
 
 	/* we do not desallocate the job structure if some is going to
 	 * wait after the task */
@@ -476,7 +476,7 @@ void _starpu_handle_job_termination(struct _starpu_job *j)
 	{
 		STARPU_ASSERT_MSG((detach && !destroy && !task->synchronous)
 				|| continuation
-				, "Regenerated task must be detached (was %d), and not have detroy=1 (was %d) or synchronous=1 (was %d)", detach, destroy, task->synchronous);
+				, "Regenerated task must be detached (was %u), and not have detroy=1 (was %u) or synchronous=1 (was %u)", detach, destroy, task->synchronous);
 		STARPU_AYU_ADDTASK(j->job_id, j->exclude_from_dag?NULL:task);
 
 		{
@@ -721,7 +721,6 @@ int _starpu_push_local_task(struct _starpu_worker *worker, struct starpu_task *t
 			/* Increase the size */
 			unsigned alloc = worker->local_ordered_tasks_size;
 			struct starpu_task **new;
-			unsigned copied;
 
 			if (!alloc)
 				alloc = 1;
@@ -732,7 +731,7 @@ int _starpu_push_local_task(struct _starpu_worker *worker, struct starpu_task *t
 			if (worker->local_ordered_tasks_size)
 			{
 				/* Put existing tasks at the beginning of the new ring */
-				copied = worker->local_ordered_tasks_size - worker->current_ordered_task;
+				unsigned copied = worker->local_ordered_tasks_size - worker->current_ordered_task;
 				memcpy(new, &worker->local_ordered_tasks[worker->current_ordered_task], copied * sizeof(*new));
 				memcpy(new + copied, worker->local_ordered_tasks, (worker->local_ordered_tasks_size - copied) * sizeof(*new));
 			}

+ 1 - 1
src/core/perfmodel/multiple_regression.c

@@ -343,7 +343,7 @@ int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, doubl
 				if(parameters_names != NULL && parameters_names[j]!= NULL)
 					fprintf(f, ", %s", parameters_names[j]);
 				else
-					fprintf(f, ", P%d", j);
+					fprintf(f, ", P%u", j);
 			}
 		}
 	}

+ 28 - 28
src/core/perfmodel/perfmodel_bus.c

@@ -884,7 +884,7 @@ static void write_bus_affinity_file_content(void)
 #ifdef STARPU_USE_CUDA
 	for (gpu = 0; gpu < ncuda; gpu++)
 	{
-		fprintf(f, "%d\t", gpu);
+		fprintf(f, "%u\t", gpu);
 
 		for (cpu = 0; cpu < ncpus; cpu++)
 		{
@@ -897,7 +897,7 @@ static void write_bus_affinity_file_content(void)
 #ifdef STARPU_USE_OPENCL
 	for (gpu = 0; gpu < nopencl; gpu++)
 	{
-		fprintf(f, "%d\t", gpu);
+		fprintf(f, "%u\t", gpu);
 
 		for (cpu = 0; cpu < ncpus; cpu++)
 		{
@@ -967,7 +967,7 @@ void starpu_bus_print_affinity(FILE *f)
 	fprintf(f, "# CUDA\n");
 	for(gpu = 0 ; gpu<ncuda ; gpu++)
 	{
-		fprintf(f, "%d\t", gpu);
+		fprintf(f, "%u\t", gpu);
 		for (cpu = 0; cpu < ncpus; cpu++)
 		{
 			fprintf(f, "%d\t", cuda_affinity_matrix[gpu][cpu]);
@@ -979,7 +979,7 @@ void starpu_bus_print_affinity(FILE *f)
 	fprintf(f, "# OpenCL\n");
 	for(gpu = 0 ; gpu<nopencl ; gpu++)
 	{
-		fprintf(f, "%d\t", gpu);
+		fprintf(f, "%u\t", gpu);
 		for (cpu = 0; cpu < ncpus; cpu++)
 		{
 			fprintf(f, "%d\t", opencl_affinity_matrix[gpu][cpu]);
@@ -1127,7 +1127,7 @@ static void write_bus_latency_file_content(void)
 
 	fprintf(f, "# ");
 	for (dst = 0; dst < STARPU_MAXNODES; dst++)
-		fprintf(f, "to %d\t\t", dst);
+		fprintf(f, "to %u\t\t", dst);
 	fprintf(f, "\n");
 
         maxnode = ncuda;
@@ -1348,7 +1348,7 @@ static void write_bus_bandwidth_file_content(void)
 
 	fprintf(f, "# ");
 	for (dst = 0; dst < STARPU_MAXNODES; dst++)
-		fprintf(f, "to %d\t\t", dst);
+		fprintf(f, "to %u\t\t", dst);
 	fprintf(f, "\n");
 
         maxnode = ncuda;
@@ -1453,11 +1453,11 @@ void starpu_bus_print_bandwidth(FILE *f)
 	fprintf(f, "from/to\t");
 	fprintf(f, "RAM\t");
 	for (dst = 0; dst < ncuda; dst++)
-		fprintf(f, "CUDA %d\t", dst);
+		fprintf(f, "CUDA %u\t", dst);
 	for (dst = 0; dst < nopencl; dst++)
-		fprintf(f, "OpenCL%d\t", dst);
+		fprintf(f, "OpenCL%u\t", dst);
 	for (dst = 0; dst < nmic; dst++)
-		fprintf(f, "MIC%d\t", dst);
+		fprintf(f, "MIC%u\t", dst);
 	fprintf(f, "\n");
 
 	for (src = 0; src <= maxnode; src++)
@@ -1465,11 +1465,11 @@ void starpu_bus_print_bandwidth(FILE *f)
 		if (!src)
 			fprintf(f, "RAM\t");
 		else if (src <= ncuda)
-			fprintf(f, "CUDA %d\t", src-1);
+			fprintf(f, "CUDA %u\t", src-1);
 		else if (src <= ncuda + nopencl)
-			fprintf(f, "OpenCL%d\t", src-ncuda-1);
+			fprintf(f, "OpenCL%u\t", src-ncuda-1);
 		else
-			fprintf(f, "MIC%d\t", src-ncuda-nopencl-1);
+			fprintf(f, "MIC%u\t", src-ncuda-nopencl-1);
 		for (dst = 0; dst <= maxnode; dst++)
 			fprintf(f, "%.0f\t", bandwidth_matrix[src][dst]);
 
@@ -1482,11 +1482,11 @@ void starpu_bus_print_bandwidth(FILE *f)
 		if (!src)
 			fprintf(f, "RAM\t");
 		else if (src <= ncuda)
-			fprintf(f, "CUDA %d\t", src-1);
+			fprintf(f, "CUDA %u\t", src-1);
 		else if (src <= ncuda + nopencl)
-			fprintf(f, "OpenCL%d\t", src-ncuda-1);
+			fprintf(f, "OpenCL%u\t", src-ncuda-1);
 		else
-			fprintf(f, "MIC%d\t", src-ncuda-nopencl-1);
+			fprintf(f, "MIC%u\t", src-ncuda-nopencl-1);
 		for (dst = 0; dst <= maxnode; dst++)
 			fprintf(f, "%.0f\t", latency_matrix[src][dst]);
 
@@ -1506,7 +1506,7 @@ void starpu_bus_print_bandwidth(FILE *f)
 #ifdef STARPU_USE_CUDA
 		if (src <= ncuda)
 		{
-			fprintf(f, "CUDA %d\t", src-1);
+			fprintf(f, "CUDA %u\t", src-1);
 			for (cpu = 0; cpu < config_ncpus; cpu++)
 			{
 				timing = &cudadev_timing_per_cpu[src*STARPU_MAXCPUS+cpu];
@@ -1522,7 +1522,7 @@ void starpu_bus_print_bandwidth(FILE *f)
 #endif
 #ifdef STARPU_USE_OPENCL
 		{
-			fprintf(f, "OpenCL%d\t", src-ncuda-1);
+			fprintf(f, "OpenCL%u\t", src-ncuda-1);
 			for (cpu = 0; cpu < config_ncpus; cpu++)
 			{
 				timing = &opencldev_timing_per_cpu[(src-ncuda)*STARPU_MAXCPUS+cpu];
@@ -1676,9 +1676,9 @@ static void write_bus_config_file_content(void)
 
         fprintf(f, "# Current configuration\n");
         fprintf(f, "%u # Number of CPUs\n", ncpus);
-        fprintf(f, "%d # Number of CUDA devices\n", ncuda);
-        fprintf(f, "%d # Number of OpenCL devices\n", nopencl);
-        fprintf(f, "%d # Number of MIC devices\n", nmic);
+        fprintf(f, "%u # Number of CUDA devices\n", ncuda);
+        fprintf(f, "%u # Number of OpenCL devices\n", nopencl);
+        fprintf(f, "%u # Number of MIC devices\n", nmic);
 
 	if (locked)
 		_starpu_fwrunlock(f);
@@ -2171,7 +2171,7 @@ static void write_bus_platform_file_content(int version)
 	fprintf(f,
 "<?xml version='1.0'?>\n"
 "<!DOCTYPE platform SYSTEM '%s'>\n"
-" <platform version=\"%u\">\n"
+" <platform version=\"%d\">\n"
 " <config id=\"General\">\n"
 "   <prop id=\"network/TCP%cgamma\" value=\"-1\"></prop>\n"
 "   <prop id=\"network/latency%cfactor\" value=\"1\"></prop>\n"
@@ -2186,11 +2186,11 @@ static void write_bus_platform_file_content(int version)
 
 	for (i = 0; i < ncpus; i++)
 		/* TODO: host memory for out-of-core simulation */
-		fprintf(f, "   <host id=\"CPU%d\" %s=\"2000000000%s\"/>\n", i, speed, flops);
+		fprintf(f, "   <host id=\"CPU%u\" %s=\"2000000000%s\"/>\n", i, speed, flops);
 
 	for (i = 0; i < ncuda; i++)
 	{
-		fprintf(f, "   <host id=\"CUDA%d\" %s=\"2000000000%s\">\n", i, speed, flops);
+		fprintf(f, "   <host id=\"CUDA%u\" %s=\"2000000000%s\">\n", i, speed, flops);
 		fprintf(f, "     <prop id=\"memsize\" value=\"%llu\"/>\n", (unsigned long long) cuda_size[i]);
 #ifdef HAVE_CUDA_MEMCPY_PEER
 		fprintf(f, "     <prop id=\"memcpy_peer\" value=\"1\"/>\n");
@@ -2200,7 +2200,7 @@ static void write_bus_platform_file_content(int version)
 
 	for (i = 0; i < nopencl; i++)
 	{
-		fprintf(f, "   <host id=\"OpenCL%d\" %s=\"2000000000%s\">\n", i, speed, flops);
+		fprintf(f, "   <host id=\"OpenCL%u\" %s=\"2000000000%s\">\n", i, speed, flops);
 		fprintf(f, "     <prop id=\"memsize\" value=\"%llu\"/>\n", (unsigned long long) opencl_size[i]);
 		fprintf(f, "   </host>\n");
 	}
@@ -2243,7 +2243,7 @@ static void write_bus_platform_file_content(int version)
 	for (i = 0; i < nopencl; i++)
 	{
 		char i_name[16];
-		snprintf(i_name, sizeof(i_name), "OpenCL%d", i);
+		snprintf(i_name, sizeof(i_name), "OpenCL%u", i);
 		fprintf(f, "   <link id=\"RAM-%s\" bandwidth=\"%f%s\" latency=\"%f%s\"/>\n",
 			i_name,
 			1000000 / opencldev_timing_htod[1+i], Bps,
@@ -2265,7 +2265,7 @@ static void write_bus_platform_file_content(int version)
 	for (i = 0; i < ncuda; i++)
 	{
 		char i_name[16];
-		snprintf(i_name, sizeof(i_name), "CUDA%d", i);
+		snprintf(i_name, sizeof(i_name), "CUDA%u", i);
 		fprintf(f, "   <link id=\"RAM-%s\" bandwidth=\"%f%s\" latency=\"%f%s\"/>\n",
 			i_name,
 			1000000. / cudadev_timing_htod[1+i], Bps,
@@ -2365,7 +2365,7 @@ flat_cuda:
 	for (i = 0; i < ncuda; i++)
 	{
 		char i_name[16];
-		snprintf(i_name, sizeof(i_name), "CUDA%d", i);
+		snprintf(i_name, sizeof(i_name), "CUDA%u", i);
 		fprintf(f, "   <route src=\"RAM\" dst=\"%s\" symmetrical=\"NO\"><link_ctn id=\"RAM-%s\"/><link_ctn id=\"Host\"/></route>\n", i_name, i_name);
 		fprintf(f, "   <route src=\"%s\" dst=\"RAM\" symmetrical=\"NO\"><link_ctn id=\"%s-RAM\"/><link_ctn id=\"Host\"/></route>\n", i_name, i_name);
 	}
@@ -2397,7 +2397,7 @@ flat_cuda:
 	for (i = 0; i < nopencl; i++)
 	{
 		char i_name[16];
-		snprintf(i_name, sizeof(i_name), "OpenCL%d", i);
+		snprintf(i_name, sizeof(i_name), "OpenCL%u", i);
 		fprintf(f, "   <route src=\"RAM\" dst=\"%s\" symmetrical=\"NO\"><link_ctn id=\"RAM-%s\"/><link_ctn id=\"Host\"/></route>\n", i_name, i_name);
 		fprintf(f, "   <route src=\"%s\" dst=\"RAM\" symmetrical=\"NO\"><link_ctn id=\"%s-RAM\"/><link_ctn id=\"Host\"/></route>\n", i_name, i_name);
 	}

+ 18 - 16
src/core/perfmodel/perfmodel_history.c

@@ -301,19 +301,19 @@ static void dump_reg_model(FILE *f, struct starpu_perfmodel *model, int comb, in
 		_starpu_multiple_regression(per_arch_model->list, reg_model->coeff, reg_model->ncoeff, model->nparameters, model->parameters_names, model->combinations, model->symbol);
 
 		fprintf(f, "# n\tintercept\t");
-	        unsigned i, j;
-		int first;
 		if (reg_model->ncoeff==0 || model->ncombinations==0 || model->combinations==NULL)
 			fprintf(f, "\n1\tnan");
 		else
 		{
+			unsigned i;
 			for (i=0; i < model->ncombinations; i++)
 			{
 				if (model->parameters_names == NULL)
-					fprintf(f, "c%d", i+1);
+					fprintf(f, "c%u", i+1);
 				else
 				{
-					first=1;
+					unsigned j;
+					int first=1;
 					for(j=0; j < model->nparameters; j++)
 					{
 						if (model->combinations[i][j] > 0)
@@ -326,7 +326,7 @@ static void dump_reg_model(FILE *f, struct starpu_perfmodel *model, int comb, in
 							if(model->parameters_names[j] != NULL)
 								fprintf(f, "%s", model->parameters_names[j]);
 							else
-								fprintf(f, "P%d", j);
+								fprintf(f, "P%u", j);
 
 							if (model->combinations[i][j] > 1)
 								fprintf(f, "^%d", model->combinations[i][j]);
@@ -508,7 +508,7 @@ static void parse_per_arch_model_file(FILE *f, struct starpu_perfmodel_per_arch
 static void parse_arch(FILE *f, struct starpu_perfmodel *model, unsigned scan_history, int comb)
 {
 	struct starpu_perfmodel_per_arch dummy;
-	unsigned nimpls, implmax, impl, i, ret;
+	unsigned nimpls, impl, i, ret;
 
 	/* Parsing number of implementation */
 	_starpu_drop_comments(f);
@@ -518,7 +518,7 @@ static void parse_arch(FILE *f, struct starpu_perfmodel *model, unsigned scan_hi
 	if( model != NULL)
 	{
 		/* Parsing each implementation */
-		implmax = STARPU_MIN(nimpls, STARPU_MAXIMPLEMENTATIONS);
+		unsigned implmax = STARPU_MIN(nimpls, STARPU_MAXIMPLEMENTATIONS);
 		model->state->nimpls[comb] = implmax;
 		if (!model->state->per_arch[comb])
 		{
@@ -697,7 +697,7 @@ static void dump_model_file(FILE *f, struct starpu_perfmodel *model)
 	fprintf(f, "####################\n");
 	fprintf(f, "# COMBs\n");
 	fprintf(f, "# number of combinations\n");
-	fprintf(f, "%u\n", ncombs);
+	fprintf(f, "%d\n", ncombs);
 
 	int i, impl, dev;
 	for(i = 0; i < ncombs; i++)
@@ -707,7 +707,7 @@ static void dump_model_file(FILE *f, struct starpu_perfmodel *model)
 		fprintf(f, "####################\n");
 		fprintf(f, "# COMB_%d\n", comb);
 		fprintf(f, "# number of types devices\n");
-		fprintf(f, "%u\n", ndevices);
+		fprintf(f, "%d\n", ndevices);
 
 		for(dev = 0; dev < ndevices; dev++)
 		{
@@ -730,7 +730,7 @@ static void dump_model_file(FILE *f, struct starpu_perfmodel *model)
 		int nimpls = model->state->nimpls[comb];
 		fprintf(f, "##########\n");
 		fprintf(f, "# number of implementations\n");
-		fprintf(f, "%u\n", nimpls);
+		fprintf(f, "%d\n", nimpls);
 		for (impl = 0; impl < nimpls; impl++)
 		{
 			dump_per_arch_model_file(f, model, comb, impl);
@@ -929,7 +929,7 @@ void _starpu_deinitialize_performance_model(struct starpu_perfmodel *model)
 					struct starpu_perfmodel_per_arch *archmodel = &model->state->per_arch[i][impl];
 					if (archmodel->history)
 					{
-						struct starpu_perfmodel_history_list *list, *plist;
+						struct starpu_perfmodel_history_list *list;
 						struct starpu_perfmodel_history_table *entry, *tmp;
 
 						HASH_ITER(hh, archmodel->history, entry, tmp)
@@ -942,6 +942,7 @@ void _starpu_deinitialize_performance_model(struct starpu_perfmodel *model)
 						list = archmodel->list;
 						while (list)
 						{
+							struct starpu_perfmodel_history_list *plist;
 							free(list->entry);
 							plist = list;
 							list = list->next;
@@ -985,7 +986,7 @@ void _starpu_deinitialize_registered_performance_models(void)
 
 	STARPU_PTHREAD_RWLOCK_WRLOCK(&registered_models_rwlock);
 
-	struct _starpu_perfmodel_list *node, *pnode;
+	struct _starpu_perfmodel_list *node;
 	node = registered_models;
 
 	_STARPU_DEBUG("FREE MODELS !\n");
@@ -993,6 +994,7 @@ void _starpu_deinitialize_registered_performance_models(void)
 	while (node)
 	{
 		struct starpu_perfmodel *model = node->model;
+		struct _starpu_perfmodel_list *pnode;
 
 		STARPU_PTHREAD_RWLOCK_WRLOCK(&model->state->model_rwlock);
 		_starpu_deinitialize_performance_model(model);
@@ -1080,12 +1082,12 @@ int starpu_perfmodel_list(FILE *output)
 #if !defined(_WIN32) || defined(__MINGW32__) || defined(__CYGWIN__)
         char *path;
         DIR *dp;
-        struct dirent *ep;
 
 	path = _starpu_get_perf_model_dir_codelet();
         dp = opendir(path);
         if (dp != NULL)
 	{
+		struct dirent *ep;
                 while ((ep = readdir(dp)))
 		{
                         if (strcmp(ep->d_name, ".") && strcmp(ep->d_name, ".."))
@@ -1332,15 +1334,15 @@ double _starpu_multiple_regression_based_job_expected_perf(struct starpu_perfmod
 	if (reg_model->coeff == NULL)
 		goto docal;
 
-	double parameter_value;
 	double *parameters;
 	_STARPU_MALLOC(parameters, model->nparameters*sizeof(double));
 	model->parameters(j->task, parameters);
 	expected_duration=reg_model->coeff[0];
-	unsigned i, k;
+	unsigned i;
 	for (i=0; i < model->ncombinations; i++)
 	{
-		parameter_value=1.;
+		double parameter_value=1.;
+		unsigned k;
 		for (k=0; k < model->nparameters; k++)
 			parameter_value *= pow(parameters[k],model->combinations[i][k]);
 

+ 1 - 1
src/core/perfmodel/perfmodel_print.c

@@ -68,10 +68,10 @@ void starpu_perfmodel_print(struct starpu_perfmodel *model, struct starpu_perfmo
 	STARPU_ASSERT(comb != -1);
 
 	struct starpu_perfmodel_per_arch *arch_model = &model->state->per_arch[comb][nimpl];
-	char archname[32];
 
 	if (arch_model->regression.nsample || arch_model->regression.valid || arch_model->regression.nl_valid || arch_model->list)
 	{
+		char archname[32];
 		starpu_perfmodel_get_arch_name(arch, archname, 32, nimpl);
 		fprintf(output, "# performance model for %s\n", archname);
 	}

+ 35 - 60
src/core/sched_ctx.c

@@ -362,7 +362,6 @@ static void _starpu_remove_workers_from_sched_ctx(struct _starpu_sched_ctx *sche
 		}
 	}
 
-	int worker;
 	unsigned found = 0;
 	int dev;
 	struct starpu_sched_ctx_iterator it;
@@ -371,7 +370,7 @@ static void _starpu_remove_workers_from_sched_ctx(struct _starpu_sched_ctx *sche
 
 	while(workers->has_next(workers, &it))
 	{
-		worker = workers->get_next(workers, &it);
+		int worker = workers->get_next(workers, &it);
 		struct _starpu_worker *str_worker = _starpu_get_worker_struct(worker);
 		for(dev = 0; dev < str_worker->perf_arch.ndevices; dev++)
 		{
@@ -595,7 +594,6 @@ static void _get_workers(int min, int max, int *workers, int *nw, enum starpu_wo
 	int pus[max];
 	int npus = 0;
 	int i;
-	int n = 0;
 
 	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
 	if(config->topology.nsched_ctxs == 1)
@@ -636,6 +634,7 @@ static void _get_workers(int min, int max, int *workers, int *nw, enum starpu_wo
 					int ctx_min = arch == STARPU_CPU_WORKER ? config->sched_ctxs[s].min_ncpus : config->sched_ctxs[s].min_ngpus;
 					if(_npus > ctx_min)
 					{
+						int n=0;
 						if(npus < min)
 						{
 							n = (_npus - ctx_min) > (min - npus) ? min - npus : (_npus - ctx_min);
@@ -1232,8 +1231,6 @@ static void _set_priority_hierarchically(int* workers_to_add, unsigned nworkers_
 void starpu_sched_ctx_add_workers(int *workers_to_add, int nworkers_to_add, unsigned sched_ctx_id)
 {
 	struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
-	int added_workers[nworkers_to_add];
-	int n_added_workers = 0;
 
 	_starpu_unlock_mutex_if_prev_locked();
 
@@ -1245,6 +1242,9 @@ void starpu_sched_ctx_add_workers(int *workers_to_add, int nworkers_to_add, unsi
 	/* if the context has not already been deleted */
 	if(sched_ctx->id != STARPU_NMAX_SCHED_CTXS)
 	{
+		int added_workers[nworkers_to_add];
+		int n_added_workers = 0;
+
 		_starpu_add_workers_to_sched_ctx(sched_ctx, workers_to_add, nworkers_to_add, added_workers, &n_added_workers);
 
 		if(n_added_workers > 0)
@@ -1258,7 +1258,6 @@ void starpu_sched_ctx_add_workers(int *workers_to_add, int nworkers_to_add, unsi
 
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&changing_ctx_mutex[sched_ctx_id]);
 
-
 	_starpu_relock_mutex_if_prev_locked();
 
 	if(sched_ctx->id != STARPU_NMAX_SCHED_CTXS)
@@ -1274,8 +1273,6 @@ void starpu_sched_ctx_add_workers(int *workers_to_add, int nworkers_to_add, unsi
 void starpu_sched_ctx_remove_workers(int *workers_to_remove, int nworkers_to_remove, unsigned sched_ctx_id)
 {
 	struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
-	int removed_workers[sched_ctx->workers->nworkers];
-	int n_removed_workers = 0;
 
 	_starpu_check_workers(workers_to_remove, nworkers_to_remove);
 
@@ -1285,6 +1282,9 @@ void starpu_sched_ctx_remove_workers(int *workers_to_remove, int nworkers_to_rem
 	/* if the context has not already been deleted */
 	if(sched_ctx->id != STARPU_NMAX_SCHED_CTXS)
 	{
+		int removed_workers[sched_ctx->workers->nworkers];
+		int n_removed_workers = 0;
+
 		_starpu_remove_workers_from_sched_ctx(sched_ctx, workers_to_remove, nworkers_to_remove, removed_workers, &n_removed_workers);
 
 		if(n_removed_workers > 0)
@@ -1303,7 +1303,7 @@ void starpu_sched_ctx_remove_workers(int *workers_to_remove, int nworkers_to_rem
 
 int _starpu_nworkers_able_to_execute_task(struct starpu_task *task, struct _starpu_sched_ctx *sched_ctx)
 {
-	unsigned worker = 0, nworkers = 0;
+	unsigned nworkers = 0;
 
 	STARPU_PTHREAD_RWLOCK_WRLOCK(&changing_ctx_mutex[sched_ctx->id]);
 	struct starpu_worker_collection *workers = sched_ctx->workers;
@@ -1313,7 +1313,7 @@ int _starpu_nworkers_able_to_execute_task(struct starpu_task *task, struct _star
 	workers->init_iterator_for_parallel_tasks(workers, &it, task);
 	while(workers->has_next(workers, &it))
 	{
-		worker = workers->get_next(workers, &it);
+		unsigned worker = workers->get_next(workers, &it);
 		STARPU_ASSERT_MSG(worker < STARPU_NMAXWORKERS, "worker id %d", worker);
 		if (starpu_worker_can_execute_task_first_impl(worker, task, NULL))
 			nworkers++;
@@ -1664,7 +1664,7 @@ void starpu_sched_ctx_display_workers(unsigned sched_ctx_id, FILE *f)
 	unsigned i;
 
 	nworkers = starpu_sched_ctx_get_workers_list(sched_ctx_id, &workerids);
-	fprintf(f, "[sched_ctx %d]: %d worker%s\n", sched_ctx_id, nworkers, nworkers>1?"s":"");
+	fprintf(f, "[sched_ctx %u]: %u worker%s\n", sched_ctx_id, nworkers, nworkers>1?"s":"");
 	for (i = 0; i < nworkers; i++)
 	{
 		char name[256];
@@ -1685,7 +1685,6 @@ unsigned starpu_sched_ctx_get_workers_list(unsigned sched_ctx_id, int **workerid
 {
 	struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
 	struct starpu_worker_collection *workers = sched_ctx->workers;
-	int worker;
 	unsigned nworkers = 0;
 	struct starpu_sched_ctx_iterator it;
 
@@ -1695,7 +1694,7 @@ unsigned starpu_sched_ctx_get_workers_list(unsigned sched_ctx_id, int **workerid
 	workers->init_iterator(workers, &it);
 	while(workers->has_next(workers, &it))
 	{
-		worker = workers->get_next(workers, &it);
+		int worker = workers->get_next(workers, &it);
 		(*workerids)[nworkers++] = worker;
 	}
 	return nworkers;
@@ -1721,7 +1720,6 @@ int _starpu_get_workers_of_sched_ctx(unsigned sched_ctx_id, int *pus, enum starp
 	struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
 
 	struct starpu_worker_collection *workers = sched_ctx->workers;
-	int worker;
 
 	int npus = 0;
 	struct starpu_sched_ctx_iterator it;
@@ -1729,7 +1727,7 @@ int _starpu_get_workers_of_sched_ctx(unsigned sched_ctx_id, int *pus, enum starp
 	workers->init_iterator(workers, &it);
 	while(workers->has_next(workers, &it))
 	{
-		worker = workers->get_next(workers, &it);
+		int worker = workers->get_next(workers, &it);
 		enum starpu_worker_archtype curr_arch = starpu_worker_get_type(worker);
 		if(curr_arch == arch || arch == STARPU_ANY_WORKER)
 			pus[npus++] = worker;
@@ -1760,19 +1758,17 @@ unsigned starpu_sched_ctx_get_nshared_workers(unsigned sched_ctx_id, unsigned sc
 
         struct starpu_worker_collection *workers = sched_ctx->workers;
         struct starpu_worker_collection *workers2 = sched_ctx2->workers;
-        int worker, worker2;
         int shared_workers = 0;
-
 	struct starpu_sched_ctx_iterator it1, it2;
 
 	workers->init_iterator(workers, &it1);
 	workers2->init_iterator(workers2, &it2);
         while(workers->has_next(workers, &it1))
         {
-                worker = workers->get_next(workers, &it1);
+                int worker = workers->get_next(workers, &it1);
                 while(workers2->has_next(workers2, &it2))
 		{
-                        worker2 = workers2->get_next(workers2, &it2);
+                        int worker2 = workers2->get_next(workers2, &it2);
                         if(worker == worker2)
 				shared_workers++;
                 }
@@ -1800,13 +1796,11 @@ unsigned starpu_sched_ctx_contains_worker(int workerid, unsigned sched_ctx_id)
 unsigned starpu_sched_ctx_contains_type_of_worker(enum starpu_worker_archtype arch, unsigned sched_ctx_id)
 {
 	struct starpu_worker_collection *workers = starpu_sched_ctx_get_worker_collection(sched_ctx_id);
-	int worker;
-
 	unsigned i;
 
 	for (i = 0; i < workers->nworkers; i++)
 	{
-		worker = workers->workerids[i];
+		int worker = workers->workerids[i];
 		enum starpu_worker_archtype curr_arch = starpu_worker_get_type(worker);
 		if(curr_arch == arch)
 			return 1;
@@ -1819,13 +1813,12 @@ unsigned _starpu_worker_belongs_to_a_sched_ctx(int workerid, unsigned sched_ctx_
 {
 	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
 	int i;
-	struct _starpu_sched_ctx *sched_ctx = NULL;
 	for(i = 0; i < STARPU_NMAX_SCHED_CTXS; i++)
 	{
-		 sched_ctx = &config->sched_ctxs[i];
-		 if(sched_ctx && sched_ctx->id != STARPU_NMAX_SCHED_CTXS && sched_ctx->id != sched_ctx_id)
-			 if(starpu_sched_ctx_contains_worker(workerid, sched_ctx->id))
-				 return 1;
+		struct _starpu_sched_ctx *sched_ctx = &config->sched_ctxs[i];
+		if(sched_ctx && sched_ctx->id != STARPU_NMAX_SCHED_CTXS && sched_ctx->id != sched_ctx_id)
+			if(starpu_sched_ctx_contains_worker(workerid, sched_ctx->id))
+				return 1;
 	}
 	return 0;
 }
@@ -2010,25 +2003,22 @@ unsigned starpu_sched_ctx_get_priority(int workerid, unsigned sched_ctx_id)
 
 unsigned _starpu_sched_ctx_last_worker_awake(struct _starpu_worker *worker)
 {
-	struct _starpu_sched_ctx_elt *e = NULL;
 	struct _starpu_sched_ctx_list_iterator list_it;
 
 	_starpu_sched_ctx_list_iterator_init(worker->sched_ctx_list, &list_it);
 	while (_starpu_sched_ctx_list_iterator_has_next(&list_it))
 	{
-		e = _starpu_sched_ctx_list_iterator_get_next(&list_it);
+		struct _starpu_sched_ctx_elt *e = _starpu_sched_ctx_list_iterator_get_next(&list_it);
 		struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(e->sched_ctx);
 
 		unsigned last_worker_awake = 1;
 		struct starpu_worker_collection *workers = sched_ctx->workers;
 		struct starpu_sched_ctx_iterator it;
 
-		int workerid;
-
 		workers->init_iterator(workers, &it);
 		while(workers->has_next(workers, &it))
 		{
-			workerid = workers->get_next(workers, &it);
+			int workerid = workers->get_next(workers, &it);
 			if(workerid != worker->workerid && _starpu_worker_get_status(workerid) != STATUS_SLEEPING)
 			{
 				last_worker_awake = 0;
@@ -2052,15 +2042,13 @@ unsigned starpu_sched_ctx_worker_is_master_for_child_ctx(int workerid, unsigned
 		return STARPU_NMAX_SCHED_CTXS;
 
 	struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
-	struct _starpu_sched_ctx_elt *e = NULL;
 	struct _starpu_sched_ctx_list_iterator list_it;
-	struct _starpu_sched_ctx *sched_ctx = NULL;
 
 	_starpu_sched_ctx_list_iterator_init(worker->sched_ctx_list, &list_it);
 	while (_starpu_sched_ctx_list_iterator_has_next(&list_it))
 	{
-		e = _starpu_sched_ctx_list_iterator_get_next(&list_it);
-		sched_ctx = _starpu_get_sched_ctx_struct(e->sched_ctx);
+		struct _starpu_sched_ctx_elt *e = _starpu_sched_ctx_list_iterator_get_next(&list_it);
+		struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(e->sched_ctx);
 		if(sched_ctx-> main_master == workerid && sched_ctx->nesting_sched_ctx == sched_ctx_id)
 			return sched_ctx->id;
 	}
@@ -2070,15 +2058,13 @@ unsigned starpu_sched_ctx_worker_is_master_for_child_ctx(int workerid, unsigned
 unsigned starpu_sched_ctx_master_get_context(int masterid)
 {
 	struct _starpu_worker *worker = _starpu_get_worker_struct(masterid);
-	struct _starpu_sched_ctx_elt *e = NULL;
 	struct _starpu_sched_ctx_list_iterator list_it;
-	struct _starpu_sched_ctx *sched_ctx = NULL;
 
 	_starpu_sched_ctx_list_iterator_init(worker->sched_ctx_list, &list_it);
 	while (_starpu_sched_ctx_list_iterator_has_next(&list_it))
 	{
-		e = _starpu_sched_ctx_list_iterator_get_next(&list_it);
-		sched_ctx = _starpu_get_sched_ctx_struct(e->sched_ctx);
+		struct _starpu_sched_ctx_elt *e = _starpu_sched_ctx_list_iterator_get_next(&list_it);
+		struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(e->sched_ctx);
 		if(sched_ctx->main_master == masterid)
 			return sched_ctx->id;
 	}
@@ -2087,15 +2073,13 @@ unsigned starpu_sched_ctx_master_get_context(int masterid)
 
 struct _starpu_sched_ctx *__starpu_sched_ctx_get_sched_ctx_for_worker_and_job(struct _starpu_worker *worker, struct _starpu_job *j)
 {
-	struct _starpu_sched_ctx_elt *e = NULL;
 	struct _starpu_sched_ctx_list_iterator list_it;
-	struct _starpu_sched_ctx *sched_ctx = NULL;
 
 	_starpu_sched_ctx_list_iterator_init(worker->sched_ctx_list, &list_it);
 	while (_starpu_sched_ctx_list_iterator_has_next(&list_it))
 	{
-		e = _starpu_sched_ctx_list_iterator_get_next(&list_it);
-		sched_ctx = _starpu_get_sched_ctx_struct(e->sched_ctx);
+		struct _starpu_sched_ctx_elt *e = _starpu_sched_ctx_list_iterator_get_next(&list_it);
+		struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(e->sched_ctx);
 		if (j->task->sched_ctx == sched_ctx->id)
 			return sched_ctx;
 	}
@@ -2168,15 +2152,13 @@ void starpu_sched_ctx_list_task_counters_increment_all(struct starpu_task *task,
 	{
 		struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
 		struct starpu_worker_collection *workers = starpu_sched_ctx_get_worker_collection(sched_ctx_id);
-		unsigned worker = 0;
 		struct starpu_sched_ctx_iterator it;
 
 		workers->init_iterator_for_parallel_tasks(workers, &it, task);
 		STARPU_PTHREAD_MUTEX_LOCK(&sched_ctx->sched_ctx_list_mutex);
 		while(workers->has_next(workers, &it))
 		{
-			worker = workers->get_next(workers, &it);
-
+			int worker = workers->get_next(workers, &it);
 			starpu_sched_ctx_list_task_counters_increment(sched_ctx_id, worker);
 		}
 		STARPU_PTHREAD_MUTEX_UNLOCK(&sched_ctx->sched_ctx_list_mutex);
@@ -2197,13 +2179,12 @@ void starpu_sched_ctx_list_task_counters_decrement_all(struct starpu_task *task,
 
 		struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
 		struct starpu_worker_collection *workers = starpu_sched_ctx_get_worker_collection(sched_ctx_id);
-		unsigned worker = 0;
 		struct starpu_sched_ctx_iterator it;
 		workers->init_iterator_for_parallel_tasks(workers, &it, task);
 		STARPU_PTHREAD_MUTEX_LOCK(&sched_ctx->sched_ctx_list_mutex);
 		while(workers->has_next(workers, &it))
 		{
-			worker = workers->get_next(workers, &it);
+			int worker = workers->get_next(workers, &it);
 
 			worker_str = _starpu_get_worker_struct(worker);
 			if (worker_str->nsched_ctxs > 1)
@@ -2234,14 +2215,12 @@ void starpu_sched_ctx_list_task_counters_reset_all(struct starpu_task *task, uns
 
 		struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
 		struct starpu_worker_collection *workers = starpu_sched_ctx_get_worker_collection(sched_ctx_id);
-		unsigned worker = 0;
 		struct starpu_sched_ctx_iterator it;
 		workers->init_iterator_for_parallel_tasks(workers, &it, task);
 		STARPU_PTHREAD_MUTEX_LOCK(&sched_ctx->sched_ctx_list_mutex);
 		while(workers->has_next(workers, &it))
 		{
-			worker = workers->get_next(workers, &it);
-
+			int worker = workers->get_next(workers, &it);
 			worker_str = _starpu_get_worker_struct(worker);
 			if (worker_str->nsched_ctxs > 1)
 			{
@@ -2293,10 +2272,9 @@ static void _starpu_sched_ctx_get_workers_to_sleep(unsigned sched_ctx_id, int *w
 #endif
 	}
 
-	int workerid;
 	for(w = 0; w < nworkers; w++)
 	{
-		workerid = workerids[w];
+		int workerid = workerids[w];
 		if((current_worker_id == -1 || workerid != current_worker_id) && !sleeping[w])
 		{
 			sem_wait(&sched_ctx->fall_asleep_sem[master]);
@@ -2385,13 +2363,12 @@ void starpu_sched_ctx_get_available_cpuids(unsigned sched_ctx_id, int **cpuids,
 	int w = 0;
 
 	struct starpu_sched_ctx_iterator it;
-	int workerid;
 
 	workers->init_iterator(workers, &it);
 
 	while(workers->has_next(workers, &it))
 	{
-		workerid = workers->get_next(workers, &it);
+		int workerid = workers->get_next(workers, &it);
 		int master = sched_ctx->master[workerid];
 		if(master == current_worker_id || workerid == current_worker_id || current_worker_id == -1)
 		{
@@ -2424,10 +2401,9 @@ static void _starpu_sched_ctx_wake_these_workers_up(unsigned sched_ctx_id, int *
 		sched_ctx->master[workerid] = -1;
 	}
 
-	int workerid;
 	for(w = 0; w < nworkers; w++)
 	{
-		workerid = workerids[w];
+		int workerid = workerids[w];
 		if(masters[w] != -1)
 		{
 			int master = sched_ctx->master[workerid];
@@ -2567,7 +2543,6 @@ int starpu_sched_ctx_get_worker_rank(unsigned sched_ctx_id)
 {
 	int idx = 0;
 	int curr_workerid = starpu_worker_get_id();
-	int worker;
 	struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
 	if(sched_ctx->sched_policy || !sched_ctx->awake_workers)
 		return -1;
@@ -2578,7 +2553,7 @@ int starpu_sched_ctx_get_worker_rank(unsigned sched_ctx_id)
 	workers->init_iterator(workers, &it);
 	while(workers->has_next(workers, &it))
 	{
-		worker = workers->get_next(workers, &it);
+		int worker = workers->get_next(workers, &it);
 		if(worker == curr_workerid)
 			return idx;
 		idx++;

+ 1 - 2
src/core/sched_ctx_list.c

@@ -335,7 +335,6 @@ int _starpu_sched_ctx_list_iterator_init(struct _starpu_sched_ctx_list *list,
 
 int _starpu_sched_ctx_list_iterator_has_next(struct _starpu_sched_ctx_list_iterator *it)
 {
-	struct _starpu_sched_ctx_list *parent;
 	if (it->cursor == NULL)
 	{
 		if (it->list_head != NULL)
@@ -345,7 +344,7 @@ int _starpu_sched_ctx_list_iterator_has_next(struct _starpu_sched_ctx_list_itera
 	}
 	else
 	{
-		parent = it->cursor->parent;
+		struct _starpu_sched_ctx_list *parent = it->cursor->parent;
 		if (it->cursor->next == parent->head)
 			return parent->next != NULL;
 	}

+ 12 - 16
src/core/sched_policy.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2016  Université de Bordeaux
- * Copyright (C) 2010-2015  CNRS
+ * Copyright (C) 2010-2016  CNRS
  * Copyright (C) 2011, 2016  INRIA
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -255,15 +255,13 @@ void _starpu_sched_do_schedule(unsigned sched_ctx_id)
 static void _starpu_push_task_on_specific_worker_notify_sched(struct starpu_task *task, struct _starpu_worker *worker, int workerid, int perf_workerid)
 {
 	/* if we push a task on a specific worker, notify all the sched_ctxs the worker belongs to */
-	struct _starpu_sched_ctx *sched_ctx;
-	struct _starpu_sched_ctx_elt *e = NULL;
 	struct _starpu_sched_ctx_list_iterator list_it;
 
 	_starpu_sched_ctx_list_iterator_init(worker->sched_ctx_list, &list_it);
 	while (_starpu_sched_ctx_list_iterator_has_next(&list_it))
 	{
-		e = _starpu_sched_ctx_list_iterator_get_next(&list_it);
-		sched_ctx = _starpu_get_sched_ctx_struct(e->sched_ctx);
+		struct _starpu_sched_ctx_elt *e = _starpu_sched_ctx_list_iterator_get_next(&list_it);
+		struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(e->sched_ctx);
 		if (sched_ctx->sched_policy != NULL && sched_ctx->sched_policy->push_task_notify)
 		{
 			_STARPU_TRACE_WORKER_SCHEDULING_PUSH;
@@ -320,13 +318,13 @@ static int _starpu_push_task_on_specific_worker(struct starpu_task *task, int wo
 #ifdef STARPU_USE_SC_HYPERVISOR
 	starpu_sched_ctx_call_pushed_task_cb(workerid, task->sched_ctx);
 #endif //STARPU_USE_SC_HYPERVISOR
-	unsigned i;
 	if (is_basic_worker)
 	{
 		unsigned node = starpu_worker_get_memory_node(workerid);
 		if (_starpu_task_uses_multiformat_handles(task))
 		{
 			unsigned nbuffers = STARPU_TASK_GET_NBUFFERS(task);
+			unsigned i;
 			for (i = 0; i < nbuffers; i++)
 			{
 				struct starpu_task *conversion_task;
@@ -406,7 +404,6 @@ int _starpu_repush_task(struct _starpu_job *j)
 {
 	struct starpu_task *task = j->task;
 	struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(task->sched_ctx);
-	unsigned nworkers = 0;
 	int ret;
 
 	_STARPU_LOG_IN();
@@ -419,7 +416,7 @@ int _starpu_repush_task(struct _starpu_job *j)
 	{
 		/*if there are workers in the ctx that are not able to execute tasks
 		  we consider the ctx empty */
-		nworkers = _starpu_nworkers_able_to_execute_task(task, sched_ctx);
+		unsigned nworkers = _starpu_nworkers_able_to_execute_task(task, sched_ctx);
 
 		if(nworkers == 0)
 		{
@@ -548,7 +545,7 @@ int _starpu_push_task_to_workers(struct starpu_task *task)
 			else
 			{
 				struct starpu_worker_collection *workers = sched_ctx->workers;
-				
+
 				struct _starpu_job *job = _starpu_get_job_associated_to_task(task);
 				job->task_size = workers->nworkers;
 				job->combined_workerid = -1; // workerid; its a ctx not combined worker
@@ -558,14 +555,13 @@ int _starpu_push_task_to_workers(struct starpu_task *task)
 				STARPU_PTHREAD_BARRIER_INIT(&job->after_work_barrier, NULL, workers->nworkers);
 				job->after_work_busy_barrier = workers->nworkers;
 
-				unsigned workerid;
 				struct starpu_sched_ctx_iterator it;
 				if(workers->init_iterator)
 					workers->init_iterator(workers, &it);
 
 				while(workers->has_next(workers, &it))
 				{
-					workerid = workers->get_next(workers, &it);
+					unsigned workerid = workers->get_next(workers, &it);
 					struct starpu_task *alias = starpu_task_dup(task);
 					alias->destroy = 1;
 					ret |= _starpu_push_task_on_specific_worker(alias, workerid);
@@ -847,12 +843,12 @@ pick:
 					_starpu_pop_task_end(task);
 				}
 			}
-			
+
 			if(!task)
 			{
 				/* it doesn't matter if it shares tasks list or not in the scheduler,
 				   if it does not have any task to pop just get it out of here */
-				/* however if it shares a task list it will be removed as soon as he 
+				/* however if it shares a task list it will be removed as soon as he
 				  finishes this job (in handle_job_termination) */
 				if(worker->removed_from_ctx[sched_ctx->id])
 				{
@@ -871,7 +867,7 @@ pick:
 					}
 				}
 #endif //STARPU_USE_SC_HYPERVISOR
-				
+
 #ifndef STARPU_NON_BLOCKING_DRIVERS
 				if(been_here[sched_ctx->id] || worker->nsched_ctxs == 1)
 					break;
@@ -896,7 +892,7 @@ pick:
 		idle[worker->workerid] += (idle_end - idle_start[worker->workerid]);
 		idle_start[worker->workerid] = 0.0;
 	}
-	
+
 
 #ifdef STARPU_USE_SC_HYPERVISOR
 	struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(task->sched_ctx);
@@ -994,7 +990,7 @@ struct starpu_task *_starpu_pop_every_task(struct _starpu_sched_ctx *sched_ctx)
 	if(sched_ctx->sched_policy)
 	{
 		STARPU_ASSERT(sched_ctx->sched_policy->pop_every_task);
-		
+
 		/* TODO set profiling info */
 		if(sched_ctx->sched_policy->pop_every_task)
 		{

+ 1 - 2
src/core/task.c

@@ -246,11 +246,10 @@ int starpu_task_wait(struct starpu_task *task)
 int starpu_task_wait_array(struct starpu_task **tasks, unsigned nb_tasks)
 {
 	unsigned i;
-	int ret;
 
 	for (i = 0; i < nb_tasks; i++)
 	{
-		ret = starpu_task_wait(tasks[i]);
+		int ret = starpu_task_wait(tasks[i]);
 		if (ret)
 			return ret;
 	}

+ 3 - 4
src/core/tree.c

@@ -61,11 +61,10 @@ struct starpu_tree* starpu_tree_get(struct starpu_tree *tree, int id)
 			return NULL;
 	}
 
-	struct starpu_tree *found_tree = NULL;
 	int i;
 	for(i = 0; i < tree->arity; i++)
 	{
-		found_tree = starpu_tree_get(&tree->nodes[i], id);
+		struct starpu_tree *found_tree = starpu_tree_get(&tree->nodes[i], id);
 		if(found_tree)
 			return found_tree;
 	}
@@ -107,7 +106,7 @@ struct starpu_tree* starpu_tree_get_neighbour(struct starpu_tree *tree, struct s
 {
 	struct starpu_tree *father = node == NULL ? tree : node->father;
 
-	int i, st, n;
+	int st, n;
 
 	for(st = 0; st < father->arity; st++)
 	{
@@ -117,7 +116,7 @@ struct starpu_tree* starpu_tree_get_neighbour(struct starpu_tree *tree, struct s
 
 	for(n = 0; n < father->arity; n++)
 	{
-		i = (st+n)%father->arity;
+		int i = (st+n)%father->arity;
 		if(&father->nodes[i] != node)
 		{
 			if(father->nodes[i].arity == 0)

+ 4 - 7
src/core/workers.c

@@ -96,7 +96,6 @@ int _starpu_is_initialized(void)
 static uint32_t _starpu_worker_exists_and_can_execute(struct starpu_task *task,
 						      enum starpu_worker_archtype arch)
 {
-	int i;
 	_starpu_codelet_check_deprecated_fields(task->cl);
 
         /* make sure there is a worker on the machine able to execute the
@@ -109,7 +108,7 @@ static uint32_t _starpu_worker_exists_and_can_execute(struct starpu_task *task,
 	workers->init_iterator(workers, &it);
 	while(workers->has_next(workers, &it))
 	{
-		i = workers->get_next(workers, &it);
+		int i = workers->get_next(workers, &it);
 		if (starpu_worker_get_type(i) != arch)
 			continue;
 
@@ -1931,19 +1930,17 @@ int starpu_worker_get_nids_by_type(enum starpu_worker_archtype type, int *worker
 int starpu_worker_get_nids_ctx_free_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize)
 {
 	unsigned nworkers = starpu_worker_get_count();
-
 	int cnt = 0;
+	unsigned id;
 
-	unsigned id, worker;
-	unsigned found = 0;
 	for (id = 0; id < nworkers; id++)
 	{
-		found = 0;
 		if (starpu_worker_get_type(id) == type)
 		{
 			/* Perhaps the array is too small ? */
 			if (cnt >= maxsize)
 				return cnt;
+			unsigned found = 0;
 			int s;
 			for(s = 1; s < STARPU_NMAX_SCHED_CTXS; s++)
 			{
@@ -1955,7 +1952,7 @@ int starpu_worker_get_nids_ctx_free_by_type(enum starpu_worker_archtype type, in
 					workers->init_iterator(workers, &it);
 					while(workers->has_next(workers, &it))
 					{
-						worker = workers->get_next(workers, &it);
+						unsigned worker = workers->get_next(workers, &it);
 						if(worker == id)
 						{
 							found = 1;

+ 4 - 4
src/datawizard/datastats.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2013, 2016  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2015  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2015, 2016  CNRS
  *
  * 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
@@ -67,7 +67,7 @@ void _starpu_display_msi_stats(void)
 	{
 		if (hit_cnt[node]+miss_cnt[node])
 		{
-			fprintf(stderr, "memory node %d\n", node);
+			fprintf(stderr, "memory node %u\n", node);
 			fprintf(stderr, "\thit : %u (%2.2f %%)\n", hit_cnt[node], (100.0f*hit_cnt[node])/(hit_cnt[node]+miss_cnt[node]));
 			fprintf(stderr, "\tmiss : %u (%2.2f %%)\n", miss_cnt[node], (100.0f*miss_cnt[node])/(hit_cnt[node]+miss_cnt[node]));
 		}
@@ -103,13 +103,13 @@ void _starpu_display_alloc_cache_stats(void)
 	{
 		if (alloc_cnt[node])
 		{
-			fprintf(stderr, "memory node %d\n", node);
+			fprintf(stderr, "memory node %u\n", node);
 			fprintf(stderr, "\ttotal alloc : %u\n", alloc_cnt[node]);
 			fprintf(stderr, "\tcached alloc: %u (%2.2f %%)\n",
 				alloc_cache_hit_cnt[node], (100.0f*alloc_cache_hit_cnt[node])/(alloc_cnt[node]));
 		}
 		else
-			fprintf(stderr, "No allocation on node %d\n", node);
+			fprintf(stderr, "No allocation on node %u\n", node);
 	}
 	fprintf(stderr, "#---------------------\n");
 }

+ 1 - 1
src/datawizard/memstats.c

@@ -64,7 +64,7 @@ void _starpu_memory_display_handle_stats(starpu_data_handle_t handle)
 		if (handle->memory_stats->direct_access[node]+handle->memory_stats->loaded_shared[node]
 		    +handle->memory_stats->invalidated[node]+handle->memory_stats->loaded_owner[node])
 		{
-			fprintf(stderr, "Node #%d\n", node);
+			fprintf(stderr, "Node #%u\n", node);
 			fprintf(stderr, "\tDirect access : %d\n", handle->memory_stats->direct_access[node]);
 			/* XXX Not Working yet. */
 			if (handle->memory_stats->shared_to_owner[node])

+ 6 - 6
src/debug/traces/anim.c

@@ -118,7 +118,7 @@ static void fxt_component_print(FILE *file, struct starpu_fxt_options *options,
 	for (i = 0, n = 0; i < comp->nchildren; i++)
 		if (comp->children[i]->parent == comp)
 			n++;
-	fprintf(file, "\t\t\t%*s<table><tr><td class='box' colspan=%d><center>%s\n", 2*depth, "", n, comp->name);
+	fprintf(file, "\t\t\t%*s<table><tr><td class='box' colspan=%u><center>%s\n", 2*depth, "", n, comp->name);
 
 	if (!strcmp(comp->name,"prio") || !strcmp(comp->name,"fifo") || !strcmp(comp->name,"heft") || !strcmp(comp->name,"work_stealing"))
 	{
@@ -132,7 +132,7 @@ static void fxt_component_print(FILE *file, struct starpu_fxt_options *options,
 		if (ntasks)
 		{
 			if (ntasks > N)
-				fprintf(file, "\t\t\t%*s<table><tr><td class='%s'>%d</td></tr></table>\n", 2*depth, "",
+				fprintf(file, "\t\t\t%*s<table><tr><td class='%s'>%u</td></tr></table>\n", 2*depth, "",
 					from == comp
 						? (comp->npriotasks >= N ? "last_task_full_prio" : "last_task_full")
 						: (comp->npriotasks >= N ? "task_prio" : "task"),
@@ -157,7 +157,7 @@ static void fxt_component_print(FILE *file, struct starpu_fxt_options *options,
 					? "last_task_empty"
 					: (comp->npriotasks ? "task_prio" : "task"));
 		else
-			fprintf(file, "\t\t\t%*s<table><tr><td class='%s'>%d</td></tr></table>\n", 2*depth, "",
+			fprintf(file, "\t\t\t%*s<table><tr><td class='%s'>%u</td></tr></table>\n", 2*depth, "",
 				from == comp
 					? (comp->npriotasks ? "last_task_full_prio" : "last_task_full")
 					: (comp->npriotasks ? "task_prio" : "task"), comp->ntasks + comp->npriotasks);
@@ -346,9 +346,9 @@ void _starpu_fxt_component_print_header(FILE *file)
 
 static void fxt_component_print_step(FILE *file, struct starpu_fxt_options *options, double timestamp, int workerid, unsigned push, struct component *from, struct component *to)
 {
-	fprintf(file, "\t\t<div id='et%d' style='display:%s;'><center><!-- Étape %d -->\n",
+	fprintf(file, "\t\t<div id='et%u' style='display:%s;'><center><!-- Étape %u -->\n",
 			global_state, global_state > 1 ? "none":"block", global_state);
-	fprintf(file, "\t\t<p>Time %f, %d submitted %d ready, %s</p>\n", timestamp, nsubmitted, curq_size-nflowing, push?"push":"pull");
+	fprintf(file, "\t\t<p>Time %f, %u submitted %u ready, %s</p>\n", timestamp, nsubmitted, curq_size-nflowing, push?"push":"pull");
 	//fprintf(file, "\t\t\t<tt><pre>\n");
 	//_starpu_fxt_component_dump(file);
 	//fprintf(file, "\t\t\t</pre></tt>\n");
@@ -460,7 +460,7 @@ void _starpu_fxt_component_finish(FILE *file)
 	fprintf(file, "\t\t\t\tsliderDiv.slider({\n");
 	fprintf(file, "\t\t\t\t\tvalue: 1,\n");
 	fprintf(file, "\t\t\t\t\tmin: 1,\n");
-	fprintf(file, "\t\t\t\t\tmax: %d,\n", global_state-1);
+	fprintf(file, "\t\t\t\t\tmax: %u,\n", global_state-1);
 	fprintf(file, "\t\t\t\t\tstep: 1,\n");
 	fprintf(file, "\t\t\t\t\tanimate: 'fast',\n");
 	fprintf(file, "\t\t\t\t\tslide: function(event, ui){\n");

+ 7 - 7
src/debug/traces/starpu_fxt.c

@@ -720,7 +720,7 @@ static void recfmt_dump_state(double time, const char *event, int workerid, long
 	if (threadid == -1)
 		fprintf(trace_file, "T: -1\n");
 	else
-		fprintf(trace_file, "T: %lu\n", threadid);
+		fprintf(trace_file, "T: %ld\n", threadid);
 	fprintf(trace_file, "S: %f\n", time);
 	fprintf(trace_file, "\n");
 }
@@ -1184,7 +1184,7 @@ static void handle_start_codelet_body(struct fxt_ev_64 *ev, struct starpu_fxt_op
 #ifdef STARPU_HAVE_POTI
 			char container[STARPU_POTI_STR_LEN];
 			char ctx[6];
-			snprintf(ctx, sizeof(ctx), "Ctx%d", sched_ctx);
+			snprintf(ctx, sizeof(ctx), "Ctx%u", sched_ctx);
 			worker_container_alias(container, STARPU_POTI_STR_LEN, prefix, ev->param[2]);
 			poti_SetState(start_codelet_time, container, ctx, name);
 #else
@@ -1281,11 +1281,11 @@ static void handle_codelet_details(struct fxt_ev_64 *ev, struct starpu_fxt_optio
 #ifdef STARPU_HAVE_POTI
 			char container[STARPU_POTI_STR_LEN];
 			char ctx[6];
-			snprintf(ctx, sizeof(ctx), "Ctx%d", sched_ctx);
+			snprintf(ctx, sizeof(ctx), "Ctx%u", sched_ctx);
 			worker_container_alias(container, STARPU_POTI_STR_LEN, prefix, worker);
 			poti_SetState(last_codelet_start[worker], container, ctx, _starpu_last_codelet_symbol[worker]);
 #else
-			fprintf(out_paje_file, "20	%.9f	%sw%d	Ctx%u	%s	%ld	%s	%08lx	%016lx	%ld\n", last_codelet_start[worker], prefix, worker, sched_ctx, _starpu_last_codelet_symbol[worker], ev->param[2], parameters,  ev->param[3], ev->param[4], job_id);
+			fprintf(out_paje_file, "20	%.9f	%sw%d	Ctx%u	%s	%ld	%s	%08lx	%016lx	%lu\n", last_codelet_start[worker], prefix, worker, sched_ctx, _starpu_last_codelet_symbol[worker], ev->param[2], parameters,  ev->param[3], ev->param[4], job_id);
 #endif
 		}
 #endif /* STARPU_ENABLE_PAJE_CODELET_DETAILS */
@@ -1711,8 +1711,8 @@ static void handle_work_stealing(struct fxt_ev_64 *ev, struct starpu_fxt_options
 		poti_EndLink(time+0.000000001, program_container, "WSL", dst_worker_container, paje_value, paje_key);
 #else
 
-		fprintf(out_paje_file, "18	%.9f	WSL	%sp	%u	%sw%d	steal_%u\n", time, prefix, size, prefix, src, steal_number);
-		fprintf(out_paje_file, "19	%.9f	WSL	%sp	%u	%sw%d	steal_%u\n", time+0.000000001, prefix, size, prefix, dst, steal_number);
+		fprintf(out_paje_file, "18	%.9f	WSL	%sp	%u	%sw%u	steal_%u\n", time, prefix, size, prefix, src, steal_number);
+		fprintf(out_paje_file, "19	%.9f	WSL	%sp	%u	%sw%u	steal_%u\n", time+0.000000001, prefix, size, prefix, dst, steal_number);
 #endif
 	}
 
@@ -3408,7 +3408,7 @@ static void write_task(struct parse_task pt)
 		fprintf(codelet_list, "%s\n", codelet_name);
 	}
 	double time = pt.exec_time * NANO_SEC_TO_MILI_SEC;
-	fprintf(kernel->file, "%lf %d\n", time, pt.data_total);
+	fprintf(kernel->file, "%lf %u\n", time, pt.data_total);
 }
 
 void starpu_fxt_write_data_trace(char *filename_in)

+ 2 - 2
src/debug/traces/starpu_fxt_mpi.c

@@ -235,8 +235,8 @@ static void display_all_transfers_from_trace(FILE *out_paje_file, int src)
 				snprintf(mpi_container, sizeof(mpi_container), "%d_mpict", /* XXX */dst);
 				poti_EndLink(end_date, "MPICt", "MPIL", mpi_container, paje_value, paje_key);
 #else
-				fprintf(out_paje_file, "18	%.9f	MPIL	MPIroot	%ld	%d_mpict	mpicom_%lu\n", start_date, size, /* XXX */src, id);
-				fprintf(out_paje_file, "19	%.9f	MPIL	MPIroot	%ld	%d_mpict	mpicom_%lu\n", end_date, size, /* XXX */dst, id);
+				fprintf(out_paje_file, "18	%.9f	MPIL	MPIroot	%lu	%d_mpict	mpicom_%lu\n", start_date, (unsigned long)size, /* XXX */src, id);
+				fprintf(out_paje_file, "19	%.9f	MPIL	MPIroot	%lu	%d_mpict	mpicom_%lu\n", end_date, (unsigned long)size, /* XXX */dst, id);
 #endif
 			}
 		}

+ 2 - 2
src/drivers/mic/driver_mic_common.c

@@ -23,7 +23,7 @@
 void _starpu_mic_common_report_scif_error(const char *func, const char *file, const int line, const int status)
 {
 	const char *errormsg = strerror(status);
-	printf("Common: oops in %s (%s:%u)... %d: %s \n", func, file, line, status, errormsg);
+	printf("Common: oops in %s (%s:%d)... %d: %s \n", func, file, line, status, errormsg);
 	STARPU_ASSERT(0);
 }
 
@@ -48,7 +48,7 @@ int _starpu_mic_common_recv_is_ready(const struct _starpu_mp_node *mp_node)
   pollepd.events = SCIF_POLLIN;
   pollepd.revents = 0;
   return  scif_poll(&pollepd,1,0);
-	
+
 }
 
 

+ 1 - 1
src/drivers/mic/driver_mic_sink.c

@@ -153,7 +153,7 @@ void _starpu_mic_sink_deinit(struct _starpu_mp_node *node)
 void _starpu_mic_sink_report_error(const char *func, const char *file, const int line, const int status)
 {
 	const char *errormsg = strerror(status);
-	printf("SINK: oops in %s (%s:%u)... %d: %s \n", func, file, line, status, errormsg);
+	printf("SINK: oops in %s (%s:%d)... %d: %s \n", func, file, line, status, errormsg);
 	STARPU_ASSERT(0);
 }
 

+ 7 - 7
src/drivers/mic/driver_mic_source.c

@@ -117,7 +117,7 @@ int _starpu_mic_src_register_kernel(starpu_mic_func_symbol_t *symbol, const char
 
 	STARPU_PTHREAD_MUTEX_LOCK(&htbl_mutex);
 	struct _starpu_mic_kernel *kernel;
-	
+
 	HASH_FIND_STR(kernels, func_name, kernel);
 
 	if (kernel != NULL)
@@ -163,7 +163,7 @@ int _starpu_mic_src_register_kernel(starpu_mic_func_symbol_t *symbol, const char
 starpu_mic_kernel_t _starpu_mic_src_get_kernel(starpu_mic_func_symbol_t symbol)
 {
 	int workerid = starpu_worker_get_id();
-	
+
 	/* This function has to be called in the codelet only, by the thread
 	 * which will handle the task */
 	if (workerid < 0)
@@ -193,7 +193,7 @@ void _starpu_mic_src_report_coi_error(const char *func, const char *file,
 				      const int line, const COIRESULT status)
 {
 	const char *errormsg = COIResultGetName(status);
-	printf("SRC: oops in %s (%s:%u)... %d: %s \n", func, file, line, status, errormsg);
+	printf("SRC: oops in %s (%s:%d)... %d: %s \n", func, file, line, status, errormsg);
 	STARPU_ASSERT(0);
 }
 
@@ -205,7 +205,7 @@ void _starpu_mic_src_report_coi_error(const char *func, const char *file,
 void _starpu_mic_src_report_scif_error(const char *func, const char *file, const int line, const int status)
 {
 	const char *errormsg = strerror(status);
-	printf("SRC: oops in %s (%s:%u)... %d: %s \n", func, file, line, status, errormsg);
+	printf("SRC: oops in %s (%s:%d)... %d: %s \n", func, file, line, status, errormsg);
 	STARPU_ASSERT(0);
 }
 
@@ -534,12 +534,12 @@ void *_starpu_mic_src_worker(void *arg)
 	for (i = 0; i < config->topology.nmiccores[devid]; i++)
 	{
 		struct _starpu_worker *worker = &config->workers[baseworkerid+i];
-		snprintf(worker->name, sizeof(worker->name), "MIC %d core %u", devid, i);
-		snprintf(worker->short_name, sizeof(worker->short_name), "MIC %d.%u", devid, i);
+		snprintf(worker->name, sizeof(worker->name), "MIC %u core %u", devid, i);
+		snprintf(worker->short_name, sizeof(worker->short_name), "MIC %u.%u", devid, i);
 	}
 	{
 		char thread_name[16];
-		snprintf(thread_name, sizeof(thread_name), "MIC %d", devid);
+		snprintf(thread_name, sizeof(thread_name), "MIC %u", devid);
 		starpu_pthread_setname(thread_name);
 	}
 

+ 2 - 2
src/drivers/opencl/driver_opencl.c

@@ -639,8 +639,8 @@ int _starpu_opencl_driver_init(struct _starpu_worker *worker)
 	char devname[128];
 	_starpu_opencl_get_device_name(devid, devname, 128);
 #endif
-	snprintf(worker->name, sizeof(worker->name), "OpenCL %u (%s %.1f GiB)", devid, devname, size);
-	snprintf(worker->short_name, sizeof(worker->short_name), "OpenCL %u", devid);
+	snprintf(worker->name, sizeof(worker->name), "OpenCL %d (%s %.1f GiB)", devid, devname, size);
+	snprintf(worker->short_name, sizeof(worker->short_name), "OpenCL %d", devid);
 	starpu_pthread_setname(worker->short_name);
 
 	worker->pipeline_length = starpu_get_env_number_default("STARPU_OPENCL_PIPELINE", 2);

+ 3 - 3
src/profiling/bound.c

@@ -607,7 +607,7 @@ void starpu_bound_print_lp(FILE *output)
 							/* If predecessor is on worker w and successor
 							 * on worker w2 on different nodes, we need to
 							 * transfer the data. */
-							fprintf(output, " + d_t%luw%ut%luw%u", t1->deps[i].dep->id, w, t1->id, w2);
+							fprintf(output, " + d_t%luw%dt%luw%d", t1->deps[i].dep->id, w, t1->id, w2);
 
 						}
 					}
@@ -626,9 +626,9 @@ void starpu_bound_print_lp(FILE *output)
 						if (starpu_worker_get_memory_node(w2) == n2)
 						{
 							/* The data transfer is at least 0ms */
-							fprintf(output, "d_t%luw%ut%luw%u >= 0;\n", t1->deps[i].dep->id, w, t1->id, w2);
+							fprintf(output, "d_t%luw%dt%luw%d >= 0;\n", t1->deps[i].dep->id, w, t1->id, w2);
 							/* The data transfer from w to w2 only happens if tasks run there */
-							fprintf(output, "d_t%luw%ut%luw%u >= %f - 2e5 + 1e5 t%luw%u + 1e5 t%luw%u;\n",
+							fprintf(output, "d_t%luw%dt%luw%d >= %f - 2e5 + 1e5 t%luw%d + 1e5 t%luw%d;\n",
 									t1->deps[i].dep->id, w, t1->id, w2,
 									starpu_transfer_predict(n, n2, t1->deps[i].size)/1000.,
 									t1->deps[i].dep->id, w, t1->id, w2);

+ 1 - 1
src/sched_policies/component_worker.c

@@ -589,7 +589,7 @@ static struct starpu_sched_component * starpu_sched_component_worker_create(stru
 	if(worker == NULL)
 		return NULL;
 	char name[32];
-	snprintf(name, sizeof(name), "worker %u", workerid);
+	snprintf(name, sizeof(name), "worker %d", workerid);
 	struct starpu_sched_component * component = starpu_sched_component_create(tree, name);
 	struct _starpu_worker_component_data *data;
 	_STARPU_MALLOC(data, sizeof(*data));

+ 3 - 4
src/util/starpu_clusters_create.c

@@ -223,7 +223,7 @@ int starpu_uncluster_machine(struct starpu_cluster_machine *machine)
 {
 	if (machine == NULL)
 		return -1;
-	struct _starpu_cluster_group *g, *tmp;
+	struct _starpu_cluster_group *g;
 	struct _starpu_cluster_group_list *group_list = machine->groups;
 
 	if (machine->id != STARPU_NMAX_SCHED_CTXS)
@@ -231,7 +231,7 @@ int starpu_uncluster_machine(struct starpu_cluster_machine *machine)
 	g = _starpu_cluster_group_list_begin(group_list);
 	while (g != _starpu_cluster_group_list_end(group_list))
 	{
-		tmp = g;
+		struct _starpu_cluster_group *tmp = g;
 		g = _starpu_cluster_group_list_next(g);
 		_starpu_cluster_group_remove(group_list, tmp);
 	}
@@ -383,12 +383,11 @@ int _starpu_cluster_remove(struct _starpu_cluster_list *cluster_list,
 int _starpu_cluster_group_remove(struct _starpu_cluster_group_list *group_list,
 				 struct _starpu_cluster_group *group)
 {
-	struct _starpu_cluster *tmp;
 	struct _starpu_cluster_list *cluster_list = group->clusters;
 	struct _starpu_cluster *c = _starpu_cluster_list_begin(cluster_list);
 	while (c != _starpu_cluster_list_end(cluster_list))
 	{
-		tmp = c;
+		struct _starpu_cluster *tmp = c;
 		c = _starpu_cluster_list_next(c);
 		_starpu_cluster_remove(cluster_list, tmp);
 	}