소스 검색

Merge branch 'master' of gitlab.inria.fr:starpu/starpu into fpga

Samuel Thibault 4 년 전
부모
커밋
2758431ba2

+ 1 - 2
examples/gl_interop/gl_interop.c

@@ -106,9 +106,8 @@ int main(int argc, char **argv)
 
 
 	/* Enable OpenGL interoperability */
 	/* Enable OpenGL interoperability */
 	starpu_conf_init(&conf);
 	starpu_conf_init(&conf);
+	starpu_conf_noworker(&conf);
 	conf.ncuda = 1;
 	conf.ncuda = 1;
-	conf.ncpus = 0;
-	conf.nopencl = 0;
 	conf.cuda_opengl_interoperability = cuda_devices;
 	conf.cuda_opengl_interoperability = cuda_devices;
 	conf.n_cuda_opengl_interoperability = sizeof(cuda_devices) / sizeof(*cuda_devices);
 	conf.n_cuda_opengl_interoperability = sizeof(cuda_devices) / sizeof(*cuda_devices);
 	conf.not_launched_drivers = drivers;
 	conf.not_launched_drivers = drivers;

+ 1 - 2
examples/gl_interop/gl_interop_idle.c

@@ -122,9 +122,8 @@ int main(int argc, char **argv)
 
 
 	/* Enable OpenGL interoperability */
 	/* Enable OpenGL interoperability */
 	starpu_conf_init(&conf);
 	starpu_conf_init(&conf);
+	starpu_conf_noworker(&conf);
 	conf.ncuda = 1;
 	conf.ncuda = 1;
-	conf.ncpus = 0;
-	conf.nopencl = 0;
 	conf.cuda_opengl_interoperability = cuda_devices;
 	conf.cuda_opengl_interoperability = cuda_devices;
 	conf.n_cuda_opengl_interoperability = sizeof(cuda_devices) / sizeof(*cuda_devices);
 	conf.n_cuda_opengl_interoperability = sizeof(cuda_devices) / sizeof(*cuda_devices);
 	conf.not_launched_drivers = drivers;
 	conf.not_launched_drivers = drivers;

+ 1 - 3
examples/matvecmult/matvecmult.c

@@ -142,9 +142,7 @@ int main(void)
 	struct starpu_conf conf;
 	struct starpu_conf conf;
 
 
 	starpu_conf_init(&conf);
 	starpu_conf_init(&conf);
-	conf.ncpus = 0;
-	conf.ncuda = 0;
-	conf.nmic = 0;
+	starpu_conf_noworker(&conf);
 	conf.nopencl = 1;
 	conf.nopencl = 1;
 
 
         /* int width=1100; */
         /* int width=1100; */

+ 1 - 4
examples/perf_steering/perf_knobs_03.c

@@ -37,11 +37,8 @@ int main(int argc, char **argv)
 
 
 	struct starpu_conf conf;
 	struct starpu_conf conf;
 	starpu_conf_init(&conf);
 	starpu_conf_init(&conf);
+	starpu_conf_noworker(&conf);
 	conf.ncpus = 2;
 	conf.ncpus = 2;
