Explorar o código

openmp: do not do anything when there is no CPU worker

Nathalie Furmento %!s(int64=6) %!d(string=hai) anos
pai
achega
228da7a563
Modificáronse 36 ficheiros con 139 adicións e 89 borrados
  1. 35 21
      src/util/openmp_runtime_support.c
  2. 2 1
      tests/openmp/api_01.c
  3. 2 1
      tests/openmp/array_slice_01.c
  4. 2 1
      tests/openmp/cuda_task_01.c
  5. 2 1
      tests/openmp/environment.c
  6. 2 1
      tests/openmp/init_exit_01.c
  7. 2 1
      tests/openmp/init_exit_02.c
  8. 2 1
      tests/openmp/parallel_01.c
  9. 2 1
      tests/openmp/parallel_02.c
  10. 2 1
      tests/openmp/parallel_03.c
  11. 2 1
      tests/openmp/parallel_barrier_01.c
  12. 2 1
      tests/openmp/parallel_critical_01.c
  13. 2 1
      tests/openmp/parallel_critical_inline_01.c
  14. 2 1
      tests/openmp/parallel_critical_named_01.c
  15. 2 1
      tests/openmp/parallel_critical_named_inline_01.c
  16. 2 1
      tests/openmp/parallel_for_01.c
  17. 2 1
      tests/openmp/parallel_for_02.c
  18. 2 1
      tests/openmp/parallel_for_ordered_01.c
  19. 2 1
      tests/openmp/parallel_master_01.c
  20. 2 1
      tests/openmp/parallel_master_inline_01.c
  21. 2 1
      tests/openmp/parallel_nested_lock_01.c
  22. 2 1
      tests/openmp/parallel_sections_01.c
  23. 2 1
      tests/openmp/parallel_sections_combined_01.c
  24. 2 1
      tests/openmp/parallel_simple_lock_01.c
  25. 2 1
      tests/openmp/parallel_single_copyprivate_01.c
  26. 2 1
      tests/openmp/parallel_single_copyprivate_inline_01.c
  27. 2 1
      tests/openmp/parallel_single_inline_01.c
  28. 2 1
      tests/openmp/parallel_single_nowait_01.c
  29. 2 1
      tests/openmp/parallel_single_wait_01.c
  30. 2 1
      tests/openmp/task_01.c
  31. 3 2
      tests/openmp/task_02.c
  32. 2 1
      tests/openmp/task_03.c
  33. 2 1
      tests/openmp/taskgroup_01.c
  34. 2 1
      tests/openmp/taskgroup_02.c
  35. 34 32
      tests/openmp/taskloop.c
  36. 3 2
      tests/openmp/taskwait_01.c

+ 35 - 21
src/util/openmp_runtime_support.c

@@ -731,7 +731,7 @@ static void destroy_omp_task_struct(struct starpu_omp_task *task)
 /*
  * setup the main application thread to handle the possible preemption of the initial task
  */
-static void omp_initial_thread_setup(void)
+static int omp_initial_thread_setup(void)
 {
 	struct starpu_omp_thread *initial_thread = _global_state.initial_thread;
 	struct starpu_omp_task *initial_task = _global_state.initial_task;
@@ -766,22 +766,28 @@ static void omp_initial_thread_setup(void)
 	omp_starpu_conf.n_not_launched_drivers = 1;
 	/* we are now ready to start StarPU */
 	ret = starpu_init(&omp_starpu_conf);
-	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
-	ret = starpu_driver_init(&initial_thread->starpu_driver);
-	STARPU_CHECK_RETURN_VALUE(ret, "starpu_driver_init");
-	_starpu_omp_set_task(initial_task);
-
-	_global_state.nb_starpu_cpu_workers = starpu_worker_get_count_by_type(STARPU_CPU_WORKER);
-	_STARPU_MALLOC(_global_state.starpu_cpu_worker_ids, _global_state.nb_starpu_cpu_workers * sizeof(int));
-	if (_global_state.starpu_cpu_worker_ids == NULL)
-		_STARPU_ERROR("memory allocation failed");
-	ret = starpu_worker_get_ids_by_type(STARPU_CPU_WORKER, _global_state.starpu_cpu_worker_ids, _global_state.nb_starpu_cpu_workers);
-	STARPU_ASSERT(ret == _global_state.nb_starpu_cpu_workers);
-	initial_thread->worker = _starpu_get_worker_struct(_global_state.starpu_cpu_worker_ids[0]);
-	STARPU_ASSERT(initial_thread->worker);
-	STARPU_ASSERT(initial_thread->worker->arch == STARPU_CPU_WORKER);
-	_starpu_omp_set_thread(initial_thread);
-	register_thread_worker(initial_thread);
+	if (starpu_cpu_worker_get_count() == 0)
+		return -ENODEV;
+	else
+	{
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
+		ret = starpu_driver_init(&initial_thread->starpu_driver);
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_driver_init");
+		_starpu_omp_set_task(initial_task);
+
+		_global_state.nb_starpu_cpu_workers = starpu_worker_get_count_by_type(STARPU_CPU_WORKER);
+		_STARPU_MALLOC(_global_state.starpu_cpu_worker_ids, _global_state.nb_starpu_cpu_workers * sizeof(int));
+		if (_global_state.starpu_cpu_worker_ids == NULL)
+			_STARPU_ERROR("memory allocation failed");
+		ret = starpu_worker_get_ids_by_type(STARPU_CPU_WORKER, _global_state.starpu_cpu_worker_ids, _global_state.nb_starpu_cpu_workers);
+		STARPU_ASSERT(ret == _global_state.nb_starpu_cpu_workers);
+		initial_thread->worker = _starpu_get_worker_struct(_global_state.starpu_cpu_worker_ids[0]);
+		STARPU_ASSERT(initial_thread->worker);
+		STARPU_ASSERT(initial_thread->worker->arch == STARPU_CPU_WORKER);
+		_starpu_omp_set_thread(initial_thread);
+		register_thread_worker(initial_thread);
+		return 0;
+	}
 }
 
 static void omp_initial_thread_exit()
