Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6977 Discussions

linking with ilp produces segmentation fault

zyserman
Beginner
482 Views
Hi, I am using mkl to solve a set of linear systems with pardiso.

I am working on a 64GB ram computer with four quad-core processors (xeon 7310), with
a 64 bit linux distro.

I have been able to solve several (rather small) problems using the following compilation line:

ifort -w -I /opt/intel/mkl/10.1.0.015/include/ gen_mod_compres_1_patch-paralelo.f -L${MKL_LIB} ${MKL_LIB}/libmkl_solver_lp64.a ${MKL_LIB}/libmkl_intel_lp64.a -Wl,--start-group ${MKL_LIB}/libmkl_intel_thread.a ${MKL_LIB}/libmkl_core.a -Wl,--end-group -L${MKL_LIB} -liomp5 -lpthread -lm -o test.out

Then, I increased the size of the linear system. Compiling using lp produced errors,
that dissapeared when I compiled using ilp as:

ifort -w -I /opt/intel/mkl/10.1.0.015/include/ gen_mod_compres_1_patch-paralelo.f $MKLPATH/libmkl_solver_ilp64.a -Wl,--start-group $MKLPATH/libmkl_intel_ilp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a -Wl,--end-group -openmp -lpthread -lm -o test.out

In this way, the executable file is generated, but when I run the program, it immediately
produces a segmentation fault. I do not know to use debbugers, so I wrote several
print lines within the code, but even the first one, located as the first executable statement is
not executed.

Any hint about this?

Thanks in advance!!!
0 Kudos
4 Replies
TimP
Honored Contributor III
482 Views
You must make all integer arguments to MKL functions, and all real arguments, the same data types. ilp64 requires all 64-bit integers (e.g. integer*8, default integers with -i8 option), while lp64 requires all 32-bit integers (default integer without -i8, integer*4). Inclusion of the optional USE or .fi machinery will allow the compiler to check for correct data types and identify any errors.
0 Kudos
zyserman
Beginner
482 Views
Quoting - tim18
You must make all integer arguments to MKL functions, and all real arguments, the same data types. ilp64 requires all 64-bit integers (e.g. integer*8, default integers with -i8 option), while lp64 requires all 32-bit integers (default integer without -i8, integer*4). Inclusion of the optional USE or .fi machinery will allow the compiler to check for correct data types and identify any errors.

Hi Tim, thanks for your answer. It has helped me to find some mistakes in my code, but still I have some problems. As I am rather a newbie, could you please tell me what are the optional USE or .fi machinery,
and where can I read about them?

Thanks again!
0 Kudos
TimP
Honored Contributor III
482 Views
Quoting - zyserman

Hi Tim, thanks for your answer. It has helped me to find some mistakes in my code, but still I have some problems. As I am rather a newbie, could you please tell me what are the optional USE or .fi machinery,
and where can I read about them?

In the include directory of your mkl installation there are several .fi (f77 style include) and .f90 (source for f90 USE modules). You would find the appropriate files which contain declarations of the MKL functions you are using, and INCLUDE or USE them in your own source code. For the USE files, you need to compile the source file from the include directory along with your own source code, or first compile the include source file and put the resulting .mod file in the mkl include directory or in your own build directory.
Some of the functions are covered by both USE and INCLUDE files, some by only one or the other. They all contain f90 INTERFACE declarations, and should work with the USE or INCLUDE at the top of your subroutine, before all declarations. There are some examples in the mkl installation.
In the latest versions of the MKL provided with Intel compilers, under /mkl/include/em64t there are ilp64 and lp64 directories of compiled .mod files. You would need to specify the ilp64 or lp64 path in your USE, according to the library you intend to link.
When you have the USE or .fi files corresponding to the MKL functions you call, the compiler will check your data types and numbers of arguments automatically, so you don't have to worry about those particular errors.
0 Kudos
zyserman
Beginner
482 Views
Quoting - tim18
Quoting - zyserman

Hi Tim, thanks for your answer. It has helped me to find some mistakes in my code, but still I have some problems. As I am rather a newbie, could you please tell me what are the optional USE or .fi machinery,
and where can I read about them?

In the include directory of your mkl installation there are several .fi (f77 style include) and .f90 (source for f90 USE modules). You would find the appropriate files which contain declarations of the MKL functions you are using, and INCLUDE or USE them in your own source code. For the USE files, you need to compile the source file from the include directory along with your own source code, or first compile the include source file and put the resulting .mod file in the mkl include directory or in your own build directory.
Some of the functions are covered by both USE and INCLUDE files, some by only one or the other. They all contain f90 INTERFACE declarations, and should work with the USE or INCLUDE at the top of your subroutine, before all declarations. There are some examples in the mkl installation.
In the latest versions of the MKL provided with Intel compilers, under /mkl/include/em64t there are ilp64 and lp64 directories of compiled .mod files. You would need to specify the ilp64 or lp64 path in your USE, according to the library you intend to link.
When you have the USE or .fi files corresponding to the MKL functions you call, the compiler will check your data types and numbers of arguments automatically, so you don't have to worry about those particular errors.

0 Kudos
Reply