Page MenuHomePhabricator

[OpenMP] Implementing omp_get_device_num()
ClosedPublic

Authored by josemonsalve2 on Jun 22 2022, 8:11 AM.

Details

Summary

This patch implements omp_get_device_num() in the host and the device.

It uses the already existing getDeviceNum in the device config for the device.
And in the host it uses the omp_get_num_devices().

Two simple tests added

Diff Detail

Event Timeline

josemonsalve2 created this revision.Jun 22 2022, 8:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2022, 8:11 AM
josemonsalve2 requested review of this revision.Jun 22 2022, 8:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2022, 8:11 AM
tianshilei1992 added inline comments.Jun 22 2022, 8:28 AM
openmp/libomptarget/src/api.cpp
35

The spec says:

When called on the host device, it will return the same value as the omp_get_initial_device routine.

Therefore I suggest we call omp_get_initial_device here.

Ah! I missed that. Thanks

Changing omp_get_num_devices() for omp_get_initial_device()

tianshilei1992 accepted this revision.Jun 22 2022, 9:29 AM

LGTM with one code style issue.

openmp/libomptarget/src/api.cpp
39

HostDevice should be the LLVM style variable name.

This revision is now accepted and ready to land.Jun 22 2022, 9:29 AM

Fixing var name to coding standard

I'm not sure what to do about the buildbot errors I am getting. I'm accessing them but there's no info that tells me what's going on.

Rebasing to master

This revision was landed with ongoing or failed builds.Jun 29 2022, 12:19 AM
This revision was automatically updated to reflect the committed changes.