@@ -802,12 +808,15 @@ static void omp_initial_thread_exit()
 	initial_thread->current_task = NULL;
 }
 
-static void omp_initial_region_setup(void)
+static int omp_initial_region_setup(void)
 {
-	omp_initial_thread_setup();
+	int ret = omp_initial_thread_setup();
+	if (ret == -ENODEV)
+		return ret;
+
 	const int max_active_levels = _starpu_omp_initial_icv_values->max_active_levels_var;
 	const int max_threads = (int)starpu_cpu_worker_get_count();
-	
+
 	/* implementation specific initial ICV values override */
 	if (_starpu_omp_initial_icv_values->nthreads_var[0] == 0)
 	{
@@ -881,6 +890,7 @@ static void omp_initial_region_setup(void)
 	_global_state.initial_region->icvs.default_device_var = _starpu_omp_initial_icv_values->default_device_var;
 	_global_state.initial_region->icvs.max_task_priority_var = _starpu_omp_initial_icv_values->max_task_priority_var;
 	_global_state.initial_region->implicit_task_array = &_global_state.initial_task;
+	return 0;
 }
 
 static void omp_initial_region_exit(void)
@@ -955,7 +965,9 @@ int starpu_omp_init(void)
 
 	_starpu_omp_environment_init();
 	_global_state.icvs.cancel_var = _starpu_omp_initial_icv_values->cancel_var;
-	omp_initial_region_setup();
+	int ret = omp_initial_region_setup();
+	if (ret == -ENODEV)
+		return ret;
 
 	/* init clock reference for starpu_omp_get_wtick */
 	_starpu_omp_clock_ref = starpu_timing_now();
@@ -965,6 +977,8 @@ int starpu_omp_init(void)
 
 void starpu_omp_shutdown(void)
 {
+	if (starpu_cpu_worker_get_count() == 0) return;
+
 	omp_initial_region_exit();
 	/* TODO: free ICV variables */
 	/* TODO: free task/thread/region/device structures */

+ 2 - 1
tests/openmp/api_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -51,6 +51,7 @@ static void omp_constructor(void)
 	unsetenv("OMP_PLACES");
 	unsetenv("OMP_DISPLAY_ENV");
 	ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/array_slice_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2015,2017                                CNRS
+ * Copyright (C) 2015,2017,2019                           CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -38,6 +38,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/cuda_task_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2015,2017                                CNRS
+ * Copyright (C) 2015,2017,2019                           CNRS
  * Copyright (C) 2014-2016                                Inria
  * Copyright (C) 2017,2019                                Université de Bordeaux
  *
@@ -39,6 +39,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/environment.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -48,6 +48,7 @@ main (void)
 	setenv("OMP_PLACES","{1,2,3,4},{5,6,7,8}", 1);
 	setenv("OMP_DISPLAY_ENV","verbose", 1);
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 	starpu_omp_shutdown();
 	return 0;

+ 2 - 1
tests/openmp/init_exit_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -33,6 +33,7 @@ int
 main (void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 	starpu_omp_shutdown();
 	return 0;

+ 2 - 1
tests/openmp/init_exit_02.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -33,6 +33,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_02.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_03.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_barrier_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_critical_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_critical_inline_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_critical_named_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_critical_named_inline_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_for_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -39,6 +39,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_for_02.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -37,6 +37,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_for_ordered_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -39,6 +39,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_master_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_master_inline_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_nested_lock_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_sections_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_sections_combined_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_simple_lock_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_single_copyprivate_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_single_copyprivate_inline_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_single_inline_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_single_nowait_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/parallel_single_wait_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/task_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 3 - 2
tests/openmp/task_02.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -38,6 +38,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 
@@ -72,7 +73,7 @@ void task_region_g(void *buffers[], void *args)
 	int nx = STARPU_VECTOR_GET_NX(_vector);
 	int *v = (int *)STARPU_VECTOR_GET_PTR(_vector);
 	int f = (int)(intptr_t)args;
-	
+
 	printf("depth 1 task, entry: vector ptr = %p\n", v);
 
 	{

+ 2 - 1
tests/openmp/task_03.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2017                                     CNRS
+ * Copyright (C) 2017,2019                                CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/taskgroup_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 2 - 1
tests/openmp/taskgroup_02.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 

+ 34 - 32
tests/openmp/taskloop.c

@@ -32,56 +32,58 @@ int main(void)
 __attribute__((constructor))
 static void omp_constructor(void)
 {
-   int ret = starpu_omp_init();
-   STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
+	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 
 __attribute__((destructor))
 static void omp_destructor(void)
 {
-   starpu_omp_shutdown();
+	starpu_omp_shutdown();
 }
 
-void taskloop_callback(unsigned long long begin_i, unsigned long long end_i) {
-   int worker_id;
-   pthread_t tid;
-   tid = pthread_self();
-   worker_id = starpu_worker_get_id();
-   printf ("begin = %llu , end = %llu, %p\n", begin_i, end_i, (void *)starpu_task_get_current());
+void taskloop_callback(unsigned long long begin_i, unsigned long long end_i)
+{
+	int worker_id;
+	pthread_t tid;
+	tid = pthread_self();
+	worker_id = starpu_worker_get_id();
+	printf ("begin = %llu , end = %llu, %p\n", begin_i, end_i, (void *)starpu_task_get_current());
 }
 
 void taskloop_callback_wrapper(void *buffers[], void *_args)
 {
-   (void) buffers;
-   struct starpu_omp_task_region_attr * args = _args;
-   taskloop_callback(args->begin_i, args->end_i);
+	(void) buffers;
+	struct starpu_omp_task_region_attr * args = _args;
+	taskloop_callback(args->begin_i, args->end_i);
 }
 
 int
 main (void)
 {
-   struct starpu_omp_task_region_attr attr;
-   memset(&attr, 0, sizeof(attr));
+	struct starpu_omp_task_region_attr attr;
+	memset(&attr, 0, sizeof(attr));
 #ifdef STARPU_SIMGRID
-   attr.cl.model         = &starpu_perfmodel_nop;
+	attr.cl.model         = &starpu_perfmodel_nop;
 #endif
-   attr.cl.flags         = STARPU_CODELET_SIMGRID_EXECUTE;
-   attr.cl.cpu_funcs[0]  = taskloop_callback_wrapper;
-   attr.cl_arg           = &attr;
-   attr.cl.where         = STARPU_CPU;
-   attr.if_clause        = 1;
-   attr.final_clause     = 0;
-   attr.untied_clause    = 1;
-   attr.mergeable_clause = 0;
-   attr.nogroup_clause   = 0;
-   attr.is_loop          = 0;
-   attr.collapse         = 0;
-   attr.num_tasks        = 5;
-   attr.nb_iterations    = 400;
-   attr.grainsize        = 130;
+	attr.cl.flags         = STARPU_CODELET_SIMGRID_EXECUTE;
+	attr.cl.cpu_funcs[0]  = taskloop_callback_wrapper;
+	attr.cl_arg           = &attr;
+	attr.cl.where         = STARPU_CPU;
+	attr.if_clause        = 1;
+	attr.final_clause     = 0;
+	attr.untied_clause    = 1;
+	attr.mergeable_clause = 0;
+	attr.nogroup_clause   = 0;
+	attr.is_loop          = 0;
+	attr.collapse         = 0;
+	attr.num_tasks        = 5;
+	attr.nb_iterations    = 400;
+	attr.grainsize        = 130;
 
-   starpu_omp_taskloop_inline_begin(&attr);
-   starpu_omp_taskloop_inline_end(&attr);
-   return 0;
+	starpu_omp_taskloop_inline_begin(&attr);
+	starpu_omp_taskloop_inline_end(&attr);
+	return 0;
 }
 #endif

+ 3 - 2
tests/openmp/taskwait_01.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014,2015,2017                           CNRS
+ * Copyright (C) 2014,2015,2017,2019                      CNRS
  * Copyright (C) 2014,2016                                Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -35,6 +35,7 @@ __attribute__((constructor))
 static void omp_constructor(void)
 {
 	int ret = starpu_omp_init();
+	if (ret == -ENODEV) exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_omp_init");
 }
 
@@ -67,7 +68,7 @@ void parallel_region_f(void *buffers[], void *args)
 	tid = pthread_self();
 	worker_id = starpu_worker_get_id();
 	printf("[tid %p] task thread = %d: implicit task \"f\"\n", (void *)tid, worker_id);
-	
+
 	memset(&attr, 0, sizeof(attr));
 #ifdef STARPU_SIMGRID
 	attr.cl.model         = &starpu_perfmodel_nop;