This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Fix misleading warning for OMP_PLACES
ClosedPublic

Authored by jlpeyton on Jan 21 2021, 1:49 PM.

Details

Summary

When OMP_PLACES contains an invalid value, the warning informs the user
that the fallback is OMP_PLACES=threads, but the actual internal setting
is OMP_PLACES=cores and is detected as such with KMP_SETTINGS=1.
This patch fixes the warning message to display that OMP_PLACES=cores will be used.

Diff Detail

Event Timeline

jlpeyton created this revision.Jan 21 2021, 1:49 PM
jlpeyton requested review of this revision.Jan 21 2021, 1:49 PM

In my quick test, env KMP_SETTINGS=1 OMP_PROC_BIND=spread ./a.out reports OMP_PLACES='cores'. I could not find the code path that sets places to cores in this case, but I think it would be more consistent to have consistent setting in the unset and the invalid case.

Is there a reason to choose threads?

In my quick test, env KMP_SETTINGS=1 OMP_PROC_BIND=spread ./a.out reports OMP_PLACES='cores'. I could not find the code path that sets places to cores in this case, but I think it would be more consistent to have consistent setting in the unset and the invalid case.

Is there a reason to choose threads?

Internally here at Intel we did have it at threads at one point, then somehow it got changed, and this was just to change it back to threads. It would be more consistent to have it default to OMP_PLACES=cores because of the case you mentioned and KMP_AFFINITY defaults to core granularity as well. @AndreyChurbanov , are you ok with keeping it as OMP_PLACES="cores" and just changing the warning message to cores instead?

In my quick test, env KMP_SETTINGS=1 OMP_PROC_BIND=spread ./a.out reports OMP_PLACES='cores'. I could not find the code path that sets places to cores in this case, but I think it would be more consistent to have consistent setting in the unset and the invalid case.

Is there a reason to choose threads?

Internally here at Intel we did have it at threads at one point, then somehow it got changed, and this was just to change it back to threads. It would be more consistent to have it default to OMP_PLACES=cores because of the case you mentioned and KMP_AFFINITY defaults to core granularity as well. @AndreyChurbanov , are you ok with keeping it as OMP_PLACES="cores" and just changing the warning message to cores instead?

Fine with me.

jlpeyton updated this revision to Diff 318590.Jan 22 2021, 11:38 AM
jlpeyton edited the summary of this revision. (Show Details)

Fixed so that cores is displayed in the warning message.

This revision is now accepted and ready to land.Jan 26 2021, 7:02 AM
This revision was landed with ongoing or failed builds.Jan 27 2021, 12:28 PM
This revision was automatically updated to reflect the committed changes.