This is an archive of the discontinued LLVM Phabricator instance.

[OMPT] Add missing ompt_get_num_procs function
ClosedPublic

Authored by protze.joachim on Dec 7 2017, 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

Event Timeline

protze.joachim created this revision.Dec 7 2017, 4:10 AM
Hahnfeld accepted this revision.Dec 7 2017, 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.Dec 7 2017, 6:22 AM
Hahnfeld added inline comments.Dec 7 2017, 7:04 AM
runtime/test/ompt/misc/api_calls.c
67

Can we get a negative result?!?

protze.joachim added inline comments.Dec 8 2017, 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.Dec 8 2017, 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.

This revision was automatically updated to reflect the committed changes.