Browse Source

tests: fix tests when there is only mpi master slave workers

Nathalie Furmento 4 years ago
parent
commit
c149c664ab

+ 5 - 0
tests/datawizard/increment_redux_lazy.c

@@ -218,6 +218,11 @@ int main(int argc, char **argv)
 	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
+	if (starpu_cpu_worker_get_count() + starpu_cuda_worker_get_count() + starpu_opencl_worker_get_count() == 0)
+	{
+		starpu_shutdown();
+		return STARPU_TEST_SKIPPED;
+	}
 
 	starpu_variable_data_register(&handle, -1, (uintptr_t)NULL, sizeof(unsigned));
 

+ 11 - 2
tests/disk/disk_compute.c

@@ -44,8 +44,17 @@ int dotest(struct starpu_disk_ops *ops, char *base)
 	int *A, *C;
 
 	/* Initialize StarPU with default configuration */
-	int ret = starpu_init(NULL);
-
+	/* Initialize StarPU without GPU devices to make sure the memory of the GPU devices will not be used */
+	// Ignore environment variables as we want to force the exact number of workers
+	struct starpu_conf conf;
+	int ret = starpu_conf_init(&conf);
+	if (ret == -EINVAL)
+		return EXIT_FAILURE;
+	conf.precedence_over_environment_variables = 1;
+	starpu_conf_noworker(&conf);
+	conf.ncpus = 1;
+	conf.nmpi_ms = 0;
+	ret = starpu_init(&conf);
 	if (ret == -ENODEV) goto enodev;
 
 	/* Initialize path and name */

+ 1 - 1
tests/disk/disk_copy.c

@@ -68,7 +68,7 @@ int dotest(struct starpu_disk_ops *ops, void *param)
 	conf.precedence_over_environment_variables = 1;
 	starpu_conf_noworker(&conf);
 	conf.ncpus = 1;
-	conf.nmpi_ms = -1;
+	conf.nmpi_ms = 0;
 	ret = starpu_init(&conf);
 	if (ret == -ENODEV) goto enodev;
 

+ 5 - 0
tests/helper/starpu_data_cpy.c

@@ -30,6 +30,11 @@ int main(int argc, char **argv)
 	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
+	if (starpu_cpu_worker_get_count() + starpu_cuda_worker_get_count() + starpu_opencl_worker_get_count() == 0)
+	{
+		starpu_shutdown();
+		return STARPU_TEST_SKIPPED;
+	}
 
 	var1 = 42;
 	var2 = 12;

+ 5 - 0
tests/helper/starpu_data_dup_ro.c

@@ -31,6 +31,11 @@ int main(int argc, char **argv)
 	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
+	if (starpu_cpu_worker_get_count() + starpu_cuda_worker_get_count() + starpu_opencl_worker_get_count() == 0)
+	{
+		starpu_shutdown();
+		return STARPU_TEST_SKIPPED;
+	}
 
 	var1 = 42;