Ver código fonte

drop useless cast

Samuel Thibault 8 anos atrás
pai
commit
7145c56ef0
4 arquivos alterados com 20 adições e 20 exclusões
  1. 10 10
      src/core/sched_ctx.c
  2. 8 8
      src/core/task.c
  3. 1 1
      src/datawizard/malloc.c
  4. 1 1
      src/sched_policies/parallel_heft.c

+ 10 - 10
src/core/sched_ctx.c

@@ -149,7 +149,7 @@ static void _starpu_add_workers_to_sched_ctx(struct _starpu_sched_ctx *sched_ctx
 					     int *added_workers, int *n_added_workers)
 {
 	struct starpu_worker_collection *workers = sched_ctx->workers;
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 
 	int nworkers_to_add = nworkers == -1 ? (int)config->topology.nworkers : nworkers;
 	if (!nworkers_to_add)
@@ -480,7 +480,7 @@ struct _starpu_sched_ctx* _starpu_create_sched_ctx(struct starpu_sched_policy *p
 						   void * user_data,
 						   int nsub_ctxs, int *sub_ctxs, int nsms)
 {
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 
 	STARPU_PTHREAD_MUTEX_LOCK(&sched_ctx_manag);
 	STARPU_ASSERT(config->topology.nsched_ctxs < STARPU_NMAX_SCHED_CTXS);
@@ -628,7 +628,7 @@ static void _get_workers(int min, int max, int *workers, int *nw, enum starpu_wo
 	int npus = 0;
 	int i;
 
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	if(config->topology.nsched_ctxs == 1)
 	{
 		/*we have all available resources */
@@ -742,7 +742,7 @@ unsigned starpu_sched_ctx_create_inside_interval(const char *policy_name, const
 						 int min_ncpus, int max_ncpus, int min_ngpus, int max_ngpus,
 						 unsigned allow_overlap)
 {
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	struct starpu_sched_policy *selected_policy = _starpu_select_sched_policy(config, policy_name);
 
 	struct _starpu_sched_ctx *sched_ctx = NULL;
@@ -838,7 +838,7 @@ unsigned starpu_sched_ctx_create(int *workerids, int nworkers, const char *sched
 		if (arg_type == STARPU_SCHED_CTX_POLICY_NAME)
 		{
 			char *policy_name = va_arg(varg_list, char *);
-			struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+			struct _starpu_machine_config *config = _starpu_get_machine_config();
 			sched_policy = _starpu_select_sched_policy(config, policy_name);
 		}
 		else if (arg_type == STARPU_SCHED_CTX_POLICY_STRUCT)
@@ -949,7 +949,7 @@ int fstarpu_sched_ctx_create(int *workerids, int nworkers, const char *sched_ctx
 		{
 			arg_i++;
 			char *policy_name = arglist[arg_i];
-			struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+			struct _starpu_machine_config *config = _starpu_get_machine_config();
 			sched_policy = _starpu_select_sched_policy(config, policy_name);
 		}
 		else if (arg_type == STARPU_SCHED_CTX_POLICY_STRUCT)
@@ -1137,7 +1137,7 @@ void starpu_sched_ctx_delete(unsigned sched_ctx_id)
 
 	/*if both of them have all the ressources is pointless*/
 	/*trying to transfer ressources from one ctx to the other*/
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	unsigned nworkers = config->topology.nworkers;
 
 	if(nworkers_ctx > 0 && inheritor_sched_ctx && inheritor_sched_ctx->id != STARPU_NMAX_SCHED_CTXS &&
@@ -1193,7 +1193,7 @@ void _starpu_delete_all_sched_ctxs()
 
 static void _starpu_check_workers(int *workerids, int nworkers)
 {
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	int nworkers_conf = config->topology.nworkers;
 
 	int i;
@@ -1475,7 +1475,7 @@ int _starpu_wait_for_n_submitted_tasks_of_sched_ctx(unsigned sched_ctx_id, unsig
 
 void _starpu_decrement_nsubmitted_tasks_of_sched_ctx(unsigned sched_ctx_id)
 {
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 #ifndef STARPU_SANITIZE_THREAD
 	if (!config->watchdog_ok)
 		config->watchdog_ok = 1;
@@ -1914,7 +1914,7 @@ unsigned starpu_sched_ctx_contains_type_of_worker(enum starpu_worker_archtype ar
 
 unsigned _starpu_worker_belongs_to_a_sched_ctx(int workerid, unsigned sched_ctx_id)
 {
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	int i;
 	for(i = 0; i < STARPU_NMAX_SCHED_CTXS; i++)
 	{

+ 8 - 8
src/core/task.c

@@ -834,7 +834,7 @@ int _starpu_task_wait_for_all_and_return_nb_waited_tasks(void)
 		_STARPU_DEBUG("Waiting for all tasks\n");
 		STARPU_ASSERT_MSG(_starpu_worker_may_perform_blocking_calls(), "starpu_task_wait_for_all must not be called from a task or callback");
 		STARPU_AYU_BARRIER();
-		struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+		struct _starpu_machine_config *config = _starpu_get_machine_config();
 		if(config->topology.nsched_ctxs == 1)
 		{
 			_starpu_sched_do_schedule(0);
@@ -907,7 +907,7 @@ int starpu_task_wait_for_n_submitted(unsigned n)
 		_STARPU_DEBUG("Waiting for all tasks\n");
 		STARPU_ASSERT_MSG(_starpu_worker_may_perform_blocking_calls(), "starpu_task_wait_for_n_submitted must not be called from a task or callback");
 
-		struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+		struct _starpu_machine_config *config = _starpu_get_machine_config();
 		if(config->topology.nsched_ctxs == 1)
 			_starpu_wait_for_n_submitted_tasks_of_sched_ctx(0, n);
 		else
@@ -946,7 +946,7 @@ int starpu_task_wait_for_no_ready(void)
 {
 	STARPU_ASSERT_MSG(_starpu_worker_may_perform_blocking_calls(), "starpu_task_wait_for_no_ready must not be called from a task or callback");
 
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	if(config->topology.nsched_ctxs == 1)
 	{
 		_starpu_sched_do_schedule(0);
@@ -976,7 +976,7 @@ int starpu_task_wait_for_no_ready(void)
 
 void starpu_do_schedule(void)
 {
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	if(config->topology.nsched_ctxs == 1)
 		_starpu_sched_do_schedule(0);
 	else
@@ -1022,7 +1022,7 @@ starpu_drivers_request_termination(void)
 int starpu_task_nsubmitted(void)
 {
 	int nsubmitted = 0;
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	if(config->topology.nsched_ctxs == 1)
 		nsubmitted = _starpu_get_nsubmitted_tasks_of_sched_ctx(0);
 	else
@@ -1043,7 +1043,7 @@ int starpu_task_nsubmitted(void)
 int starpu_task_nready(void)
 {
 	int nready = 0;
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	if(config->topology.nsched_ctxs == 1)
 		nready = starpu_sched_ctx_get_nready_tasks(0);
 	else
@@ -1199,7 +1199,7 @@ static void *watchdog_func(void *arg)
 #else
 	timeout = ((float) atoll(timeout_env)) / 1000000;
 #endif
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	starpu_pthread_setname("watchdog");
 
 	STARPU_PTHREAD_MUTEX_LOCK(&config->submitted_mutex);
@@ -1248,7 +1248,7 @@ static void *watchdog_func(void *arg)
 
 void _starpu_watchdog_init(void)
 {
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	char *timeout_env = starpu_getenv("STARPU_WATCHDOG_TIMEOUT");
 
 	STARPU_PTHREAD_MUTEX_INIT(&config->submitted_mutex, NULL);

+ 1 - 1
src/datawizard/malloc.c

@@ -137,7 +137,7 @@ int starpu_malloc_flags(void **A, size_t dim, int flags)
 			starpu_memory_allocate(STARPU_MAIN_RAM, dim, flags | STARPU_MEMORY_OVERFLOW);
 	}
 
-	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config();
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	if (flags & STARPU_MALLOC_PINNED && disable_pinning <= 0 && STARPU_RUNNING_ON_VALGRIND == 0 && config->conf.ncuda != 0)
 	{
 #ifdef STARPU_SIMGRID

+ 1 - 1
src/sched_policies/parallel_heft.c

@@ -521,7 +521,7 @@ static void parallel_heft_add_workers(__attribute__((unused)) unsigned sched_ctx
 	_starpu_sched_find_worker_combinations(workerids, nworkers);
 
 // start_unclear_part: not very clear where this is used
-/* 	struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config(); */
+/* 	struct _starpu_machine_config *config = _starpu_get_machine_config(); */
 /* 	ncombinedworkers = config->topology.ncombinedworkers; */
 
 /* 	/\* We pre-compute an array of all the perfmodel archs that are applicable *\/ */