-/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2024 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU Offloading and Multi Processing Library
#include "gomp-constants.h"
#include <limits.h>
+ialias_redirect (omp_get_active_level)
+
void
omp_set_num_threads (int n)
{
omp_set_nested (int val)
{
struct gomp_task_icv *icv = gomp_icv (true);
- icv->nest_var = val;
+ if (val)
+ icv->max_active_levels_var = gomp_supported_active_levels;
+ else if (icv->max_active_levels_var > 1)
+ icv->max_active_levels_var = 1;
}
int
omp_get_nested (void)
{
struct gomp_task_icv *icv = gomp_icv (false);
- return icv->nest_var;
+ return (icv->max_active_levels_var > 1
+ && icv->max_active_levels_var > omp_get_active_level ());
}
#pragma GCC diagnostic pop
{
if (max_levels >= 0)
{
+ struct gomp_task_icv *icv = gomp_icv (true);
+
if (max_levels <= gomp_supported_active_levels)
- gomp_max_active_levels_var = max_levels;
+ icv->max_active_levels_var = max_levels;
else
- gomp_max_active_levels_var = gomp_supported_active_levels;
+ icv->max_active_levels_var = gomp_supported_active_levels;
}
}
int
omp_get_max_active_levels (void)
{
- return gomp_max_active_levels_var;
+ struct gomp_task_icv *icv = gomp_icv (false);
+ return icv->max_active_levels_var;
}
int