[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 12:11:48 PST 2020

AndreyChurbanov added a comment.

> Note that I assume that hitting a file we left behind by ourselves is not a problem for the runtime.

You will still need to explicitly ask library to work with files left behind via setting KMP_DUPLICATE_LIB_OK=1. 
Otherwise library should abort, as it will think that another copy of the library already works in the same process, that is not supported.

Better to avoid files to be left whenever possible.
For applications interrupted abnormally we can add SHM file cleanup in the signal handler, then setting KMP_HANDLE_SIGNALS=1 will remove SHM file (given that at least one parallel region executed/started before interrupt).

We don't catch signals by default because users won't see expected call stack. 
E.g. if they call abort() the call stack will point to the runtime internals as opposed to user's code.
If this is lesser problem than files left behind, we can think of catching signals by default...  Of cause this will still not work for SIGKILL signal which cannot be caught.
If you want library to not leave files in case SIGKILL, the only solution I see is to optionally switch library registration back to setting environment variable as opposed to creating shared memory file. 
Optionally because environment variable also has problems, thus cannot be a default option.


  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list