Files
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
libcxx
libcxxabi
libunwind
lld
lldb
llvm
openmp
cmake
libomptarget
offload
runtime
cmake
doc
src
test
api
atomic
barrier
critical
env
flush
lock
master
misc_bugs
ompt
parallel
omp_nested.c
omp_parallel_copyin.c
omp_parallel_default.c
omp_parallel_firstprivate.c
omp_parallel_if.c
omp_parallel_num_threads.c
omp_parallel_private.c
omp_parallel_reduction.c
omp_parallel_shared.c
tasking
threadprivate
worksharing
CMakeLists.txt
lit.cfg
lit.site.cfg.in
omp_my_sleep.h
omp_testsuite.h
tools
.clang-format
CMakeLists.txt
README.txt
www
.arcconfig
.gitignore
CMakeLists.txt
CREDITS.txt
LICENSE.txt
README.rst
polly
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mk
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h

47 lines
722 B
C
Raw Normal View History

// RUN: %libomp-compile-and-run
#include <stdio.h>
#include "omp_testsuite.h"
/*
* Test if the compiler supports nested parallelism
* By Chunhua Liao, University of Houston
* Oct. 2005
*/
int test_omp_nested()
{
#ifdef _OPENMP
if (omp_get_max_threads() > 4)
omp_set_num_threads(4);
#endif
int counter = 0;
#ifdef _OPENMP
omp_set_nested(1);
#endif
#pragma omp parallel shared(counter)
{
#pragma omp critical
counter++;
#pragma omp parallel
{
#pragma omp critical
counter--;
}
}
return (counter != 0);
}
int main()
{
int i;
int num_failed=0;
for(i = 0; i < REPETITIONS; i++) {
if(!test_omp_nested()) {
num_failed++;
}
}
return num_failed;
}