Browse Source

openmp: do not make _starpu_omp_get_region_thread_num() static

This will be useful for implementing OMPT.
Samuel Pitoiset 8 years ago
parent
commit
bedd2bef1b

+ 12 - 0
src/util/openmp_runtime_support.c

@@ -99,6 +99,18 @@ struct starpu_omp_region *_starpu_omp_get_region_at_level(int level)
 	return parallel_region;
 }
 
+int _starpu_omp_get_region_thread_num(const struct starpu_omp_region * const region)
+{
+	struct starpu_omp_thread *thread = _starpu_omp_get_thread();
+	STARPU_ASSERT(thread != NULL);
+	if (thread == region->master_thread)
+		return 0;
+	int tid = starpu_omp_thread_list_member(&region->thread_list, thread);
+	if (tid >= 0)
+		return tid+1;
+	_STARPU_ERROR("unrecognized omp thread\n");
+}
+
 static void weak_task_lock(struct starpu_omp_task *task)
 {
 	_starpu_spin_lock(&task->lock);

+ 1 - 0
src/util/openmp_runtime_support.h

@@ -395,6 +395,7 @@ void _starpu_omp_environment_exit(void);
 struct starpu_omp_thread *_starpu_omp_get_thread(void);
 struct starpu_omp_region *_starpu_omp_get_region_at_level(int level);
 struct starpu_omp_task *_starpu_omp_get_task(void);
+int _starpu_omp_get_region_thread_num(const struct starpu_omp_region *const region);
 void _starpu_omp_dummy_init(void);
 void _starpu_omp_dummy_shutdown(void);
 #endif // STARPU_OPENMP

+ 0 - 14
src/util/openmp_runtime_support_omp_api.c

@@ -40,20 +40,6 @@ int starpu_omp_get_num_threads()
 	return region->nb_threads;
 }
 
-static int _starpu_omp_get_region_thread_num(const struct starpu_omp_region * const region)
-{
-	struct starpu_omp_thread *thread = _starpu_omp_get_thread();
-	STARPU_ASSERT(thread != NULL);
-	if (thread == region->master_thread)
-		return 0;
-	int tid = starpu_omp_thread_list_member(&region->thread_list, thread);
-	if (tid < 0)
-	{
-		_STARPU_ERROR("unrecognized omp thread\n");
-	}
-	return tid+1;
-}
-
 int starpu_omp_get_thread_num()
 {
 	struct starpu_omp_task *task = _starpu_omp_get_task();