iomp.h vs omp.h

Jonathan,
      I have been taking a stab at renaming libiomp5 to libomp locally
and am puzzled by a header name conflict. Currently we have...

runtime/src/include/30/iomp.h.var
runtime/src/include/30/omp.h.var
runtime/src/include/30/iomp_lib.h.var
runtime/src/include/30/omp_lib.h.var
runtime/src/include/40/iomp.h.var
runtime/src/include/40/omp.h.var
runtime/src/include/40/iomp_lib.h.var
runtime/src/include/40/omp_lib.h.var
runtime/src/include/41/iomp.h.var
runtime/src/include/41/omp.h.var
runtime/src/include/41/iomp_lib.h.var
runtime/src/include/41/omp_lib.h.var

which will produce filename conflicts when eliminating the usage of
iomp. What is the purpose of the headers prefixed with 'i'? Is this
some legacy cruft from clang-omp which can be dropped as I don't seen
any actual usage of the prefixed headers.
            Jack

Here is what I have so far for the name change patch. It is successfully creating symlinks at install time and has renamed most of the libiomp stuff to libomp.

Concerning iomp.h, this header was first created to allow libgomp users to include Intel-specific features in their code while they used libgomp's omp.h file. This way users could just add #include "iomp.h" to use exported kmp[c]_ functions. It is not needed for the LLVM project.

-- Johnny

name_change.patch (12 KB)

Here is a patch which takes care of all the libiomp name references concerning CMake builds.

1) It gets rid of any reference to libiomp and the evil letter 'i' in the CMake files.
2) Creates new file libomp.rc.var which is a copy of libiomp.rc.var (Windows only), I will delete libiomp.rc.var when I modify the Makefile system.
3) Creates libomp.so/libomp.dylib/libomp.dll
4) When installing, creates libgomp.so symlink to libomp.so and libiomp5.so symlink to libomp.so (similar for mac). On Windows, it creates copies of the file since symlinks don't exist on Windows.
5) Gets rid of references to iomp.h and iomp_lib.h which aren't needed by the LLVM OpenMP Library. Again, I'm not deleting them until the Makefile system has been changed.

I put in the libgomp.so symlink because libomp.so supports the GNU OpenMP Library interfaces (at both link and run time). If we want this gone, that's fine.

Please try it out and leave comments/feedback.

-- Johnny

name_change_v2.patch (34.6 KB)

When you guys are doing all this renaming and churn - please test with
using the alt lib name cmake configure option as well. Some people may
want to maintain the old name or an alt name.

Thanks

Jonathan,
       Attached is what I came up with today (which is missing the
symlink creation).
It was constructed by....

1) eliminating the usage of iomp.h(.var) and iomp_lib.h(.var) in the
build system
2) renaming libiomp.rc to libomp.rc
3) deleting the line

set(lib_item "${lib_item}${LIBOMP_VERSION}")

from runtime/CMakeLists.txt to eliminate the appended '5'.

4) changing all instances of 'libiomp5' to 'libomp'
5) changing all instances of 'iomp5' to 'omp'
6) changing all instances of 'libiomp' to 'libomp'
7) changing all instances of 'iomp' to 'omp'

Also in the cfe sources I changed...

set(CLANG_DEFAULT_OPENMP_RUNTIME "libgomp" CACHE STRING

to

set(CLANG_DEFAULT_OPENMP_RUNTIME "libomp" CACHE STRING

so the default linkage is now -lomp.

The resulting build shows no regressions in the OpenMP3.1_Validation
compiled at -m32 or -m64.
I also confirmed that the presence of the symlink for the legacy
libiomp5.dylib shared library is sufficient
on darwin to run legacy binaries linked against the previous shared
library name.
            Jack

rename_libiomp5_to_libomp.diff (52 KB)

FYI, the patch I posted passes OpenMP3.1_Validation when the compiler
is passed -fopenmp=libiomp5 rather than -fopenmp (with the symlink for
the old name manually created).

Also, I am assuming that we do want all instances of libiomp5, iomp5,
libiomp and iomp in the openmp files converted into instances of
libomp, omp, libomp and omp respectively.

Jonathan,
     Your proposed name_change_v2.patch change fails to install the
symlinks due to the omission of an essential escaping back-slash
before the $ENV. The following change to the patch eliminates the
problem and allows the symlinks to be correctly installed.
              Jack

--- llvm37-libomp.patch.orig 2015-05-30 12:38:05.000000000 -0400
+++ llvm37-libomp.patch 2015-05-30 14:45:10.000000000 -0400
@@ -717,7 +717,7 @@
+ set(LIBOMP_ALIASES "libgomp;libiomp5")
+ foreach(alias IN LISTS LIBOMP_ALIASES)
+ install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\"
-E create_symlink \"${lib_file}\" \"${alias}${dll}\"
-+ WORKING_DIRECTORY
$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/lib${LIBOMP_LIBDIR_SUFFIX})")
++ WORKING_DIRECTORY
\$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/lib${LIBOMP_LIBDIR_SUFFIX})")
+ endforeach()
  endif()
  install(

Jonathan,
       FYI, below are the OpenMP3.1_Validation summaries for clang
3.7svn with your proposed patch linking against the new libgomp
symlink....

Summary:
S Number of tested Open MP constructs: 62
S Number of used tests: 123
S Number of failed tests: 28
S Number of successful tests: 95
S + from this were verified: 14

Normal tests:
N Number of failed tests: 14
N + from this fail compilation: 0
N + from this timed out 0
N Number of successful tests: 48
N + from this were verified: 7

Orphaned tests:
O Number of failed tests: 14
O + from this fail compilation: 0
O + from this timed out 0
O Number of successful tests: 47
O + from this were verified: 7

and linking against the actual libgomp from gcc 5.1 instead....

Summary:
S Number of tested Open MP constructs: 62
S Number of used tests: 123
S Number of failed tests: 30
S Number of successful tests: 93
S + from this were verified: 12

Normal tests:
N Number of failed tests: 15
N + from this fail compilation: 0
N + from this timed out 0
N Number of successful tests: 47
N + from this were verified: 6

Orphaned tests:
O Number of failed tests: 15
O + from this fail compilation: 0
O + from this timed out 0
O Number of successful tests: 46
O + from this were verified: 6

             Jack

Jonathan,
      Attached is an expanded version of your patch which eliminates
the remaining instances of iomp5/iomp and adds the missing backslash
in front of $ENV for the symlink creation.
            Jack

name_change_v2-expanded.patch (60 KB)