Browse Source

minor fixes spotted by sonarqube

Nathalie Furmento 4 years ago
parent
commit
fc36dc4047

+ 1 - 1
mpi/examples/filters/filter.c

@@ -59,7 +59,7 @@ void vector_filter(void *father_interface, void *child_interface, struct starpu_
 
 	STARPU_ASSERT_MSG(nchunks <= nx, "%u parts for %u elements", nchunks, nx);
 	STARPU_ASSERT(nchunks == 2);
-	STARPU_ASSERT_MSG((nx % nchunks) == 0, "nx=%d is not a multiple of nchunks %d\n", nx, nchunks);
+	STARPU_ASSERT_MSG((nx % nchunks) == 0, "nx=%u is not a multiple of nchunks %u\n", nx, nchunks);
 
 	vector_child->id = vector_father->id;
 	vector_child->nx = nx/2;

+ 1 - 1
mpi/tests/broadcast.c

@@ -40,7 +40,7 @@ int main(int argc, char **argv)
 {
 	int ret, rank, size;
 	starpu_data_handle_t handle;
-	int var;
+	int var=-1;
 	int mpi_init;
 	MPI_Status status;
 

+ 1 - 1
mpi/tests/insert_task_compute.c

@@ -47,7 +47,7 @@ int test(int rank, int node, int *before, int *after, int task_insert, int data_
 	ret = starpu_mpi_init_conf(NULL, NULL, 0, MPI_COMM_WORLD, NULL);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_init_conf");
 
-	if (starpu_cpu_worker_get_count() <= 0)
+	if (starpu_cpu_worker_get_count() == 0)
 	{
 		// If there is no cpu to execute the codelet, mpi will block trying to do the post-execution communication
 		ret = -ENODEV;

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

@@ -2652,9 +2652,9 @@ static void handle_job_push(struct fxt_ev_64 *ev, struct starpu_fxt_options *opt
 		fprintf(sched_tasks_file, "Time: %.9f\n", current_timestamp);
 		fprintf(sched_tasks_file, "Priority: %d\n", priority);
 		if (options->file_rank < 0)
-			fprintf(sched_tasks_file, "JobId: %d\n", task);
+			fprintf(sched_tasks_file, "JobId: %u\n", task);
 		else
-			fprintf(sched_tasks_file, "JobId: %d_%d\n", options->file_rank, task);
+			fprintf(sched_tasks_file, "JobId: %d_%u\n", options->file_rank, task);
 		fprintf(sched_tasks_file, "\n");
 	}
 }
@@ -2701,9 +2701,9 @@ static void handle_job_pop(struct fxt_ev_64 *ev, struct starpu_fxt_options *opti
 		fprintf(sched_tasks_file, "Time: %.9f\n", current_timestamp);
 		fprintf(sched_tasks_file, "Priority: %d\n", priority);
 		if (options->file_rank < 0)
-			fprintf(sched_tasks_file, "JobId: %d\n", task);
+			fprintf(sched_tasks_file, "JobId: %u\n", task);
 		else
-			fprintf(sched_tasks_file, "JobId: %d_%d\n", options->file_rank, task);
+			fprintf(sched_tasks_file, "JobId: %d_%u\n", options->file_rank, task);
 		fprintf(sched_tasks_file, "\n");
 	}
 }

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

@@ -357,7 +357,7 @@ static void display_all_transfers_from_trace(FILE *out_paje_file, FILE *out_comm
 					fprintf(out_comms_file, "SendJobId: %d_%lu\n", src, cur->jobid);
 				if (match->jobid != -1)
 					fprintf(out_comms_file, "RecvJobId: %d_%lu\n", dst, match->jobid);
-				fprintf(out_comms_file, "Size: %ld\n", size);
+				fprintf(out_comms_file, "Size: %lu\n", size);
 				fprintf(out_comms_file, "\n");
 			}
 		}
@@ -372,7 +372,7 @@ static void display_all_transfers_from_trace(FILE *out_paje_file, FILE *out_comm
 	if (nb_wrong_comm_timing == 1)
 		_STARPU_MSG("Warning: a communication finished before it started !\n");
 	else if (nb_wrong_comm_timing > 1)
-		_STARPU_MSG("Warning: %d communications finished before they started !\n", nb_wrong_comm_timing);
+		_STARPU_MSG("Warning: %u communications finished before they started !\n", nb_wrong_comm_timing);
 }
 
 void _starpu_fxt_display_mpi_transfers(struct starpu_fxt_options *options, int *ranks STARPU_ATTRIBUTE_UNUSED, FILE *out_paje_file, FILE* out_comms_file)

+ 3 - 3
tests/datawizard/bcsr.c

@@ -39,20 +39,20 @@ void cpu_show_bcsr(void *descr[], void *arg)
 
 	STARPU_PTHREAD_MUTEX_LOCK(&mutex);
 
-	printf("\nnnz %d elemsize %d\n", nnz, elemsize);
+	printf("\nnnz %u elemsize %u\n", nnz, elemsize);
 
 	for (i = 0; i < nrow; i++)
 	{
 		uint32_t row_start = rowptr[i] - firstentry;
 		uint32_t row_end = rowptr[i+1] - firstentry;
 
-		printf("row %d\n", i);
+		printf("row %u\n", i);
 
 		for (j = row_start; j < row_end; j++)
 		{
 			int *block = nzval + j * r*c;
 
-			printf( " column %d\n", colind[j]);
+			printf( " column %u\n", colind[j]);
 
 			for (y = 0; y < r; y++)
 			{

+ 4 - 4
tests/helper/starpu_data_dup_ro.c

@@ -84,7 +84,7 @@ int main(int argc, char **argv)
 	ret = EXIT_SUCCESS;
 	if (*var != 42)
 	{
-	     FPRINTF(stderr, "var2 is %d but it should be %d\n", *var, 42);
+	     FPRINTF(stderr, "var2 is %u but it should be %d\n", *var, 42);
 	     ret = EXIT_FAILURE;
 	}
 	starpu_data_release(var2_handle);
@@ -93,7 +93,7 @@ int main(int argc, char **argv)
 	var = starpu_data_get_local_ptr(var3_handle);
 	if (*var != 42)
 	{
-	     FPRINTF(stderr, "var3 is %d but it should be %d\n", *var, 42);
+	     FPRINTF(stderr, "var3 is %u but it should be %d\n", *var, 42);
 	     ret = EXIT_FAILURE;
 	}
 	starpu_data_release(var3_handle);
@@ -102,7 +102,7 @@ int main(int argc, char **argv)
 	var = starpu_data_get_local_ptr(var4_handle);
 	if (*var != 42)
 	{
-	     FPRINTF(stderr, "var4 is %d but it should be %d\n", *var, 42);
+	     FPRINTF(stderr, "var4 is %u but it should be %d\n", *var, 42);
 	     ret = EXIT_FAILURE;
 	}
 	starpu_data_release(var4_handle);
@@ -111,7 +111,7 @@ int main(int argc, char **argv)
 	var = starpu_data_get_local_ptr(var5_handle);
 	if (*var != 43)
 	{
-	     FPRINTF(stderr, "var5 is %d but it should be %d\n", *var, 43);
+	     FPRINTF(stderr, "var5 is %u but it should be %d\n", *var, 43);
 	     ret = EXIT_FAILURE;
 	}
 	starpu_data_release(var5_handle);

+ 1 - 1
tests/parallel_tasks/explicit_combined_worker.c

@@ -114,7 +114,7 @@ int main(void)
 enodev:
 	starpu_data_unregister(v_handle);
 	starpu_free(v);
-	fprintf(stderr, "WARNING: No one can execute the task on workerid %d\n", worker);
+	fprintf(stderr, "WARNING: No one can execute the task on workerid %u\n", worker);
 	/* yes, we do not perform the computation but we did detect that no one
  	 * could perform the kernel, so this is not an error from StarPU */
 	starpu_shutdown();

+ 2 - 2
tools/starpu_fxt_tool.c

@@ -81,7 +81,7 @@ static int parse_args(int argc, char **argv)
 		{
 			if (options.ninputfiles >= STARPU_FXT_MAX_FILES)
 			{
-				fprintf(stderr, "Error: The number of trace files is superior to STARPU_FXT_MAX_FILES (%u)\nPlease recompile StarPU with a bigger --enable-fxt-max-files\n", STARPU_FXT_MAX_FILES);
+				fprintf(stderr, "Error: The number of trace files is superior to STARPU_FXT_MAX_FILES (%d)\nPlease recompile StarPU with a bigger --enable-fxt-max-files\n", STARPU_FXT_MAX_FILES);
 				return 7;
 			}
 			options.filenames[options.ninputfiles++] = argv[++i];
@@ -179,7 +179,7 @@ static int parse_args(int argc, char **argv)
 		{
 			if (options.ninputfiles >= STARPU_FXT_MAX_FILES)
 			{
-				fprintf(stderr, "Error: The number of trace files is superior to STARPU_FXT_MAX_FILES (%u)\nPlease recompile StarPU with a bigger --enable-fxt-max-files\n", STARPU_FXT_MAX_FILES);
+				fprintf(stderr, "Error: The number of trace files is superior to STARPU_FXT_MAX_FILES (%d)\nPlease recompile StarPU with a bigger --enable-fxt-max-files\n", STARPU_FXT_MAX_FILES);
 				return 7;
 			}
 			options.filenames[options.ninputfiles++] = argv[i];

+ 4 - 4
tools/starpu_perfmodel_recdump.c

@@ -122,7 +122,7 @@ void print_archs(FILE* output)
 	{
 		unsigned printed = 0;
 		char name[32];
-		fprintf(output, "MemoryNode: %d\n", node);
+		fprintf(output, "MemoryNode: %u\n", node);
 		starpu_memory_node_get_name(node, name, sizeof(name));
 		fprintf(output, "Name: %s\n", name);
 		fprintf(output, "Size: %ld\n", (long) starpu_memory_get_total(node));
@@ -135,7 +135,7 @@ void print_archs(FILE* output)
 					fprintf(output, "Workers:");
 					printed = 1;
 				}
-				fprintf(output, " %d", workerid);
+				fprintf(output, " %u", workerid);
 			}
 		}
 		if (printed)
@@ -149,8 +149,8 @@ void print_archs(FILE* output)
 		{
 			if (src != dst)
 			{
-				fprintf(output, "MemoryNodeSrc: %d\n", src);
-				fprintf(output, "MemoryNodeDst: %d\n", dst);
+				fprintf(output, "MemoryNodeSrc: %u\n", src);
+				fprintf(output, "MemoryNodeDst: %u\n", dst);
 				fprintf(output, "Bandwidth: %f\n", starpu_transfer_bandwidth(src, dst));
 				fprintf(output, "Latency: %f\n", starpu_transfer_latency(src, dst));
 				fprintf(output, "\n");