[Openmp-commits] [openmp] r238720 - Apply name change to Makefile build system.

Peyton, Jonathan L jonathan.l.peyton at intel.com
Mon Jun 1 12:37:38 PDT 2015


Well, I have created a hello world library and replicated the problem you have pointed out.  What happens is this:

libompmd.dll is loaded and the program begins execution, then when libiomp5md.dll is needed it produces this error:
OMP: Error #15: Initializing libiomp5md.dll, but found libompmd.dll already initialized.
OMP: Hint: This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance
or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static
linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable 
KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please
see http://www.intel.com/software/products/support/.

I can't think of way to avoid this problem.  If someone knows of a way to somehow have libiomp5.dll's point to libompmd.dll then please let me know.

-- Johnny

-----Original Message-----
From: Hal Finkel [mailto:hfinkel at anl.gov] 
Sent: Monday, June 1, 2015 4:45 AM
To: Peyton, Jonathan L
Cc: openmp-commits at cs.uiuc.edu
Subject: Re: [Openmp-commits] [openmp] r238720 - Apply name change to Makefile build system.

----- Original Message -----
> From: "Jonathan Peyton" <jonathan.l.peyton at intel.com>
> To: openmp-commits at cs.uiuc.edu
> Sent: Sunday, May 31, 2015 11:21:23 PM
> Subject: [Openmp-commits] [openmp] r238720 - Apply name change to Makefile	build system.
> 
> Author: jlpeyton
> Date: Sun May 31 23:21:22 2015
> New Revision: 238720
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=238720&view=rev
> Log:
> Apply name change to Makefile build system.
> 
> This change produces a dynamic library named libomp instead of 
> libiomp5.  Similar to the CMake change, it produces symlinks of
> libiomp5
> in the exports/ directory for Unix systems and copies for Windows.

Will this cause a problem on Windows if you have an application being linked with libomp also linking to a library that was linked against libiomp?

 -Hal

