[Openmp-commits] [PATCH] D89898: changing OMP rtl to use shared memory instead of env variable

Andrey Churbanov via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 18 07:20:56 PST 2020


AndreyChurbanov added a comment.

In D89898#2400546 <https://reviews.llvm.org/D89898#2400546>, @rogfer01 wrote:

> Hi @jdoerfert
>
>> [Drive by] What about appending the process id or a random number to the file name, or both?
>
> yeah, the patch already does this. The space of PIDs it is not too large (most systems still use 16-bit PIDs) so collisions are not that unlikely. It is just a bit confusing that an OpenMP application fails due to this, sporadically, at startup.
>
> Perhaps the scenario of leftover files is not that common: probably only if the process receives a `SIGKILL`. Most scheduling systems will send `SIGTERM` first and users often use `SIGINT` or `SIGQUIT`.
>
> Kind regards,

Random number won't work, because the goal of the library registering is to catch several libraries in a single process. So a process should have deterministic file name (or environment variable name).
What we could implement to solve this problem is:

1. Remove shared memory file when a signal caught. This may help when application receives any signal except for SIGKILL which cannot be caught. For this one can set environment variable KMP_HANDLE_SIGNALS=1 (it is off by default).
2. Introduce option to revert library behavior to setting environment variable, say KMP_REGISTER_LIB_ENV=1. That may help applications those do not read environment variables in multiple threads, and be killed by SIGKILL signal.

Maybe there exist some other option?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89898



More information about the Openmp-commits mailing list