-	conf.ncuda = 0;
-	conf.nopencl = 0;
-	conf.nmic = 0;
-	conf.nmpi_ms = 0;
 	{
 	{
 		const char *sched_pol_name = starpu_getenv("STARPU_SCHED");
 		const char *sched_pol_name = starpu_getenv("STARPU_SCHED");
 		if (sched_pol_name != NULL && strcmp(sched_pol_name, "prio") != 0)
 		if (sched_pol_name != NULL && strcmp(sched_pol_name, "prio") != 0)

+ 11 - 0
include/starpu.h

@@ -542,6 +542,17 @@ struct starpu_conf
 int starpu_conf_init(struct starpu_conf *conf);
 int starpu_conf_init(struct starpu_conf *conf);
 
 
 /**
 /**
+   Set fields of \p conf so that no worker is enabled, i.e. set
+   starpu_conf::ncpus = 0, starpu_conf::ncuda = 0, etc.
+
+   This allows to portably enable only a given type of worker:
+
+   starpu_conf_noworker(&conf);
+   conf.ncpus = -1;
+*/
+int starpu_conf_noworker(struct starpu_conf *conf);
+
+/**
    StarPU initialization method, must be called prior to any other
    StarPU initialization method, must be called prior to any other
    StarPU call. It is possible to specify StarPU’s configuration (e.g.
    StarPU call. It is possible to specify StarPU’s configuration (e.g.
    scheduling policy, number of cores, ...) by passing a
    scheduling policy, number of cores, ...) by passing a

+ 9 - 0
src/core/workers.c

@@ -1192,6 +1192,15 @@ int starpu_conf_init(struct starpu_conf *conf)
 	return 0;
 	return 0;
 }
 }
 
 
+int starpu_conf_noworker(struct starpu_conf *conf)
+{
+	conf->ncpus = 0;
+	conf->ncuda = 0;
+	conf->nopencl = 0;
+	conf->nmic = 0;
+	conf->nmpi_ms = 0;
+}
+
 static void _starpu_conf_set_value_against_environment(char *name, int *value, int precedence_over_env)
 static void _starpu_conf_set_value_against_environment(char *name, int *value, int precedence_over_env)
 {
 {
 	if (precedence_over_env == 0)
 	if (precedence_over_env == 0)

+ 3 - 3
tests/datawizard/bcsr.c

@@ -116,9 +116,9 @@ int main(int argc, char **argv)
 	starpu_conf_init(&conf);
 	starpu_conf_init(&conf);
 
 
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
-	conf.ncuda = 0;
-	conf.nopencl = 0;
-	conf.nmic = 0;
+	starpu_conf_noworker(&conf);
+	conf.ncpus = -1;
+	conf.nmpi_ms = -1;
 
 
 	if (starpu_initialize(&conf, &argc, &argv) == -ENODEV)
 	if (starpu_initialize(&conf, &argc, &argv) == -ENODEV)
 		return STARPU_TEST_SKIPPED;
 		return STARPU_TEST_SKIPPED;

+ 1 - 4
tests/datawizard/noreclaim.c

@@ -84,11 +84,8 @@ int main(int argc, char **argv)
 	setenv("STARPU_LIMIT_CPU_NUMA_MEM", TOTAL, 1);
 	setenv("STARPU_LIMIT_CPU_NUMA_MEM", TOTAL, 1);
 
 
 	starpu_conf_init(&conf);
 	starpu_conf_init(&conf);
+	starpu_conf_noworker(&conf);
 	conf.ncpus = 1;
 	conf.ncpus = 1;
-	conf.ncuda = 0;
-	conf.nopencl = 0;
-	conf.nmic = 0;
-	conf.nmpi_ms = 0;
 
 
         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;

+ 2 - 3
tests/disk/disk_copy.c

@@ -66,10 +66,9 @@ int dotest(struct starpu_disk_ops *ops, void *param)
 	if (ret == -EINVAL)
 	if (ret == -EINVAL)
 		return EXIT_FAILURE;
 		return EXIT_FAILURE;
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
+	starpu_conf_noworker(&conf);
 	conf.ncpus = 1;
 	conf.ncpus = 1;
-	conf.ncuda = 0;
-	conf.nopencl = 0;
-	conf.nmic = 0;
+	conf.nmpi_ms = -1;
 	ret = starpu_init(&conf);
 	ret = starpu_init(&conf);
 	if (ret == -ENODEV) goto enodev;
 	if (ret == -ENODEV) goto enodev;
 
 

+ 3 - 3
tests/disk/disk_copy_unpack.c

@@ -54,9 +54,9 @@ int dotest(struct starpu_disk_ops *ops, void *param)
 	if (ret == -EINVAL)
 	if (ret == -EINVAL)
 		return EXIT_FAILURE;
 		return EXIT_FAILURE;
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
-	conf.ncuda = 0;
-	conf.nopencl = 0;
-	conf.nmic = 0;
+	starpu_conf_noworker(&conf);
+	conf.ncpus = -1;
+	conf.nmpi_ms = -1;
 	ret = starpu_init(&conf);
 	ret = starpu_init(&conf);
 	if (ret == -ENODEV) goto enodev;
 	if (ret == -ENODEV) goto enodev;
 
 

+ 3 - 3
tests/disk/disk_pack.c

@@ -66,9 +66,9 @@ int dotest(struct starpu_disk_ops *ops, char *base)
 	if (ret == -EINVAL)
 	if (ret == -EINVAL)
 		return EXIT_FAILURE;
 		return EXIT_FAILURE;
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
-	conf.ncuda = 0;
-	conf.nopencl = 0;
-	conf.nmic = 0;
+	starpu_conf_noworker(&conf);
+	conf.ncpus = -1;
+	conf.nmpi_ms = -1;
 	ret = starpu_init(&conf);
 	ret = starpu_init(&conf);
 	if (ret == -ENODEV) goto enodev;
 	if (ret == -ENODEV) goto enodev;
 
 

+ 3 - 3
tests/disk/mem_reclaim.c

@@ -159,9 +159,9 @@ int dotest(struct starpu_disk_ops *ops, char *base, void (*vector_data_register)
 	if (ret == -EINVAL)
 	if (ret == -EINVAL)
 		return EXIT_FAILURE;
 		return EXIT_FAILURE;
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
-	conf.ncuda = 0;
-	conf.nopencl = 0;
-	conf.nmic = 0;
+	starpu_conf_noworker(&conf);
+	conf.ncpus = -1;
+	conf.nmpi_ms = -1;
 	ret = starpu_init(&conf);
 	ret = starpu_init(&conf);
 	if (ret == -ENODEV) goto enodev;
 	if (ret == -ENODEV) goto enodev;
 
 

+ 2 - 2
tests/energy/energy_efficiency.c

@@ -308,9 +308,9 @@ int main(int argc, char *argv[])
 	/* Initialize StarPU */
 	/* Initialize StarPU */
 	struct starpu_conf conf;
 	struct starpu_conf conf;
 	starpu_conf_init(&conf);
 	starpu_conf_init(&conf);
+	starpu_conf_noworker(&conf);
+	conf.ncpus = -1;
 
 
-	conf.ncuda = 0;
-	conf.nopencl = 0;
 	if (!getenv("STARPU_SCHED"))
 	if (!getenv("STARPU_SCHED"))
 		conf.sched_policy_name = "dmdas";
 		conf.sched_policy_name = "dmdas";
 
 

+ 2 - 2
tests/errorcheck/invalid_tasks.c

@@ -51,9 +51,9 @@ int main(void)
 	struct starpu_conf conf;
 	struct starpu_conf conf;
 	starpu_conf_init(&conf);
 	starpu_conf_init(&conf);
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
+	starpu_conf_noworker(&conf);
 	conf.ncpus = 1;
 	conf.ncpus = 1;
-	conf.nopencl = 0;
-	conf.ncuda = 0;
+	conf.nmpi_ms = -1;
 
 
 	ret = starpu_init(&conf);
 	ret = starpu_init(&conf);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;

+ 1 - 6
tests/errorcheck/starpu_init_noworker.c

@@ -33,12 +33,7 @@ int main(int argc, char **argv)
 	struct starpu_conf conf;
 	struct starpu_conf conf;
 	starpu_conf_init(&conf);
 	starpu_conf_init(&conf);
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
-	conf.ncpus = 0;
-	conf.ncuda = 0;
-	conf.nopencl = 0;
-        conf.nfpga = 0;
-	conf.nmic = 0;
-        conf.nmpi_ms = 0;
+	starpu_conf_noworker(&conf);
 
 
 	/* starpu_init should return -ENODEV */
 	/* starpu_init should return -ENODEV */
         ret = starpu_initialize(&conf, &argc, &argv);
         ret = starpu_initialize(&conf, &argc, &argv);

+ 2 - 4
tests/errorcheck/workers_cpuid.c

@@ -102,10 +102,8 @@ static int test_combination(long *combination, unsigned n)
 	struct starpu_conf conf;
 	struct starpu_conf conf;
 	starpu_conf_init(&conf);
 	starpu_conf_init(&conf);
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
-	conf.ncuda = 0;
-	conf.nopencl = 0;
-	conf.nmic = 0;
-	conf.nmpi_ms = 0;
+	starpu_conf_noworker(&conf);
+	conf.ncpus = -1;
 
 
 	ret = starpu_init(&conf);
 	ret = starpu_init(&conf);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;

+ 3 - 6
tests/main/driver_api/init_run_deinit.c

@@ -85,9 +85,8 @@ static int test_cpu(void)
 	};
 	};
 
 
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
+	starpu_conf_noworker(&conf);
 	conf.ncpus = 1;
 	conf.ncpus = 1;
