[OMPT] Add missing ompt_get_num_procs function
AcceptedPublic

Authored by protze.joachim on Thu, Dec 7, 4:10 AM.

Details

Summary

This function is defined in OpenMP-TR6 section 4.1.5.1.6
The functions was not implemented yet.

Since ompt-functions can only be called after the runtime was initialized and has loaded a tool, it can assume the runtime to be initialized. In contrast to omp_get_num_procs which needs to check whether the runtime is initialized.

Diff Detail

protze.joachim created this revision.Thu, Dec 7, 4:10 AM
Hahnfeld accepted this revision.Thu, Dec 7, 6:22 AM

LGTM with one change to the test

runtime/test/ompt/misc/api_calls.c
47–48

Maybe check that these two return the same result as for omp{,t}_get_num_places?

// CHECK: {{^}}[[MASTER_ID]]: omp_get_num_procs()=[[NUM_PROCS:[0-9]+]]
// CHECK: {{^}}[[MASTER_ID]]: ompt_get_num_procs()=[[NUM_PROCS]]
This revision is now accepted and ready to land.Thu, Dec 7, 6:22 AM
Hahnfeld added inline comments.Thu, Dec 7, 7:04 AM
runtime/test/ompt/misc/api_calls.c
67

Can we get a negative result?!?

protze.joachim added inline comments.Fri, Dec 8, 4:03 AM
runtime/test/ompt/misc/api_calls.c
67

The return value is int, thus could be negative.

If a negative value is invalid for omp_get_num_procs, it should be tested somewhere else.

Hahnfeld added inline comments.Fri, Dec 8, 6:09 AM
runtime/test/ompt/misc/api_calls.c
67

omp_get_num_places didn't have it, so I was confused. Anyway I think you are right, this is fine for OMPT as long as the two functions return the same value.