Browse Source

Properly handle the case where the user gives StarPU the name of a strategy
that cannot be found.

Cédric Augonnet 16 years ago
parent
commit
b5c70c361e
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/core/policies/sched_policy.c

+ 6 - 1
src/core/policies/sched_policy.c

@@ -111,6 +111,7 @@ static void display_sched_help_message(void)
 
 static struct sched_policy_s *select_sched_policy(struct machine_config_s *config)
 {
+	struct sched_policy_s *selected_policy = NULL;
 	struct starpu_conf *user_conf = config->user_conf;
 
 	/* First, we check whether the application explicitely gave a scheduling policy or not */
@@ -128,7 +129,11 @@ static struct sched_policy_s *select_sched_policy(struct machine_config_s *confi
 	}
 
 	if (sched_pol_name)
-		return find_sched_policy_from_name(sched_pol_name);
+		selected_policy = find_sched_policy_from_name(sched_pol_name);
+
+	/* Perhaps there was no policy that matched the name */
+	if (selected_policy)
+		return selected_policy;
 
 	/* If no policy was specified, we use the greedy policy as a default */
 	return &sched_eager_policy;