1 // Run lines are in the target specific versions.
9 int Result[N], NumThreads;
11 #pragma omp target teams num_teams(1) thread_limit(N) \
12 ompx_dyn_cgroup_mem(N * sizeof(Result[0])) \
13 map(from : Result, NumThreads)
18 int *DynBuffer = (int *)llvm_omp_target_dynamic_shared_alloc();
19 int TId = omp_get_thread_num();
21 NumThreads = omp_get_num_threads();
25 int WrappedTId = (TId + 37) % NumThreads;
26 Result[TId] = Buffer[WrappedTId] + DynBuffer[WrappedTId];
30 if (llvm_omp_target_dynamic_shared_alloc())
33 if (NumThreads < N / 2 || NumThreads > N) {
34 printf("Expected number of threads to be in [%i:%i], but got: %i", N / 2, N,
40 for (int i = 0; i < NumThreads; ++i) {
41 if (Result[i] != 7 + 3) {
42 printf("Result[%i] is %i, expected %i\n", i, Result[i], 7 + 3);