瀏覽代碼

tests/main/driver_api: unset environment variables as we want to force the number of workers

Nathalie Furmento 8 年之前
父節點
當前提交
857811a387
共有 2 個文件被更改,包括 34 次插入6 次删除
  1. 19 6
      tests/main/driver_api/init_run_deinit.c
  2. 15 0
      tests/main/driver_api/run_driver.c

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

@@ -18,6 +18,14 @@
 
 #include "../../helper.h"
 
+#if !defined(STARPU_HAVE_UNSETENV)
+#warning unsetenv is not defined. Skipping test
+int main(int argc, char **argv)
+{
+	return STARPU_TEST_SKIPPED;
+}
+#else
+
 #define NTASKS 8
 
 #if defined(STARPU_USE_CPU) || defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL)
@@ -69,8 +77,7 @@ deinit_driver(struct starpu_driver *d)
 #endif /* STARPU_USE_CPU || STARPU_USE_CUDA || STARPU_USE_OPENCL */
 
 #ifdef STARPU_USE_CPU
-static int
-test_cpu(void)
+static int test_cpu(void)
 {
 	int var = 0, ret, ncpu;
 	struct starpu_conf conf;
@@ -129,8 +136,7 @@ test_cpu(void)
 #endif /* STARPU_USE_CPU */
 
 #ifdef STARPU_USE_CUDA
-static int
-test_cuda(void)
+static int test_cuda(void)
 {
 	int var = 0, ret, ncuda;
 	struct starpu_conf conf;
@@ -189,8 +195,7 @@ test_cuda(void)
 #endif /* STARPU_USE_CUDA */
 
 #ifdef STARPU_USE_OPENCL
-static int
-test_opencl(void)
+static int test_opencl(void)
 {
         cl_int err;
         cl_platform_id platform;
@@ -251,6 +256,8 @@ test_opencl(void)
 		return STARPU_TEST_SKIPPED;
 	}
 
+	starpu_topology_print(stdout);
+
 	init_driver(&d);
 	int i;
 	for (i = 0; i < NTASKS; i++)
@@ -279,6 +286,11 @@ int main(void)
 {
 	int ret = STARPU_TEST_SKIPPED;
 
+	// Ignore environment variables as we want to force the exact number of workers
+	unsetenv("STARPU_NCUDA");
+	unsetenv("STARPU_NOPENCL");
+	unsetenv("STARPU_NCPUS");
+
 #ifdef STARPU_USE_CPU
 	ret = test_cpu();
 	if (ret == 1)
@@ -297,3 +309,4 @@ int main(void)
 
 	return ret;
 }
+#endif

+ 15 - 0
tests/main/driver_api/run_driver.c

@@ -19,6 +19,14 @@
 
 #include "../../helper.h"
 
+#if !defined(STARPU_HAVE_UNSETENV)
+#warning unsetenv is not defined. Skipping test
+int main(int argc, char **argv)
+{
+	return STARPU_TEST_SKIPPED;
+}
+#else
+
 /*
  * Users can directly control drivers by using the starpu_driver* functions.
  *
@@ -260,6 +268,12 @@ out:
 int main(void)
 {
 	int ret = STARPU_TEST_SKIPPED;
+
+	// Ignore environment variables as we want to force the exact number of workers
+	unsetenv("STARPU_NCUDA");
+	unsetenv("STARPU_NOPENCL");
+	unsetenv("STARPU_NCPUS");
+
 #ifdef STARPU_USE_CPU
 	ret = test_cpu();
 	if (ret == 1)
@@ -277,3 +291,4 @@ int main(void)
 #endif
 	return ret;
 }
+#endif