Ver código fonte

openmp: add omp_get_max_task_priority() routine

The omp_get_max_task_priority routine returns the maximum value that can
be specified in the priority clause. This is part of OpenMP 4.5.
Samuel Pitoiset 9 anos atrás
pai
commit
f18d4a5528

+ 5 - 0
doc/doxygen/chapters/api/openmp_runtime_support.doxy

@@ -802,6 +802,11 @@ This function returns the team number of the calling thread.
 \ingroup API_OpenMP_Runtime_Support
 This function checks whether the current device is the initial device or not.
 
+\fn int starpu_omp_get_max_task_priority
+\ingroup API_OpenMP_Runtime_Support
+The omp_get_max_task_priority routine returns the maximum value that can be
+specified in the priority clause.
+
 \return <c>!0</c> if called from the host device.
 \return <c>0</c> otherwise.
 

+ 1 - 0
include/starpu_openmp.h

@@ -147,6 +147,7 @@ extern int starpu_omp_get_num_devices(void) __STARPU_OMP_NOTHROW;
 extern int starpu_omp_get_num_teams(void) __STARPU_OMP_NOTHROW;
 extern int starpu_omp_get_team_num(void) __STARPU_OMP_NOTHROW;
 extern int starpu_omp_is_initial_device(void) __STARPU_OMP_NOTHROW;
+extern int starpu_omp_get_max_task_priority(void) __STARPU_OMP_NOTHROW;
 extern void starpu_omp_init_lock(starpu_omp_lock_t *lock) __STARPU_OMP_NOTHROW;
 extern void starpu_omp_destroy_lock(starpu_omp_lock_t *lock) __STARPU_OMP_NOTHROW;
 extern void starpu_omp_set_lock(starpu_omp_lock_t *lock) __STARPU_OMP_NOTHROW;

+ 6 - 0
src/util/openmp_runtime_support_omp_api.c

@@ -257,6 +257,12 @@ int starpu_omp_is_initial_device(void)
 	return device == _starpu_omp_global_state->initial_device;
 }
 
+int starpu_omp_get_max_task_priority(void)
+{
+	const struct starpu_omp_region * const parallel_region = _starpu_omp_get_task()->owner_region;
+	return parallel_region->icvs.max_task_priority_var;
+}
+
 double starpu_omp_get_wtime (void)
 {
 	return 1e-6 * (starpu_timing_now() - _starpu_omp_clock_ref);

+ 2 - 0
tests/openmp/api_01.c

@@ -40,6 +40,7 @@ static void omp_constructor(void)
 	unsetenv("OMP_MAX_ACTIVE_LEVELS");
 	unsetenv("OMP_CANCELLATION");
 	unsetenv("OMP_DEFAULT_DEVICE");
+	unsetenv("OMP_MAX_TASK_PRIORITY");
 	unsetenv("OMP_PROC_BIND");
 	unsetenv("OMP_NUM_THREADS");
 	unsetenv("OMP_PLACES");
@@ -130,6 +131,7 @@ main (int argc, char *argv[])
 	check_omp_func(starpu_omp_get_num_teams, 1);
 	check_omp_func(starpu_omp_get_team_num, 0);
 	check_omp_func(starpu_omp_is_initial_device, 1);
+	check_omp_func(starpu_omp_get_max_task_priority, 0);
 	return 0;
 }
 #endif