This is an archive of the discontinued LLVM Phabricator instance.

fix for the __kmpc_global_num_threads function to return the value of the __kmp_all_nth global var
ClosedPublic

Authored by yanyh on Dec 20 2016, 2:50 AM.

Details

Summary

As the comments and the function name indicate, the function returns the internal global num of a thread, not the num of a thread within a team, which is what the current function do by returning the value of kmp_nth global var. This patch fixes that by returning the kmp_all_nth value.

Diff Detail

Repository
rL LLVM

Event Timeline

yanyh updated this revision to Diff 82078.Dec 20 2016, 2:50 AM
yanyh retitled this revision from to fix for the __kmpc_global_num_threads function to return the value of the __kmp_all_nth global var.
yanyh updated this object.
yanyh added a reviewer: tlwilmar.
yanyh added a subscriber: openmp-commits.
AndreyChurbanov accepted this revision.Dec 20 2016, 10:41 AM
AndreyChurbanov added a reviewer: AndreyChurbanov.
AndreyChurbanov added a subscriber: AndreyChurbanov.

LGTM

Yonghong, you are right, the kmp_all_nth counts all threads created by the runtime library, whereas kmp_nth counts only active threads those belong to OMP teams.

This revision is now accepted and ready to land.Dec 20 2016, 10:41 AM
This revision was automatically updated to reflect the committed changes.