-	conf.ncuda = 0;
-	conf.nopencl = 0;
 	conf.not_launched_drivers = &d;
 	conf.not_launched_drivers = &d;
 	conf.n_not_launched_drivers = 1;
 	conf.n_not_launched_drivers = 1;
 
 
@@ -145,9 +144,8 @@ static int test_cuda(void)
 	};
 	};
 
 
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
-	conf.ncpus = 0;
+	starpu_conf_noworker(&conf);
 	conf.ncuda = 1;
 	conf.ncuda = 1;
-	conf.nopencl = 0;
 	conf.not_launched_drivers = &d;
 	conf.not_launched_drivers = &d;
 	conf.n_not_launched_drivers = 1;
 	conf.n_not_launched_drivers = 1;
 
 
@@ -231,8 +229,7 @@ static int test_opencl(void)
 	};
 	};
 
 
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
-	conf.ncpus = 0;
-	conf.ncuda = 0;
+	starpu_conf_noworker(&conf);
 	conf.nopencl = 1;
 	conf.nopencl = 1;
 	conf.not_launched_drivers = &d;
 	conf.not_launched_drivers = &d;
 	conf.n_not_launched_drivers = 1;
 	conf.n_not_launched_drivers = 1;

+ 3 - 5
tests/main/driver_api/run_driver.c

