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

Alexey Bataev via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Nov 29 15:49:50 PST 2018


ABataev added a comment.

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

> 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.


I don't think it is a good idea to produce different results just because of the order of libomp and libomptarget. I consider this as a conflict and incompatibility. It must be fixed.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D54342





More information about the Openmp-commits mailing list