[Openmp-commits] [PATCH] D24959: [cmake] Fix for a bug https://llvm.org/bugs/show_bug.cgi?id=30489 "Cannot build with -DLIBOMP_FORTRAN_MODULES=True"

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Tue Sep 27 13:04:15 PDT 2016


jlpeyton added a comment.

> From what I found this code was never meant to run in parallel


I should clarify that by parallel I mean running make in parallel (`make -j`).

When building using `make -j`, both the `omp` target and the `libomp-mod` targets can be built in parallel since neither depends on the other.  Since they can run in parallel, their `POST_BUILD` custom commands could run in parallel, and your change would make it possible (very remote chance) for two `make_directory ${LIBOMP_EXPORTS_CMN_DIR}` commands to run in parallel.

> ...so I guess my fix is still ok.

>  Also note that `make_directory` does not complain when created directory already exists (so parallel directory creation should not be a problem).


Your fix is fine if make_directory is thread safe on every supported platform (Linux, NetBSD, FreeBSD, Mac, Windows) and that doesn't take into account possible oddities of the underlying filesystem (is `mkdir` on NFS thread safe?).  And by thread safe, I mean that `make_directory` always successfully exits given simultaneous executions trying to create the exact same directory.  I don't know that it is.  It could be, but I would feel far safer implementing what Chris has suggested.


Repository:
  rL LLVM

https://reviews.llvm.org/D24959





More information about the Openmp-commits mailing list