Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
6735 Discussions

Compilation of source codes using BLAS, LAPACK and ARPACK??

Jasmeet_S_
Beginner
610 Views

Hi,

I am trying to compile source codes using BLAS, LAPACK and ARPACK.

Source folder contain 14 files out of which 10 are compiled (using BLAS and LAPACK) but rest of the 4 files require ARPACK.

I have downloaded ARPACK from http://www.caam.rice.edu/software/ARPACK/ and then extracted it in home directory.

but the following error is coming:

ifort -static -mkl=sequential gaustail.o -o gaustail
mv -f gaustail  ./bin
ifort -static -mkl=sequential psn.o /opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_blas95_ilp64.a /opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_lapack95_ilp64.a -o psn
/opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_core.a(mkl_memory_patched.o): In function `mm_cleanup_thread_cbk':
mkl_memory.c:(.text+0x68c7): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
mv -f psn  ./bin
ifort -static -mkl=sequential scatci.o davidson.o scatci_intPacking.o /opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_blas95_ilp64.a /opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_lapack95_ilp64.a /home/jasmeet/ARPACK/libarpack.a -o scatci    
/opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_core.a(mkl_memory_patched.o): In function `mm_cleanup_thread_cbk':
mkl_memory.c:(.text+0x68c7): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/jasmeet/ARPACK/libarpack.a(dnrm2.o): In function `dnrm2_':
dnrm2.f:(.text+0x9d): undefined reference to `_gfortran_runtime_error_at'
Makefile:125: recipe for target 'scatci' failed
make: *** [scatci] Error 1

 

Please find the attached Makefile.

0 Kudos
7 Replies
mecej4
Black Belt
610 Views

You seem to have compiled the Arpack library using Gfortran. It is never completely safe to build an application with more than one compiler's runtime library in it. However, you can try by adding -lgfortran to the linking command in your makefile (which you say you attached but is not to be seen).

Jasmeet_S_
Beginner
610 Views

@mecej4 Thanks for replying.

I have realized that I need parallel-ARPACK. So I have downloaded the parallel-ARPACK.

But I don't know how to install it on my computer.

 

mecej4
Black Belt
610 Views

Jasmeet S. wrote:

I have realized that I need parallel-ARPACK. So I have downloaded the parallel-ARPACK.

The kind of parallelism that is provided is probably not suitable for you -- it is for distributed memory systems, whereas you probably need SMP support as provided by OpenMP, etc. Unless, of course, you really need to install Parpack on a cluster.

But I don't know how to install it on my computer.

You have to build it from source, using the usual GNU/Linux "configure", "make", "make test" and "make install" procedures.

Search these forums and you will find some recent threads that involved the use of the serial version of Arpack.

Jasmeet_S_
Beginner
610 Views

The following hint is given in the source codes:

If the 'arpack' library (which is in the public domain) is linked to optimized 'lapack' and 'blas' libraries at 'arpack' compilation time, 'scatci' will run more efficiently. For example, a suggestion for flags for the linking of 'arpack' to Intel's 'mkl' library is as follows:

 -O3 -static-intel -parallel -par-threshold0 -mkl=parallel.

Please find the attached Source_code_makefile, ARPACK_MAKEFILE and ARmake.inc in new.tar.gz

Still the following error is coming while compilation:

mv -f psn  ./bin
ifort -static -mkl=sequential scatci.o davidson.o scatci_intPacking.o /opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_blas95_ilp64.a /opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_lapack95_ilp64.a /home/jasmeet/ARPACK/lib.a -o scatci    
/opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_core.a(mkl_memory_patched.o): In function `mm_cleanup_thread_cbk':
mkl_memory.c:(.text+0x68c7): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/jasmeet/ARPACK/lib.a(dsaupd.o): In function `dsaupd_':
dsaupd.f:(.text+0x41f): undefined reference to `__kmpc_for_static_init_4'

 

mecej4
Black Belt
610 Views

Apparently, you built the Arpack library with -openmp, but left that flag out when compiling and linking your applications.

Please see this thread: https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/685394 . In it, you will find information about bugs in various versions of Arpack and getting Arpack to work with MKL.

Jasmeet_S_
Beginner
610 Views

I have followed the link: https://software.intel.com/en-us/articles/how-to-resolve-arpack-issues-with-intel-mkl-110-update-3

But no success. Same error is coming

/home/jasmeet/ARPACK/lib.a(dsaupd.o): In function `dsaupd_':
dsaupd.f:(.text+0x41f): undefined reference to `__kmpc_for_static_init_4'
dsaupd.f:(.text+0x4a2): undefined reference to `__kmpc_for_static_fini

Ying_H_Intel
Employee
610 Views

Hi Jasmeet, 

I'm try to understand the issue  and noticed several tiny problems in your command line,  please consider them. 

1) first , regarding the error, /home/jasmeet/ARPACK/lib.a(dsaupd.o): In function `dsaupd_':

dsaupd.f:(.text+0x41f): undefined reference to `__kmpc_for_static_init_4'

The symbol " __kmpc_for_static_init_4" is from intel Openmp run-time library.   You can resolve it by  add -qopenmp or add libiomp5.so library

mv -f psn  ./bin
ifort -static -mkl=sequential scatci.o davidson.o scatci_intPacking.o /opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_blas95_lp64.a /opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_lapack95_lp64.a /home/jasmeet/ARPACK/lib.a -o scatci -qopenmp 

or 

ifort -static -mkl=sequential scatci.o davidson.o scatci_intPacking.o /opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_blas95_lp64.a /opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_lapack95_lp64.a /home/jasmeet/ARPACK/lib.a -o scatci  -L/opt/intel/compilers_and_libraries_2016/linux/lib/intel64 -liomp5  ​-lpthread -lm -ldl  (please change according to your real path) 

if it fix the problem, you may ignore the below comments. 

2) why you add /opt/intel/newbin/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_blas95_ilp64.a and /libmkl_lapack95_ilp64.a  into the link. 

They are fortran 95 interface libraries,  not exact blas or lapack library (blas and library library are in mkl library, which you use -mkl=sequential or /home/jasmeet/ARPACK/lib.a, which had mkl linked-already).  in most of case, you don't need them. 

and you are using ILP64 bit,   by default -mkl=sequential  will be LP64 library, so i may suggest you remove them or change to libmkl_blas95_lp64.a and /libmkl_lapack95_lp64.a.  

Actually, please use the  https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ to produce the correct link line. for example, 

 ${MKLROOT}/lib/intel64/libmkl_blas95_lp64.a ${MKLROOT}/lib/intel64/libmkl_lapack95_lp64.a  -mkl=sequential 

3) please notice the order of static library as the linker under Linux just review the symbols one times. so you need make sure the required library in some kind of order. for example, in general,  ${MKLROOT}/lib/intel64/libmkl_blas95_lp64.a ${MKLROOT}/lib/intel64/libmkl_lapack95_lp64.a  -mkl=sequential . 

4) regarding /home/jasmeet/ARPACK/libarpack.a(dnrm2.o): In function `dnrm2_':   and /home/jasmeet/ARPACK/lib.a.  It should be ok.  Just wonder if you build them with mkl option or you download from some public repository?  are they linked static mkl internally or no mkl libaries, so you add it when compile the scatci  ?   ( you mentioned  -O3 -static-intel -parallel -par-threshold0 -mkl=parallel. so just guess, maybe you can remove the -mkl=sequential in your link line of compile the scatci, anyway, please let us know if you have any result.)

Best Regards,

Ying 

 

Reply