[PATCH] D54342: Add omp_get_device_num() and update several other device API functions

Terry Wilmarth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 29 15:24:10 PST 2018


tlwilmar added a comment.

In D54342#1313542 <https://reviews.llvm.org/D54342#1313542>, @tlwilmar wrote:

> In D54342#1313515 <https://reviews.llvm.org/D54342#1313515>, @gtbercea wrote:
>
> > After this patch, omp_get_num_devices() seems to wrongly return 0 even when devices are present.
>
>
> OK, on my internal build these are showing up as weak symbols with nm.  But on my LLVM build, not.  Will look into the LLVM build to make sure it allows for weak attribute.


I was wrong -- here are the weak symbols that are showing up in libomp:

nm runtime/exports/lin_32e.50.ompt.optional/lib/libomp.so | grep " W "
00000000000a4540 W omp_get_device_num
00000000000a5dd0 W omp_get_device_num_
00000000000a3f20 W omp_get_initial_device
00000000000a57c0 W omp_get_initial_device_
00000000000a3ee0 W omp_get_num_devices@@VERSION
00000000000a5780 W omp_get_num_devices_@@VERSION
00000000000a3f10 W omp_is_initial_device@@VERSION
00000000000a57b0 W omp_is_initial_device_@@VERSION
00000000000a7d20 W ompt_start_tool

So, it looks like weak symbols work better with static libraries.  For dynamic, try linking libomptarget first.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54342/new/

https://reviews.llvm.org/D54342





More information about the llvm-commits mailing list