@@ -73,9 +73,8 @@ static int test_cpu(void)
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
 	conf.n_not_launched_drivers = 1;
 	conf.n_not_launched_drivers = 1;
 	conf.not_launched_drivers = &d;
 	conf.not_launched_drivers = &d;
+	starpu_conf_noworker(&conf);
 	conf.ncpus = 1;
 	conf.ncpus = 1;
-	conf.ncuda = 0;
-	conf.nopencl = 0;
 	ret = starpu_init(&conf);
 	ret = starpu_init(&conf);
 	if (ret == -ENODEV || starpu_cpu_worker_get_count() == 0)
 	if (ret == -ENODEV || starpu_cpu_worker_get_count() == 0)
 	{
 	{
@@ -135,9 +134,8 @@ static int test_cuda(void)
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
 	conf.n_not_launched_drivers = 1;
 	conf.n_not_launched_drivers = 1;
 	conf.not_launched_drivers = &d;
 	conf.not_launched_drivers = &d;
-	conf.ncpus = 0;
+	starpu_conf_noworker(&conf);
 	conf.ncuda = 1;
 	conf.ncuda = 1;
-	conf.nopencl = 0;
 	ret = starpu_init(&conf);
 	ret = starpu_init(&conf);
 	if (ret == -ENODEV || starpu_cuda_worker_get_count() == 0)
 	if (ret == -ENODEV || starpu_cuda_worker_get_count() == 0)
 	{
 	{
@@ -225,8 +223,8 @@ static int test_opencl(void)
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
 	conf.n_not_launched_drivers = 1;
 	conf.n_not_launched_drivers = 1;
 	conf.not_launched_drivers = &d;
 	conf.not_launched_drivers = &d;
+	starpu_conf_noworker(&conf);
 	conf.ncpus = 1;
 	conf.ncpus = 1;
-	conf.ncuda = 0;
 	conf.nopencl = 1;
 	conf.nopencl = 1;
 	ret = starpu_init(&conf);
 	ret = starpu_init(&conf);
 	if (ret == -ENODEV || starpu_opencl_worker_get_count() == 0)
 	if (ret == -ENODEV || starpu_opencl_worker_get_count() == 0)

+ 3 - 8
tests/microbenchs/bandwidth.c

@@ -186,10 +186,7 @@ static float bench(int *argc, char ***argv, unsigned nbusy, unsigned ncpus, int
 
 
 	starpu_conf_init(&conf);
 	starpu_conf_init(&conf);
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
-	conf.ncuda = 0;
-	conf.nopencl = 0;
-	conf.nmic = 0;
-	conf.nmpi_ms = 0;
+	starpu_conf_noworker(&conf);
 	conf.ncpus = ncpus;
 	conf.ncpus = ncpus;
 
 
 	if (intl && sleep == PAUSE)
 	if (intl && sleep == PAUSE)
@@ -284,10 +281,8 @@ int main(int argc, char **argv)
 
 
 	starpu_conf_init(&conf);
 	starpu_conf_init(&conf);
 	conf.precedence_over_environment_variables = 1;
 	conf.precedence_over_environment_variables = 1;
-	conf.ncuda = 0;
-	conf.nopencl = 0;
-	conf.nmic = 0;
-	conf.nmpi_ms = 0;
+	starpu_conf_noworker(&conf);
+	conf.ncpus = -1;
 
 
 	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;

+ 2 - 2
tests/microbenchs/tasks_size_overhead.c

@@ -165,8 +165,8 @@ int main(int argc, char **argv)
 
 
 	/* Get number of CPUs */
 	/* Get number of CPUs */
 	starpu_conf_init(&conf);
 	starpu_conf_init(&conf);
-	conf.ncuda = 0;
-	conf.nopencl = 0;
+	starpu_conf_noworker(&conf);
+	conf.ncpus = -1;
 #ifdef STARPU_SIMGRID
 #ifdef STARPU_SIMGRID
 	/* This will get serialized, avoid spending too much time on it. */
 	/* This will get serialized, avoid spending too much time on it. */
 	maxcpus = 2;
 	maxcpus = 2;