Revert "[InstCombine] Support gep nuw in icmp folds" (#118698)
[llvm-project.git] / openmp / runtime / test / ompt / misc / api_calls_places.c
blob3385c9c62abf808f7aa298c48af5d723bc95c7fa
1 // RUN: %libomp-compile && env OMP_PLACES=cores %libomp-run | FileCheck %s
2 // REQUIRES: ompt, linux
3 #include "callback.h"
4 #include <omp.h>
5 #define __USE_GNU
6 #include <sched.h>
7 #undef __USE_GNU
9 void print_list(char *function_name, int size, int list[]) {
10 printf("%" PRIu64 ": %s(0)=(%d", ompt_get_thread_data()->value, function_name,
11 list[0]);
12 int i;
13 for (i = 1; i < size; i++) {
14 printf(",%d", list[i]);
16 printf(")\n");
19 int main() {
20 #pragma omp parallel num_threads(1)
22 printf("%" PRIu64 ": omp_get_num_places()=%d\n",
23 ompt_get_thread_data()->value, omp_get_num_places());
24 printf("%" PRIu64 ": ompt_get_num_places()=%d\n",
25 ompt_get_thread_data()->value, ompt_get_num_places());
27 int omp_ids_size = omp_get_place_num_procs(0);
28 int omp_ids[omp_ids_size];
29 omp_get_place_proc_ids(0, omp_ids);
30 print_list("omp_get_place_proc_ids", omp_ids_size, omp_ids);
31 int ompt_ids_size = ompt_get_place_proc_ids(0, 0, NULL);
32 int ompt_ids[ompt_ids_size];
33 ompt_get_place_proc_ids(0, ompt_ids_size, ompt_ids);
34 print_list("ompt_get_place_proc_ids", ompt_ids_size, ompt_ids);
36 printf("%" PRIu64 ": omp_get_place_num()=%d\n",
37 ompt_get_thread_data()->value, omp_get_place_num());
38 printf("%" PRIu64 ": ompt_get_place_num()=%d\n",
39 ompt_get_thread_data()->value, ompt_get_place_num());
41 int omp_nums_size = omp_get_partition_num_places();
42 int omp_nums[omp_nums_size];
43 omp_get_partition_place_nums(omp_nums);
44 print_list("omp_get_partition_place_nums", omp_nums_size, omp_nums);
45 int ompt_nums_size = ompt_get_partition_place_nums(0, omp_nums);
46 int ompt_nums[ompt_nums_size];
47 ompt_get_partition_place_nums(ompt_nums_size, ompt_nums);
48 print_list("ompt_get_partition_place_nums", ompt_nums_size, ompt_nums);
50 printf("%" PRIu64 ": sched_getcpu()=%d\n", ompt_get_thread_data()->value,
51 sched_getcpu());
52 printf("%" PRIu64 ": ompt_get_proc_id()=%d\n",
53 ompt_get_thread_data()->value, ompt_get_proc_id());
55 printf("%" PRIu64 ": omp_get_num_procs()=%d\n",
56 ompt_get_thread_data()->value, omp_get_num_procs());
57 printf("%" PRIu64 ": ompt_get_num_procs()=%d\n",
58 ompt_get_thread_data()->value, ompt_get_num_procs());
61 // Check if libomp supports the callbacks for this test.
63 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
65 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: omp_get_num_places
66 // CHECK-SAME: ()=[[NUM_PLACES:[0-9]+]]
67 // CHECK: {{^}}[[MASTER_ID]]: ompt_get_num_places()=[[NUM_PLACES]]
69 // CHECK: {{^}}[[MASTER_ID]]: omp_get_place_proc_ids
70 // CHECK-SAME: (0)=([[PROC_IDS:[0-9\,]+]])
71 // CHECK: {{^}}[[MASTER_ID]]: ompt_get_place_proc_ids(0)=([[PROC_IDS]])
73 // CHECK: {{^}}[[MASTER_ID]]: omp_get_place_num()=[[PLACE_NUM:[-]?[0-9]+]]
74 // CHECK: {{^}}[[MASTER_ID]]: ompt_get_place_num()=[[PLACE_NUM]]
76 // CHECK: {{^}}[[MASTER_ID]]: omp_get_partition_place_nums
77 // CHECK-SAME: (0)=([[PARTITION_PLACE_NUMS:[0-9\,]+]])
78 // CHECK: {{^}}[[MASTER_ID]]: ompt_get_partition_place_nums
79 // CHECK-SAME: (0)=([[PARTITION_PLACE_NUMS]])
81 // CHECK: {{^}}[[MASTER_ID]]: sched_getcpu()=[[CPU_ID:[0-9]+]]
82 // CHECK: {{^}}[[MASTER_ID]]: ompt_get_proc_id()=[[CPU_ID]]
84 // CHECK: {{^}}[[MASTER_ID]]: omp_get_num_procs()=[[NUM_PROCS:[-]?[0-9]+]]
85 // CHECK: {{^}}[[MASTER_ID]]: ompt_get_num_procs()=[[NUM_PROCS]]
87 return 0;