Pārlūkot izejas kodu

src: remove useless parenthesis

Nathalie Furmento 7 gadi atpakaļ
vecāks
revīzija
76703c1031

+ 3 - 3
src/core/dependencies/data_arbiter_concurrency.c

@@ -302,7 +302,7 @@ unsigned _starpu_attempt_to_submit_arbitered_data_request(unsigned request_from_
 	 * current one, we can proceed. */
 	unsigned put_in_list = 1;
 
-	if (((handle->refcnt == 0) || (!(mode == STARPU_W) && (handle->current_mode == mode))))
+	if ((handle->refcnt == 0) || (!(mode == STARPU_W) && (handle->current_mode == mode)))
 	{
 		/* TODO: Detect whether this is the end of a reduction phase etc. like in data_concurrency.c */
 		if (0)
@@ -442,7 +442,7 @@ void _starpu_submit_job_enforce_arbitered_deps(struct _starpu_job *j, unsigned b
 
 		/* Try to take handle */
 		_starpu_spin_lock(&handle->header_lock);
-		if (((handle->refcnt == 0) || (!(mode == STARPU_W) && (handle->current_mode == mode))))
+		if ((handle->refcnt == 0) || (!(mode == STARPU_W) && (handle->current_mode == mode)))
 		{
 			/* Got it */
 			handle->refcnt++;
@@ -588,7 +588,7 @@ void _starpu_notify_arbitered_dependencies(starpu_data_handle_t handle)
 
 			_starpu_spin_lock(&handle->header_lock);
 			handle->busy_count++;
-			if (((handle->refcnt == 0) || (!(r_mode == STARPU_W) && (handle->current_mode == r_mode))))
+			if ((handle->refcnt == 0) || (!(r_mode == STARPU_W) && (handle->current_mode == r_mode)))
 			{
 				handle->refcnt++;
 				handle->current_mode = r_mode;

+ 2 - 2
src/core/dependencies/data_concurrency.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2015, 2017  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2017  CNRS
  * Copyright (C) 2015  Inria
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -409,7 +409,7 @@ int _starpu_notify_data_dependencies(starpu_data_handle_t handle)
 
 	handle->unlocking_reqs = 1;
 	struct _starpu_data_requester *r;
-	while ((r = may_unlock_data_req_list_head(handle)))
+	while (r = may_unlock_data_req_list_head(handle))
 	{
 		/* STARPU_RW accesses are treated as STARPU_W */
 		enum starpu_data_access_mode r_mode = r->mode;

+ 1 - 1
src/core/jobs.c

@@ -213,7 +213,7 @@ int _starpu_test_job_termination(struct _starpu_job *j)
 	else
 	{
 		STARPU_SYNCHRONIZE();
-		return (j->terminated == 2);
+		return j->terminated == 2;
 	}
 }
 void _starpu_job_prepare_for_continuation_ext(struct _starpu_job *j, unsigned continuation_resubmit,

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

@@ -144,7 +144,7 @@ static double common_task_expected_perf(struct starpu_perfmodel *model, struct s
 
 	STARPU_ASSERT(!_STARPU_IS_ZERO(alpha));
 
-	return (exp/alpha);
+	return exp/alpha;
 }
 
 void _starpu_init_and_load_perfmodel(struct starpu_perfmodel *model)

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

@@ -1266,7 +1266,7 @@ int starpu_perfmodel_list(FILE *output)
         if (dp != NULL)
 	{
 		struct dirent *ep;
-                while ((ep = readdir(dp)))
+                while (ep = readdir(dp))
 		{
                         if (strcmp(ep->d_name, ".") && strcmp(ep->d_name, ".."))
                                 fprintf(output, "file: <%s>\n", ep->d_name);

+ 1 - 1
src/core/sched_ctx.c

@@ -2413,7 +2413,7 @@ static void _starpu_sched_ctx_unblock_workers_in_parallel(unsigned sched_ctx_id,
 		if(starpu_worker_get_type(workerid) == STARPU_CPU_WORKER
 			 && (workerid != master || all))
 		{
-			if((current_worker_id == -1 || workerid != current_worker_id))
+			if (current_worker_id == -1 || workerid != current_worker_id)
 			{
 				struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
 				STARPU_PTHREAD_MUTEX_LOCK(&worker->sched_mutex);

+ 3 - 3
src/core/topology.c

@@ -755,7 +755,7 @@ _starpu_initialize_workers_bindid (struct _starpu_machine_config *config)
 	 * cores. */
 
 	/* what do we use, explicit value, env. variable, or round-robin ? */
-	if ((strval = starpu_getenv("STARPU_WORKERS_CPUID")))
+	if (strval = starpu_getenv("STARPU_WORKERS_CPUID"))
 	{
 		/* STARPU_WORKERS_CPUID certainly contains less entries than
 		 * STARPU_NMAXWORKERS, so we reuse its entries in a round
@@ -1967,9 +1967,9 @@ static void _starpu_init_numa_node(struct _starpu_machine_config *config)
 	msg_host_t host;
 #endif
 
-	int numa_enabled;
+	int numa_enabled = starpu_get_env_number_default("STARPU_USE_NUMA", 0);
 	/* NUMA mode activated */
-	if ((numa_enabled = starpu_get_env_number_default("STARPU_USE_NUMA", 0)))
+	if (numa_enabled)
 	{
 		/* Take all NUMA nodes used by CPU workers */
 		unsigned worker;

+ 5 - 5
src/core/workers.c

@@ -227,22 +227,22 @@ uint32_t _starpu_worker_exists(struct starpu_task *task)
 
 uint32_t _starpu_can_submit_cuda_task(void)
 {
-	return (STARPU_CUDA & _starpu_config.worker_mask);
+	return STARPU_CUDA & _starpu_config.worker_mask;
 }
 
 uint32_t _starpu_can_submit_cpu_task(void)
 {
-	return (STARPU_CPU & _starpu_config.worker_mask);
+	return STARPU_CPU & _starpu_config.worker_mask;
 }
 
 uint32_t _starpu_can_submit_opencl_task(void)
 {
-	return (STARPU_OPENCL & _starpu_config.worker_mask);
+	return STARPU_OPENCL & _starpu_config.worker_mask;
 }
 
 uint32_t _starpu_can_submit_scc_task(void)
 {
-	return (STARPU_SCC & _starpu_config.worker_mask);
+	return STARPU_SCC & _starpu_config.worker_mask;
 }
 
 static inline int _starpu_can_use_nth_implementation(enum starpu_worker_archtype arch, struct starpu_codelet *cl, unsigned nimpl)
@@ -267,7 +267,7 @@ static inline int _starpu_can_use_nth_implementation(enum starpu_worker_archtype
 		opencl_func_enabled = opencl_func != NULL && starpu_opencl_worker_get_count();
 #endif
 
-		return (cpu_func_enabled && cuda_func_enabled && opencl_func_enabled);
+		return cpu_func_enabled && cuda_func_enabled && opencl_func_enabled;
 	}
 	case STARPU_CPU_WORKER:
 	{

+ 1 - 1
src/datawizard/coherency.c

@@ -834,7 +834,7 @@ void _starpu_release_data_on_node(starpu_data_handle_t handle, uint32_t default_
 	unsigned memory_node = replicate->memory_node;
 
 	if (replicate->state != STARPU_INVALID && handle->current_mode & STARPU_W)
-	if ((wt_mask & ~(1<<memory_node)))
+	if (wt_mask & ~(1<<memory_node))
 		_starpu_write_through_data(handle, memory_node, wt_mask);
 
 	int cpt = 0;

+ 2 - 2
src/datawizard/data_request.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009-2017  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017  CNRS
  * Copyright (C) 2016  INRIA
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -822,7 +822,7 @@ int _starpu_check_that_no_data_request_exists(unsigned node)
 	no_pending = !data_requests_npending[node];
 	STARPU_PTHREAD_MUTEX_UNLOCK(&data_requests_pending_list_mutex[node]);
 
-	return (no_request && no_pending);
+	return no_request && no_pending;
 }
 
 /* Note: the returned value will be outdated since the locks are not taken at

+ 5 - 5
src/datawizard/interfaces/bcsr_interface.c

@@ -161,11 +161,11 @@ static int bcsr_compare(void *data_interface_a, void *data_interface_b)
 	struct starpu_bcsr_interface *bcsr_b = (struct starpu_bcsr_interface *) data_interface_b;
 
 	/* Two matricess are considered compatible if they have the same size */
-	return ((bcsr_a->nnz == bcsr_b->nnz)
-			&& (bcsr_a->nrow == bcsr_b->nrow)
-			&& (bcsr_a->r == bcsr_b->r)
-			&& (bcsr_a->c == bcsr_b->c)
-			&& (bcsr_a->elemsize == bcsr_b->elemsize));
+	return (bcsr_a->nnz == bcsr_b->nnz)
+		&& (bcsr_a->nrow == bcsr_b->nrow)
+		&& (bcsr_a->r == bcsr_b->r)
+		&& (bcsr_a->c == bcsr_b->c)
+		&& (bcsr_a->elemsize == bcsr_b->elemsize);
 }
 
 /* offer an access to the data parameters */

+ 4 - 4
src/datawizard/interfaces/block_interface.c

@@ -207,10 +207,10 @@ static int block_compare(void *data_interface_a, void *data_interface_b)
 	struct starpu_block_interface *block_b = (struct starpu_block_interface *) data_interface_b;
 
 	/* Two matricess are considered compatible if they have the same size */
-	return ((block_a->nx == block_b->nx)
-			&& (block_a->ny == block_b->ny)
-			&& (block_a->nz == block_b->nz)
-			&& (block_a->elemsize == block_b->elemsize));
+	return (block_a->nx == block_b->nx)
+		&& (block_a->ny == block_b->ny)
+		&& (block_a->nz == block_b->nz)
+		&& (block_a->elemsize == block_b->elemsize);
 }
 
 static void display_block_interface(starpu_data_handle_t handle, FILE *f)

+ 2 - 2
src/datawizard/interfaces/coo_interface.c

@@ -176,10 +176,10 @@ coo_compare(void *a, void *b)
 	coo_a = (struct starpu_coo_interface *) a;
 	coo_b = (struct starpu_coo_interface *) b;
 
-	return (coo_a->nx == coo_b->nx &&
+	return coo_a->nx == coo_b->nx &&
 		coo_a->ny == coo_b->ny &&
 		coo_a->n_values == coo_b->n_values &&
-		coo_a->elemsize == coo_b->elemsize);
+		coo_a->elemsize == coo_b->elemsize;
 }
 
 static void

+ 3 - 3
src/datawizard/interfaces/csr_interface.c

@@ -137,9 +137,9 @@ static int csr_compare(void *data_interface_a, void *data_interface_b)
 	struct starpu_csr_interface *csr_b = (struct starpu_csr_interface *) data_interface_b;
 
 	/* Two matricess are considered compatible if they have the same size */
-	return ((csr_a->nnz == csr_b->nnz)
-			&& (csr_a->nrow == csr_b->nrow)
-			&& (csr_a->elemsize == csr_b->elemsize));
+	return (csr_a->nnz == csr_b->nnz)
+		&& (csr_a->nrow == csr_b->nrow)
+		&& (csr_a->elemsize == csr_b->elemsize);
 }
 
 /* offer an access to the data parameters */

+ 3 - 3
src/datawizard/interfaces/matrix_interface.c

@@ -211,9 +211,9 @@ static int matrix_compare(void *data_interface_a, void *data_interface_b)
 	struct starpu_matrix_interface *matrix_b = (struct starpu_matrix_interface *) data_interface_b;
 
 	/* Two matricess are considered compatible if they have the same size */
-	return ((matrix_a->nx == matrix_b->nx)
-			&& (matrix_a->ny == matrix_b->ny)
-			&& (matrix_a->elemsize == matrix_b->elemsize));
+	return (matrix_a->nx == matrix_b->nx)
+		&& (matrix_a->ny == matrix_b->ny)
+		&& (matrix_a->elemsize == matrix_b->elemsize);
 }
 
 static void display_matrix_interface(starpu_data_handle_t handle, FILE *f)

+ 7 - 7
src/datawizard/interfaces/multiformat_interface.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2012  INRIA
- * Copyright (C) 2012, 2013, 2014, 2016       CNRS
+ * Copyright (C) 2012, 2013, 2014, 2016, 2017       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
@@ -225,18 +225,18 @@ static int multiformat_compare(void *data_interface_a, void *data_interface_b)
 	struct starpu_multiformat_interface *multiformat_a = (struct starpu_multiformat_interface *) data_interface_a;
 	struct starpu_multiformat_interface *multiformat_b = (struct starpu_multiformat_interface *) data_interface_b;
 
-	return ((multiformat_a->nx == multiformat_b->nx)
-			&& (multiformat_a->ops->cpu_elemsize == multiformat_b->ops->cpu_elemsize)
+	return (multiformat_a->nx == multiformat_b->nx)
+		&& (multiformat_a->ops->cpu_elemsize == multiformat_b->ops->cpu_elemsize)
 #ifdef STARPU_USE_CUDA
-			&& (multiformat_a->ops->cuda_elemsize == multiformat_b->ops->cuda_elemsize)
+		&& (multiformat_a->ops->cuda_elemsize == multiformat_b->ops->cuda_elemsize)
 #endif
 #ifdef STARPU_USE_OPENCL
-			&& (multiformat_a->ops->opencl_elemsize == multiformat_b->ops->opencl_elemsize)
+		&& (multiformat_a->ops->opencl_elemsize == multiformat_b->ops->opencl_elemsize)
 #endif
 #ifdef STARPU_USE_MIC
-		    && (multiformat_a->ops->mic_elemsize == multiformat_b->ops->mic_elemsize)
+		&& (multiformat_a->ops->mic_elemsize == multiformat_b->ops->mic_elemsize)
 #endif
-		);
+		;
 }
 
 static void display_multiformat_interface(starpu_data_handle_t handle, FILE *f)

+ 1 - 1
src/datawizard/interfaces/variable_interface.c

@@ -150,7 +150,7 @@ static int variable_compare(void *data_interface_a, void *data_interface_b)
 	struct starpu_variable_interface *variable_b = (struct starpu_variable_interface *) data_interface_b;
 
 	/* Two variables are considered compatible if they have the same size */
-	return (variable_a->elemsize == variable_b->elemsize);
+	return variable_a->elemsize == variable_b->elemsize;
 }
 
 static void display_variable_interface(starpu_data_handle_t handle, FILE *f)

+ 2 - 2
src/datawizard/interfaces/vector_interface.c

@@ -158,8 +158,8 @@ static int vector_compare(void *data_interface_a, void *data_interface_b)
 	struct starpu_vector_interface *vector_b = (struct starpu_vector_interface *) data_interface_b;
 
 	/* Two vectors are considered compatible if they have the same size */
-	return ((vector_a->nx == vector_b->nx)
-			&& (vector_a->elemsize == vector_b->elemsize));
+	return (vector_a->nx == vector_b->nx)
+		&& (vector_a->elemsize == vector_b->elemsize);
 }
 
 static void display_vector_interface(starpu_data_handle_t handle, FILE *f)

+ 3 - 3
src/datawizard/sort_data_handles.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2011, 2014-2016  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2015  CNRS
+ * Copyright (C) 2010, 2011, 2015, 2017  CNRS
  * Copyright (C) 2015  Inria
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -100,13 +100,13 @@ static int _starpu_compar_handles(const struct _starpu_data_descr *descrA,
 		return -1;
 	if (dataA->arbiter != dataB->arbiter)
 		/* Both are arbitered, sort by arbiter pointer order */
-		return ((dataA->arbiter < dataB->arbiter)?-1:1);
+		return (dataA->arbiter < dataB->arbiter)?-1:1;
 	/* If both are arbitered by the same arbiter (or they are both not
 	 * arbitered), we'll sort them by handle */
 
 	/* In case we have data/subdata from different trees */
 	if (dataA->root_handle != dataB->root_handle)
-		return ((dataA->root_handle < dataB->root_handle)?-1:1);
+		return (dataA->root_handle < dataB->root_handle)?-1:1;
 
 	/* Things get more complicated: we need to find the location of dataA
 	 * and dataB within the tree. */

+ 7 - 4
src/drivers/scc/driver_scc_common.c

@@ -66,11 +66,13 @@ int _starpu_scc_common_mp_init()
 {
 	int rckncm_fd;
 
+	rcce_initialized = 0;
+
 	/* "/dev/rckncm" is to access shared memory on SCC. */
 	if ((rckncm_fd = open("/dev/rckncm", O_RDWR | O_SYNC)) < 0)
 	{
 		/* It seems that we're not on a SCC system. */
-		return (rcce_initialized = 0);
+		return rcce_initialized;
 	}
 
 	int page_size = getpagesize();
@@ -80,7 +82,7 @@ int _starpu_scc_common_mp_init()
 	{
 		perror("mmap");
 		close(rckncm_fd);
-		return (rcce_initialized = 0);
+		return rcce_initialized;
 	}
 
 	int *argc = _starpu_get_argc();
@@ -91,7 +93,7 @@ int _starpu_scc_common_mp_init()
 	{
 		close(rckncm_fd);
 		munmap((void*)rckncm_map, SHMSIZE);
-		return (rcce_initialized = 0);
+		return 0;
 	}
 
 	unsigned int page_offset = (SHM_ADDR) - aligne_addr;
@@ -104,7 +106,8 @@ int _starpu_scc_common_mp_init()
 
 	close(rckncm_fd);
 
-	return (rcce_initialized = 1);
+	rcce_initialized = 1;
+	return rcce_initialized;
 }
 
 void *_starpu_scc_common_get_shared_memory_addr()

+ 1 - 1
src/sched_policies/component_work_stealing.c

@@ -328,7 +328,7 @@ void _ws_remove_child(struct starpu_sched_component * component, struct starpu_s
 	component->children[i_component] = component->children[component->nchildren - 1];
 	component->nchildren--;
 	struct starpu_task * task;
-	while((task = _starpu_prio_deque_pop_task(tmp_fifo)))
+	while (task = _starpu_prio_deque_pop_task(tmp_fifo))
 	{
 		starpu_sched_component_push_task(NULL, component, task);
 	}

+ 1 - 1
src/sched_policies/heteroprio.c

@@ -643,7 +643,7 @@ done:		;
 /* TOTO berenger: iterate in the other sense */
 		struct starpu_task *task_to_prefetch = NULL;
 		for (task_to_prefetch  = starpu_task_prio_list_begin(&worker->tasks_queue.list);
-			(task_to_prefetch != starpu_task_prio_list_end(&worker->tasks_queue.list) &&
+		     (task_to_prefetch != starpu_task_prio_list_end(&worker->tasks_queue.list) &&
 		      nb_added_tasks && hp->nb_remaining_tasks_per_arch_index[worker->arch_index] != 0);
 		     task_to_prefetch  = starpu_task_prio_list_next(&worker->tasks_queue.list, task_to_prefetch))
 		{

+ 2 - 2
src/util/openmp_runtime_support.c

@@ -1987,7 +1987,7 @@ int starpu_omp_for_inline_first(unsigned long long nb_iterations, unsigned long
 	{
 		_starpu_omp_for_loop_end(parallel_region, task, loop, ordered);
 	}
-	return (*_nb_i != 0);
+	return *_nb_i != 0;
 }
 
 int starpu_omp_for_inline_next(unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, unsigned long long *_first_i, unsigned long long *_nb_i)
@@ -2001,7 +2001,7 @@ int starpu_omp_for_inline_next(unsigned long long nb_iterations, unsigned long l
 	{
 		_starpu_omp_for_loop_end(parallel_region, task, loop, ordered);
 	}
-	return (*_nb_i != 0);
+	return *_nb_i != 0;
 }
 
 int starpu_omp_for_inline_first_alt(unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, unsigned long long *_begin_i, unsigned long long *_end_i)

+ 1 - 1
src/util/starpu_clusters_create.c

@@ -523,7 +523,7 @@ int _starpu_cluster_machine(hwloc_obj_type_t cluster_level,
 	struct _starpu_cluster_group *g;
 	int ret = 0;
 
-	if ((ret = _starpu_cluster_topology(cluster_level, machine)))
+	if (ret = _starpu_cluster_topology(cluster_level, machine))
 		return ret;
 
 	for (g = _starpu_cluster_group_list_begin(machine->groups) ;