1 // RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true %libomp-run | %python %S/check.py -c 'CHECK' %s 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 #include <omp.h> 6 main(int argc,char ** argv)7int main(int argc, char** argv) { 8 omp_set_affinity_format("TESTER: tl:%L tn:%n nt:%N"); 9 // should print all for first parallel 10 omp_set_num_threads(4); 11 #pragma omp parallel 12 { } 13 // should print all because of new threads 14 omp_set_num_threads(8); 15 #pragma omp parallel 16 { } 17 // should not print anything here 18 omp_set_num_threads(6); 19 #pragma omp parallel 20 { } 21 // should print all because of new thread 22 omp_set_num_threads(9); 23 #pragma omp parallel 24 { } 25 // should not print anything here 26 omp_set_num_threads(2); 27 #pragma omp parallel 28 { } 29 return 0; 30 } 31 32 // CHECK: num_threads=4 TESTER: tl:1 tn:[0-3] nt:4 33 // CHECK: num_threads=8 TESTER: tl:1 tn:[0-7] nt:8 34 // CHECK: num_threads=6 TESTER: tl:1 tn:[0-5] nt:6 35 // CHECK: num_threads=9 TESTER: tl:1 tn:[0-8] nt:9 36 // CHECK: num_threads=2 TESTER: tl:1 tn:[01] nt:2 37