> 
> Modified:
>     openmp/trunk/runtime/Makefile
>     openmp/trunk/runtime/src/makefile.mk
>     openmp/trunk/runtime/src/rules.mk
> 
> Modified: openmp/trunk/runtime/Makefile
> URL:
> http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/Makefile?rev=
> 238720&r1=238719&r2=238720&view=diff
> ======================================================================
> ========
> --- openmp/trunk/runtime/Makefile (original)
> +++ openmp/trunk/runtime/Makefile Sun May 31 23:21:22 2015
> @@ -49,7 +49,7 @@ endif
>  
>  
>  
> -libiomp5_path=$(shell $(omp_root)/tools/check-openmp.pl)
> +libomp_path=$(shell $(omp_root)/tools/check-openmp.pl)
>  test_path=$(shell $(omp_root)/tools/check-openmp-test.pl)
>  
>  # Please do not change this rule.
> @@ -60,10 +60,10 @@ test: omp
>  	@$(Verb) if which llvm-lit &> /dev/null; then \
>          if [ -d
>          "$(omp_root)$(SLASH)..$(SLASH)testsuite$(SLASH)LLVM-IR" ] ;
>          then \
>  			export TESTSUITE_TEMP=$(realpath $(omp_root))$(SLASH)tmp ; \
> -			export LIBRARY_PATH=$(libiomp5_path):$(LIBRARY_PATH) ; \
> -			export
> C_INCLUDE_PATH=$(libiomp5_path)$(SLASH)..$(SLASH)..$(SLASH)common$(SLA
> SH)include:$(C_INCLUDE_PATH)
> ; \
> -			export LD_LIBRARY_PATH=$(libiomp5_path):$(LD_LIBRARY_PATH) ; \
> -			export DYLD_LIBRARY_PATH=$(libiomp5_path):$(DYLD_LIBRARY_PATH) ;
> \
> +			export LIBRARY_PATH=$(libomp_path):$(LIBRARY_PATH) ; \
> +			export
> C_INCLUDE_PATH=$(libomp_path)$(SLASH)..$(SLASH)..$(SLASH)common$(SLASH
> )include:$(C_INCLUDE_PATH)
> ; \
> +			export LD_LIBRARY_PATH=$(libomp_path):$(LD_LIBRARY_PATH) ; \
> +			export DYLD_LIBRARY_PATH=$(libomp_path):$(DYLD_LIBRARY_PATH) ; \
>  			cd $(omp_root)$(SLASH)..$(SLASH)testsuite ; \
>  			make ctest ; \
>  			python adding_xfails.py ; \
> 
> Modified: openmp/trunk/runtime/src/makefile.mk
> URL:
> http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/makefile.
> mk?rev=238720&r1=238719&r2=238720&view=diff
> ======================================================================
> ========
> --- openmp/trunk/runtime/src/makefile.mk (original)
> +++ openmp/trunk/runtime/src/makefile.mk Sun May 31 23:21:22 2015
> @@ -764,7 +764,7 @@ endif
>                          lib_asm_items =
>                          gd-flags += -D shim
>                          # for some reason, test-touch-md is able to
>                          work with
> -                        # the build compiler's version of
> libiomp5md.dll, but
> +                        # the build compiler's version of
> libompmd.dll, but
>                          # test-touch-mt can't load it.
>                          do_test_touch_mt := 0
>                      endif
> @@ -803,14 +803,13 @@ ifeq "$(VERSION)" "4"
>          _lib_item += _stats
>      endif
>  else
> -    _lib_item = libiomp
> +    _lib_item = libomp
>      ifeq "$(LIB_TYPE)" "prof"
>          _lib_item += prof
>      endif
>      ifeq "$(LIB_TYPE)" "stub"
>          _lib_item += stubs
>      endif
> -    _lib_item += $(VERSION)
>      ifeq "$(os)" "win"
>          ifeq "$(LINK_TYPE)" "dyna"
>              _lib_item += md
> @@ -831,7 +830,6 @@ ifeq "$(os)-$(LINK_TYPE)" "win-dyna"
>      imp_file  = $(lib_item)$(lib)
>      def_file  = $(lib_item).def
>      res_file  = $(lib_item).res
> -    rc_file   = $(lib_item).rc
>      # PDB file should be generated if: ( DEBIG_INFO is on ) OR ( we
>      are building 32-bit normal
>      # library AND version is 5 ).
>      ifneq "$(filter on,$(DEBUG_INFO))$(filter
>      norm-5,$(LIB_TYPE)-$(VERSION))" ""
> @@ -851,12 +849,10 @@ endif
>  # --- Output files ---
>  
>  out_lib_files  = $(addprefix $(out_lib_dir),$(lib_file) $(imp_file)
>  $(pdb_file) $(dbg_file))
> -out_inc_files  = $(addprefix
> $(out_ptf_dir)include_compat/,iomp_lib.h)
>  out_mod_files  = \
>      $(addprefix $(out_ptf_dir)include/,omp_lib.mod
>      omp_lib_kinds.mod)
>  out_cmn_files  = \
> -    $(addprefix $(out_cmn_dir)include/,omp.h omp_lib.h omp_lib.f
> omp_lib.f90) \
> -    $(addprefix $(out_cmn_dir)include_compat/,iomp.h)
> +    $(addprefix $(out_cmn_dir)include/,omp.h omp_lib.h omp_lib.f
> omp_lib.f90)
>  ifeq "$(OMPT_SUPPORT)" "on"
>      out_cmn_files  += $(addprefix $(out_cmn_dir)include/,ompt.h)  
> endif @@ -1017,12 +1013,11 @@ endif  #
>  
> ----------------------------------------------------------------------
> ----------------------------
>  
>  all    : lib inc mod
> -lib    : tests $(out_lib_files)
> -inc    : $(out_inc_files)
> +lib    : tests $(out_lib_files) libomp_aliases
>  mod    : $(out_mod_files)
>  clean  :
>  	$(rm) $(out_lib_files) $(out_lib_fat_files)
> -	$(rm) $(out_inc_files) $(out_mod_files)
> +	$(rm) $(out_mod_files)
>  
>  #
>  
> ----------------------------------------------------------------------
> ----------------------------
>  # Building library.
> @@ -1042,7 +1037,7 @@ ifneq "$(filter lin,$(os))" ""
>      lib_file_deps = $(if
>      $(linked_in_libs),required/.objs,$(lib_obj_files))
>  endif
>  ifeq "$(os)" "mac"
> -    lib_file_deps = iomp$(obj)
> +    lib_file_deps = omp$(obj)
>  endif
>  ifeq "$(os)" "win"
>      lib_file_deps = $(if
>      $(linked_in_libs),wiped/.objs,$(lib_obj_files))
> @@ -1149,21 +1144,21 @@ ifeq "$(os)" "mac"
>      # These targets are under condition because of some OS
>      X*-specific ld and nm options. For
>      # example, GNU nm does not accept -j, GNU ld does not know
>      -filelist.
>  
> -    # iomp.o is a big object file including all the OMP RTL object
> files and object files from
> +    # omp.o is a big object file including all the OMP RTL object
> files and object files from
>      # external libraries (like libirc). It is partially linked,
>      references to external symbols
>      # (e. g. references to libirc) already resolved, symbols defined
>      in external libraries are
>      # hidden by using -unexported-symbol-list and
>      -non_global_symbols_strip_list linker options
>      # (both options are required).
>      # AC: 2012-04-12: after MAC machines upgrade compiler fails to
>      create object, so use linker instead  ifeq "$(mac_os_new)" "1"
> -    iomp$(obj) : $(lib_obj_files) external-symbols.lst
> external-objects.lst .rebuild
> +    omp$(obj) : $(lib_obj_files) external-symbols.lst
> external-objects.lst .rebuild
>  	    $(target)
>  	    ld -r -unexported_symbols_list external-symbols.lst \
>  		-non_global_symbols_strip_list external-symbols.lst \
>  		-filelist external-objects.lst \
>  		-o $@ $(obj_deps_files)
>  else
> -    iomp$(obj) : $(lib_obj_files) external-symbols.lst
> external-objects.lst .rebuild
> +    omp$(obj) : $(lib_obj_files) external-symbols.lst
> external-objects.lst .rebuild
>  	    $(target)
>  	    $(c) -r -nostartfiles -static-intel  -no-intel-extensions \
>  		-Wl,-unexported_symbols_list,external-symbols.lst \ @@ -1173,7 
> +1168,7 @@ else  endif
>  
>      # external-objects.lst is a list of object files extracted from
>      external libraries, which should
> -    # be linked into iomp.o. kmp_dummy.o is added to the list to
> avoid empty list -- OS X* utilities
> +    # be linked into omp.o. kmp_dummy.o is added to the list to
> avoid empty list -- OS X* utilities
>      # nm and ld do not like empty lists.
>      external-objects.lst : $(lib_obj_files) $(addsuffix
>      /.objs,$(linked_in_libs)) kmp_dummy$(obj) \
>  	$(tools_dir)required-objects.pl .rebuild @@ -1234,12 +1229,8 @@ 
> $(def_file) : dllexports \
>  	$(target)
>  	$(perl) $(tools_dir)generate-def.pl $(gd-flags) -o $@ $<
>  
> -libiomp.rc : libiomp.rc.var kmp_version.c -libiomp.rc : ev-flags += 
> -D KMP_FILE=$(lib_file)
> -
> -$(rc_file) : libiomp.rc .rebuild
> -	$(target)
> -	$(cp) $< $@
> +libomp.rc : libomp.rc.var kmp_version.c libomp.rc : ev-flags += -D 
> +KMP_FILE=$(lib_file)
>  
>  kmp_dummy.c : .rebuild
>  	$(target)
> @@ -1540,7 +1531,6 @@ omp_lib_kinds.mod : $(omp_lib_f) .rebuil  
> omp_lib.mod : omp_lib_kinds.mod
>  
>  omp_lib.h  : ev-flags += -D KMP_INT_PTR_KIND="int_ptr_kind()"
> -iomp_lib.h : ev-flags += -D KMP_INT_PTR_KIND=$(if $(filter
> 32,$(arch)),4,8)
>  
>  #
>  
> ----------------------------------------------------------------------
> ----------------------------
>  # Common files.
> 
> Modified: openmp/trunk/runtime/src/rules.mk
> URL:
> http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/rules.mk?
> rev=238720&r1=238719&r2=238720&view=diff
> ======================================================================
> ========
> --- openmp/trunk/runtime/src/rules.mk (original)
> +++ openmp/trunk/runtime/src/rules.mk Sun May 31 23:21:22 2015
> @@ -30,6 +30,15 @@ $(out_lib_dir)% : % $(out_lib_dir).dir .
>  	    $(touch) $(dir $@).touch
>          endif
>  
> +.PHONY: libomp_aliases
> +libomp_aliases: $(out_lib_dir).dir .rebuild
> $(out_lib_dir)$(lib_file)
> +	$(target)
> +ifeq "$(os)" "win"
> +	cd $(out_lib_dir) ; $(cp) $(lib_file) libiomp5md$(dll) ; $(cp)
> $(imp_file) libiomp5md$(lib)
> +else
> +	cd $(out_lib_dir) ; ln -sf $(lib_file) libiomp5$(dll) endif
> +
>  $(out_ptf_dir)include/% : % $(out_ptf_dir)include/.dir .rebuild
>  	$(target)
>  	$(cp) $< $@
> 
> 
> _______________________________________________
> Openmp-commits mailing list
> Openmp-commits at dcs-maillist2.engr.illinois.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/openmp-commits
> 

--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory




More information about the Openmp-commits mailing list