jdoerfert added a comment.

In D143306#4145465 <https://reviews.llvm.org/D143306#4145465>, @MaskRay wrote:

> In D143306#4144541 <https://reviews.llvm.org/D143306#4144541>, @jdoerfert 
> wrote:
>
>> I'm worried this makes use of LLVM on HPC machines even harder. That said, 
>> I'm open to suggestions and I am not well versed in all the ways we can make 
>> it work.
>> Our problem is that there are N `libomptarget.so` files and N 
>> `libomptarget.nvptx.so` files on a system, including in system directories 
>> and in directories you have on your LD_LIBRARY_PATH.
>> However, we want a clang to pick up its own versions of those files. The 
>> former is linked into clang, the latter is dynamically loaded with dlopen. 
>> That is, IIRC, roughly our use case.
>>
>>> I'd argue that such systems should specify -Wl,-rpath explicitly or in a 
>>> Clang configuration file.
>>
>> Could you work me through this, please. We can't install a config file in a 
>> user or system directory. So all we have is the clang install directory.
>> Should we not set this flag but then install a file (by default) that says 
>> `-Wl,-rpath=...`. Is that what you mean? If so, what's the difference for 
>> the user?
>> Or would we add `--offload-add-rpath` to the clang build if OpenMP offload 
>> is enabled?
>
> This part of https://clang.llvm.org/docs/UsersManual.html#configuration-files 
> is relevant "... is searched for sequentially in the directories".
>
> Say my `clang` executable is at `/tmp/opt/Rel/bin/clang`. I can just create 
> `/tmp/opt/Rel/bin/clang.cfg` with one line `-Wl,-rpath=/tmp/opt/Rel/lib` 
> (there is no magic expansion as in a shell).
> Invoking `/tmp/opt/Rel/bin/clang` will get this default option (without an 
> unused command line option warning) unless `--no-default-config` is specified.
> The difference is that the rpath is now the default, instead of only when 
> `-fopenmp=libomp` is specified. But such HPC users don't appear to be averse 
> to rpath as much as we do.
>
> It should be fairly trivial to adjust one's llvm-project build/install script 
> to create such a `clang.cfg` file.

@jhuber6 Can you look into the last part, creating such a clang.cfg as part of 
the build/install process?

The fact that rpath is always set is a difference but I doubt it's that bad. We 
effectively point only to the llvm runtimes, which should be what users want 
anyway.
If this is really a problem, maybe we can/should separate the OpenMP runtimes 
into a subfolder and rpath (-L) that one. Users get by default the OpenMP 
runtimes associated with the clang, but we would not pollute anything else.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143306

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to