|
@@ -1,6 +1,6 @@
|
|
|
/* StarPU --- Runtime system for heterogeneous multicore architectures.
|
|
/* StarPU --- Runtime system for heterogeneous multicore architectures.
|
|
|
*
|
|
*
|
|
|
- * Copyright (C) 2009-2014,2016 Université de Bordeaux
|
|
|
|
|
|
|
+ * Copyright (C) 2009-2014,2016,2020 Université de Bordeaux
|
|
|
* Copyright (C) 2010-2013,2015-2017 CNRS
|
|
* Copyright (C) 2010-2013,2015-2017 CNRS
|
|
|
*
|
|
*
|
|
|
* StarPU is free software; you can redistribute it and/or modify
|
|
* StarPU is free software; you can redistribute it and/or modify
|
|
@@ -24,7 +24,17 @@
|
|
|
* Measure the cost of submitting asynchronous tasks
|
|
* Measure the cost of submitting asynchronous tasks
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
|
|
+starpu_data_handle_t data_handles[8];
|
|
|
|
|
+float *buffers[8];
|
|
|
|
|
+
|
|
|
|
|
+#ifdef STARPU_QUICK_CHECK
|
|
|
|
|
+static unsigned ntasks = 128;
|
|
|
|
|
+#else
|
|
|
static unsigned ntasks = 65536;
|
|
static unsigned ntasks = 65536;
|
|
|
|
|
+#endif
|
|
|
|
|
+static unsigned nbuffers = 0;
|
|
|
|
|
+
|
|
|
|
|
+#define BUFFERSIZE 16
|
|
|
|
|
|
|
|
//static unsigned finished = 0;
|
|
//static unsigned finished = 0;
|
|
|
|
|
|
|
@@ -45,36 +55,29 @@ static struct starpu_codelet dummy_codelet =
|
|
|
.opencl_funcs = {dummy_func},
|
|
.opencl_funcs = {dummy_func},
|
|
|
.cpu_funcs_name = {"dummy_func"},
|
|
.cpu_funcs_name = {"dummy_func"},
|
|
|
.model = NULL,
|
|
.model = NULL,
|
|
|
- .nbuffers = 0
|
|
|
|
|
|
|
+ .nbuffers = 0,
|
|
|
|
|
+ .modes = {STARPU_RW, STARPU_RW, STARPU_RW, STARPU_RW, STARPU_RW, STARPU_RW, STARPU_RW, STARPU_RW}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-//static void inject_one_task(void)
|
|
|
|
|
-//{
|
|
|
|
|
-// struct starpu_task *task = starpu_task_create();
|
|
|
|
|
-//
|
|
|
|
|
-// task->cl = &dummy_codelet;
|
|
|
|
|
-// task->cl_arg = NULL;
|
|
|
|
|
-// task->detach = 0;
|
|
|
|
|
-//
|
|
|
|
|
-// int ret = starpu_task_submit(task);
|
|
|
|
|
-// STARPU_ASSERT(!ret);
|
|
|
|
|
-//}
|
|
|
|
|
-
|
|
|
|
|
static void usage(char **argv)
|
|
static void usage(char **argv)
|
|
|
{
|
|
{
|
|
|
- fprintf(stderr, "%s [-i ntasks] [-p sched_policy] [-h]\n", argv[0]);
|
|
|
|
|
- exit(-1);
|
|
|
|
|
|
|
+ fprintf(stderr, "Usage: %s [-i ntasks] [-p sched_policy] [-b nbuffers] [-h]\n", argv[0]);
|
|
|
|
|
+ exit(EXIT_FAILURE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void parse_args(int argc, char **argv, struct starpu_conf *conf)
|
|
static void parse_args(int argc, char **argv, struct starpu_conf *conf)
|
|
|
{
|
|
{
|
|
|
int c;
|
|
int c;
|
|
|
- while ((c = getopt(argc, argv, "i:p:h")) != -1)
|
|
|
|
|
|
|
+ while ((c = getopt(argc, argv, "i:b:p:h")) != -1)
|
|
|
switch(c)
|
|
switch(c)
|
|
|
{
|
|
{
|
|
|
case 'i':
|
|
case 'i':
|
|
|
ntasks = atoi(optarg);
|
|
ntasks = atoi(optarg);
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case 'b':
|
|
|
|
|
+ nbuffers = atoi(optarg);
|
|
|
|
|
+ dummy_codelet.nbuffers = nbuffers;
|
|
|
|
|
+ break;
|
|
|
case 'p':
|
|
case 'p':
|
|
|
conf->sched_policy_name = optarg;
|
|
conf->sched_policy_name = optarg;
|
|
|
break;
|
|
break;
|
|
@@ -96,19 +99,22 @@ int main(int argc, char **argv)
|
|
|
starpu_conf_init(&conf);
|
|
starpu_conf_init(&conf);
|
|
|
conf.ncpus = 2;
|
|
conf.ncpus = 2;
|
|
|
|
|
|
|
|
-#ifdef STARPU_QUICK_CHECK
|
|
|
|
|
- ntasks = 128;
|
|
|
|
|
-#endif
|
|
|
|
|
-
|
|
|
|
|
parse_args(argc, argv, &conf);
|
|
parse_args(argc, argv, &conf);
|
|
|
|
|
|
|
|
ret = starpu_initialize(&conf, &argc, &argv);
|
|
ret = starpu_initialize(&conf, &argc, &argv);
|
|
|
if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
|
|
if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
|
|
|
STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
|
|
STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
|
|
|
|
|
|
|
|
|
|
+ unsigned buffer;
|
|
|
|
|
+ for (buffer = 0; buffer < nbuffers; buffer++)
|
|
|
|
|
+ {
|
|
|
|
|
+ starpu_malloc((void**)&buffers[buffer], BUFFERSIZE*sizeof(float));
|
|
|
|
|
+ starpu_vector_data_register(&data_handles[buffer], STARPU_MAIN_RAM, (uintptr_t)buffers[buffer], BUFFERSIZE, sizeof(float));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
starpu_profiling_status_set(STARPU_PROFILING_ENABLE);
|
|
starpu_profiling_status_set(STARPU_PROFILING_ENABLE);
|
|
|
|
|
|
|
|
- fprintf(stderr, "#tasks : %u\n", ntasks);
|
|
|
|
|
|
|
+ fprintf(stderr, "#tasks : %u\n#buffers : %u\n", ntasks, nbuffers);
|
|
|
|
|
|
|
|
/* Create an array of tasks */
|
|
/* Create an array of tasks */
|
|
|
struct starpu_task **tasks = (struct starpu_task **) malloc(ntasks*sizeof(struct starpu_task *));
|
|
struct starpu_task **tasks = (struct starpu_task **) malloc(ntasks*sizeof(struct starpu_task *));
|
|
@@ -117,8 +123,14 @@ int main(int argc, char **argv)
|
|
|
{
|
|
{
|
|
|
struct starpu_task *task = starpu_task_create();
|
|
struct starpu_task *task = starpu_task_create();
|
|
|
task->cl = &dummy_codelet;
|
|
task->cl = &dummy_codelet;
|
|
|
- task->cl_arg = NULL;
|
|
|
|
|
task->detach = 0;
|
|
task->detach = 0;
|
|
|
|
|
+
|
|
|
|
|
+ /* we have 8 buffers at most */
|
|
|
|
|
+ for (buffer = 0; buffer < nbuffers; buffer++)
|
|
|
|
|
+ {
|
|
|
|
|
+ task->handles[buffer] = data_handles[buffer];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
tasks[i] = task;
|
|
tasks[i] = task;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -165,15 +177,25 @@ int main(int argc, char **argv)
|
|
|
|
|
|
|
|
if (output_dir && bench_id)
|
|
if (output_dir && bench_id)
|
|
|
{
|
|
{
|
|
|
|
|
+ char number[1+sizeof(nbuffers)*3+1];
|
|
|
|
|
+ const char *numberp;
|
|
|
char file[1024];
|
|
char file[1024];
|
|
|
FILE *f;
|
|
FILE *f;
|
|
|
|
|
|
|
|
- snprintf(file, sizeof(file), "%s/async_tasks_overhead_total.dat", output_dir);
|
|
|
|
|
|
|
+ if (nbuffers)
|
|
|
|
|
+ {
|
|
|
|
|
+ snprintf(number, sizeof(number), "_%u", nbuffers);
|
|
|
|
|
+ numberp = number;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ numberp = "";
|
|
|
|
|
+
|
|
|
|
|
+ snprintf(file, sizeof(file), "%s/async_tasks_overhead_total%s.dat", output_dir, numberp);
|
|
|
f = fopen(file, "a");
|
|
f = fopen(file, "a");
|
|
|
fprintf(f, "%s\t%f\n", bench_id, timing/1000000);
|
|
fprintf(f, "%s\t%f\n", bench_id, timing/1000000);
|
|
|
fclose(f);
|
|
fclose(f);
|
|
|
|
|
|
|
|
- snprintf(file, sizeof(file), "%s/async_tasks_overhead_per_task.dat", output_dir);
|
|
|
|
|
|
|
+ snprintf(file, sizeof(file), "%s/async_tasks_overhead_per_task%s.dat", output_dir, numberp);
|
|
|
f = fopen(file, "a");
|
|
f = fopen(file, "a");
|
|
|
fprintf(f, "%s\t%f\n", bench_id, timing/ntasks);
|
|
fprintf(f, "%s\t%f\n", bench_id, timing/ntasks);
|
|
|
fclose(f);
|
|
fclose(f);
|