- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am writing to ask help for linking mkl with a fortran code on a Surface Pro with win 8.1 OS. I am using gfortran 4.9.2 (TDM-GCC-65). The Fortran code is paralleled using OpenMP.
I am using the following command:
gfortran -fopenmp -o mycode *.o mkl_rt.lib libiomp5md.lib
It links ok. But during execution, the executable crashes and reports Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
I also tried the following
gfortran -fopenmp -o mycode *.o mkl_rt.lib libiomp5md.lib
I got the following linking error:
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
mkl_intel_thread.lib(mkl_threading.obj):(.text[MKL_get_N_Cores]+0x12): undefined reference to `__chkstk'
mkl_core.lib(_p4n_xdsyrk.obj):../../../../blas/k:(.text+0x12): undefined reference to `__chkstk'
mkl_core.lib(_def_xdsyrk.obj):../../../../blas/k:(.text+0x12): undefined reference to `__chkstk'
mkl_core.lib(_avx_dsyrk_pst.obj):../../../../blas/k:(.text+0x10): undefined reference to `__chkstk'
mkl_core.lib(_mc3_dsyrk_pst.obj):../../../../blas/k:(.text+0x12): undefined reference to `__chkstk'
mkl_core.lib(_mc_dsyrk_pst.obj):../../../../blas/k:(.text+0x12): more undefined references to `__chkstk' follow
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I also used
gfortran -fopenmp -o mycode *.o mkl_rt.lib
It links ok. But during execution, the executable crashes and reports Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
libgomp would not support mkl parallel. You may be able to use mkl sequential, or if you build without fopenmp, use libiomp5.
a common reason for segfault could be stack overflow which might be fixed by appending a /link /stack setting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Tim,
Thanks a lot for your suggestion. Can you be more specific? I need the code to be parallel for performance, my whole purpose to turn to MKL libraries. There is a typo in the original post about the second option I tried is
gfortran -fopenmp -o mycode *.o mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib
The error message is
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
mkl_intel_thread.lib(mkl_threading.obj):(.text[MKL_get_N_Cores]+0x12): undefined reference to `__chkstk'
mkl_core.lib(_p4n_xdsyrk.obj):../../../../blas/k:(.text+0x12): undefined reference to `__chkstk'
mkl_core.lib(_def_xdsyrk.obj):../../../../blas/k:(.text+0x12): undefined reference to `__chkstk'
mkl_core.lib(_avx_dsyrk_pst.obj):../../../../blas/k:(.text+0x10): undefined reference to `__chkstk'
mkl_core.lib(_mc3_dsyrk_pst.obj):../../../../blas/k:(.text+0x12): undefined reference to `__chkstk'
mkl_core.lib(_mc_dsyrk_pst.obj):../../../../blas/k:(.text+0x12): more undefined references to `__chkstk' follow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
in principle, if you set fopenmp, you must not use libiomp or mkl parallel on Windows due to incompatible openMP support.
If sufficient parallelism can be found outside the MKL function call, it can be more effective to call MKL serial functions from a parallel region, and this could get around the problem with various OpenMP internal conventions.
As MKL isn't marketed separately from Intel compilers,and builds under Visual Studio are seen as the primary Windows market, Intel may not see sufficient reason to try to improve compatiblity with the various Windows gfortran variants. gfortran compatibility centers primarily on the versions supported by specific linux distros.
If you could build the open source OpenMP library with compatible mingw compilers, that might do the job, but when I tried it seemed to require the full Visual Studio when building on Windows.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tim,
Thanks a lot for your expert opinion! What are the libraries needed for MKL serial functions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Wenbin
The serial link line is like
gfortran -fopenmp -o mycode *.o mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib
Agree with Tim, there is two issues here.
1. under windows, MKL only support libiomp5 or pgi openmp Run time library, no including gfortran openmp.
2. if under Linux, mkl can support gfortran openmp. The link line is like https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_gf_lp64.a ${MKLROOT}/lib/intel64/libmkl_core.a ${MKLROOT}/lib/intel64/libmkl_gnu_thread.a -Wl,--end-group -ldl -lpthread -lm
or
export MKL_INTERFACE_LAYER=gnu
export MKL_THREADING_LAYE= gun
-Wl,--no-as-needed -L${MKLROOT}/lib/intel64 -lmkl_rt -lpthread -lm
-Wl,--no-as-needed -L${MKLROOT}/lib/intel64 -lmkl_rt -lpthread -lm
unlucky, no of them are applicable for your case, so if you have enough openmp parallel work, you may use sequential MKL , or call sequential MKL in OpenMP region.
Best Regard,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Ying, Thanks alot for your advice.
I used gfortran -fopenmp -o mycode *.o mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib.
However, during linking, I am still getting similar error message:
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
Warning: corrupt .drectve at end of def file
mkl_core.lib(_p4n_xdsyrk.obj):../../../../blas/k:(.text+0x12): undefined reference to `__chkstk'
mkl_core.lib(_def_xdsyrk.obj):../../../../blas/k:(.text+0x12): undefined reference to `__chkstk'
mkl_core.lib(_avx_xdgemv.obj):../../../../blas/k:(.text+0x10): undefined reference to `__chkstk'
mkl_core.lib(_mc3_xdgemv.obj):../../../../blas/k:(.text+0x12): undefined reference to `__chkstk'
mkl_core.lib(_mc_xdgemv.obj):../../../../blas/k:(.text+0x12): undefined reference to `__chkstk'
mkl_core.lib(_p4n_xdgemv.obj):../../../../blas/k:(.text+0x12): more undefined references to `__chkstk' follow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You might note that chkstk.obj should be available for borrowing from a visual studio site, and there are many web references about attempts to satisfy __chkstk in mingw, some involving people more expert on the topic than anyone here.
Do you have the same problem if you try to link against the _dll.lib (dynamic library versions) of MKL?
Did you try stuff like -Wl,"-nostdlib uuid.lib" if you want to suppress those warnings?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I copied a chkstk.obj into the folder. But now I got the following complain. What is wrong?
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `chkstk.obj' is
incompatible with i386:x86-64 output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You would need a chkstk.obj built for X64, including amd64 machine tag. The references I saw indicated this method works in some but not all cases.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Wenbin,
Any news?
Or try 32bit directly, > gfortran -fopenmp -o mycode *.o mkl_intel_c.lib mkl_sequential.lib mkl_core.lib.
Another possibility, as you know, Intel MKL are part of Intel Fotran Composer Suite for windows. If with intel MKL, you may work with ifort + MKL on Windows OS directly. Intel fotran compiler support OpenMP definitely.
Best Regards,
Ying
![](/skins/images/40F6615ECF9B4318A6F9C52DDFA86BE5/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page