瀏覽代碼

Let the user specify the scheduling policy using command line in the
async-tasks-overhead example.

Cédric Augonnet 16 年之前
父節點
當前提交
334afa8703
共有 1 個文件被更改,包括 22 次插入2 次删除
  1. 22 2
      tests/microbenchs/async-tasks-overhead.c

+ 22 - 2
tests/microbenchs/async-tasks-overhead.c

@@ -68,14 +68,34 @@ void inject_one_task(void)
 	starpu_submit_task(task);
 }
 
+static struct starpu_conf conf = {
+	.sched_policy = NULL,
+	.ncpus = -1,
+	.ncuda = -1,
+	.nspus = -1,
+	.calibrate = 0
+};
+
+static void usage(char **argv)
+{
+	fprintf(stderr, "%s [-i ntasks] [-p sched_policy] [-h]\n", argv[0]);
+	exit(-1);
+}
+
 static void parse_args(int argc, char **argv)
 {
 	int c;
-	while ((c = getopt(argc, argv, "i:")) != -1)
+	while ((c = getopt(argc, argv, "i:p:h")) != -1)
 	switch(c) {
 		case 'i':
 			ntasks = atoi(optarg);
 			break;
+		case 'p':
+			conf.sched_policy = optarg;
+			break;
+		case 'h':
+			usage(argv);
+			break;
 	}
 
 	
@@ -95,7 +115,7 @@ int main(int argc, char **argv)
 
 	cnt = ntasks;
 
-	starpu_init(NULL);
+	starpu_init(&conf);
 
 	fprintf(stderr, "#tasks : %d\n", ntasks);