1// clang-format off
2// RUN: %libomptarget-compile-generic
3// RUN: env LIBOMPTARGET_INFO=16 \
4// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefix=DEFAULT
5
6// UNSUPPORTED: nvptx64-nvidia-cuda
7// UNSUPPORTED: nvptx64-nvidia-cuda-LTO
8// REQUIRES: gpu
9
10int main() {
11 int n = 1 << 20;
12 int th = 12;
13 int te = n / th;
14// DEFAULT: 12 (MaxFlatWorkGroupSize:
15#pragma omp target
16#pragma omp teams loop num_teams(te), thread_limit(th)
17 for (int i = 0; i < n; i++) {
18 }
19
20// DEFAULT: 13 (MaxFlatWorkGroupSize:
21 #pragma omp target
22 #pragma omp teams distribute parallel for simd num_teams(te), thread_limit(th+1) simdlen(64)
23 for(int i = 0; i < n; i++) {
24 }
25 return 0;
26}
27

Provided by KDAB

Privacy Policy
Update your C++ knowledge – Modern C++11/14/17 Training
Find out more

source code of offload/test/offloading/thread_limit.c