[Openmp-commits] [PATCH] D42162: [OMPT] Update api_calls testcase
Simon Convent via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Feb 14 04:43:59 PST 2018
sconvent updated this revision to Diff 134197.
sconvent edited the summary of this revision.
sconvent added a comment.
Check `ompt_get_partition_place_nums()`.
Fix small bug in implementation of `ompt_get_partition_place_nums()`: return correct length.
https://reviews.llvm.org/D42162
Files:
runtime/src/ompt-general.cpp
runtime/test/ompt/misc/api_calls.c
Index: runtime/test/ompt/misc/api_calls.c
===================================================================
--- runtime/test/ompt/misc/api_calls.c
+++ runtime/test/ompt/misc/api_calls.c
@@ -6,11 +6,11 @@
#include <sched.h>
#undef __USE_GNU
-void print_list(char* function_name, int list[])
+void print_list(char* function_name, int size, int list[])
{
printf("%" PRIu64 ": %s(0)=(%d", ompt_get_thread_data()->value, function_name, list[0]);
int i;
- for(i = 1; i < omp_get_place_num_procs(0); i++)
+ for(i = 1; i < size; i++)
{
printf(",%d", list[i]);
}
@@ -24,22 +24,26 @@
printf("%" PRIu64 ": omp_get_num_places()=%d\n", ompt_get_thread_data()->value, omp_get_num_places());
printf("%" PRIu64 ": ompt_get_num_places()=%d\n", ompt_get_thread_data()->value, ompt_get_num_places());
- int omp_ids[omp_get_place_num_procs(0)];
+ int omp_ids_size = omp_get_place_num_procs(0);
+ int omp_ids[omp_ids_size];
omp_get_place_proc_ids(0, omp_ids);
- print_list("omp_get_place_proc_ids" ,omp_ids);
- int ompt_ids[omp_get_place_num_procs(0)];
- ompt_get_place_proc_ids(0, omp_get_place_num_procs(0), ompt_ids);
- print_list("ompt_get_place_proc_ids", ompt_ids);
+ print_list("omp_get_place_proc_ids", omp_ids_size, omp_ids);
+ int ompt_ids_size = ompt_get_place_proc_ids(0, 0, NULL);
+ int ompt_ids[ompt_ids_size];
+ ompt_get_place_proc_ids(0, ompt_ids_size, ompt_ids);
+ print_list("ompt_get_place_proc_ids", ompt_ids_size, ompt_ids);
printf("%" PRIu64 ": omp_get_place_num()=%d\n", ompt_get_thread_data()->value, omp_get_place_num());
printf("%" PRIu64 ": ompt_get_place_num()=%d\n", ompt_get_thread_data()->value, ompt_get_place_num());
- int omp_nums[omp_get_partition_num_places()];
+ int omp_nums_size = omp_get_partition_num_places();
+ int omp_nums[omp_nums_size];
omp_get_partition_place_nums(omp_nums);
- print_list("omp_get_partition_place_nums" ,omp_nums);
- int ompt_nums[omp_get_partition_num_places()];
- ompt_get_partition_place_nums(omp_get_partition_num_places(), ompt_nums);
- print_list("ompt_get_partition_place_nums", ompt_nums);
+ print_list("omp_get_partition_place_nums", omp_nums_size, omp_nums);
+ int ompt_nums_size = ompt_get_partition_place_nums(0, NULL);
+ int ompt_nums[ompt_nums_size];
+ ompt_get_partition_place_nums(ompt_nums_size, ompt_nums);
+ print_list("ompt_get_partition_place_nums", ompt_nums_size, ompt_nums);
printf("%" PRIu64 ": sched_getcpu()=%d\n", ompt_get_thread_data()->value, sched_getcpu());
printf("%" PRIu64 ": ompt_get_proc_id()=%d\n", ompt_get_thread_data()->value, ompt_get_proc_id());
@@ -61,6 +65,9 @@
// CHECK: {{^}}[[MASTER_ID]]: omp_get_place_num()=[[PLACE_NUM:[-]?[0-9]+]]
// CHECK: {{^}}[[MASTER_ID]]: ompt_get_place_num()=[[PLACE_NUM]]
+ // CHECK: {{^}}[[MASTER_ID]]: omp_get_partition_place_nums(0)=([[PARTITION_PLACE_NUMS:[0-9\,]+]])
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_partition_place_nums(0)=([[PARTITION_PLACE_NUMS]])
+
// CHECK: {{^}}[[MASTER_ID]]: sched_getcpu()=[[CPU_ID:[0-9]+]]
// CHECK: {{^}}[[MASTER_ID]]: ompt_get_proc_id()=[[CPU_ID]]
Index: runtime/src/ompt-general.cpp
===================================================================
--- runtime/src/ompt-general.cpp
+++ runtime/src/ompt-general.cpp
@@ -606,7 +606,7 @@
for (i = 0, place_num = start; place_num <= end; ++place_num, ++i) {
place_nums[i] = place_num;
}
- return end - start;
+ return end - start + 1;
#endif
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42162.134197.patch
Type: text/x-patch
Size: 3535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20180214/bff8e9bd/attachment.bin>
More information about the Openmp-commits
mailing list