- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[bash]icl prog.c /Qmkl[/bash]
or,
[bash]ifort prog.f /Qmkl[/bash]
That's the easiest way if you are using one of the latest Intel compilers on Windows*. There are similar compiler options for Linux* and Mac OS* X as well.
Another easy way is to use our new dynamic linking model which requires a link to just one library. Add mkl_rt.lib to your Windows* link line or add -lmkl_rt to your Linux* or Mac OS* X link line.
These new options willwork for the cases usedby most users. Those who use less common interfaces or threading models may still want to visit the Link Line Advisor to find the right set of libraries.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The easiness claim was made with two explicit conditions:
1. "These new options will work for the cases used by most users."
AND
2. The current Intel compilers are used.
I have found no example for which the /Qmkl (-mkl on Linux/OSX) option did not work. If you have such examples I am sure that they will be given adequate attention if you divulge them here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. "These new options willwork for the cases usedby most users."
AND
2. The current Intel compilers are used.
I have found no example for which the /Qmkl (-mkl on Linux/OSX) option did not work. If you have such examples I am sure that they will be given adequate attention if you divulge them here.
As a matter of fact, I think I found an example (literally from the mkl/examples directory) where these options were unsuccessful.
I'm using (ifort -V):
Intel Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.1.4.319 Build 20120410
which I think is the latest version.
Take a look at my post here:
http://software.intel.com/en-us/forums/showthread.php?t=105667&o=a&s=lr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using the Fortran 95 interfaces requires the MKL Lapack95 and Blas95 libraries to be specified at link time, and requires specifying the path for the module files when calling from Fortran-9X.
Earlier releases of MKL came with no prebuilt Lapack95 and Blas95 libraries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I used the Link line advisor, to build a link line for my application, with PARDISO, it gave this line
-L$(MKLROOT)/lib/intel64 -lmkl_scalapack_ilp64 -lmkl_cdft_core -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_ilp64 -lpthread -lm
With this compiler option :
-openmp -DMKL_ILP64 -I$(MKLROOT)/include
I created this makefile :
CFLAGS = -Wall -O3 -I ../../../SPOOLES-2.2_Intel -I /opt/intel/mkl/include -DMKL_ILP64 -DARCH="Linux" -DSPOOLES -DARPACK -DPARDISO -DMATRIXSTORAGE -DUSE_MT=1
FFLAGS = -O3 -nofor-main -openmp
CC=icc
FC=ifort
.c.o :
$(CC) $(CFLAGS) -c $<
.f.o :
$(FC) $(FFLAGS) -c $<
include Makefile.inc
SCCXMAIN = ccx_2.5.c
OCCXF = $(SCCXF:.f=.o)
OCCXC = $(SCCXC:.c=.o)
OCCXMAIN = $(SCCXMAIN:.c=.o)
DIR=/home/alex/Desktop/Buildfactory/Calculix/SPOOLES-2.2_Intel
MKLROOT=/opt/intel/mkl
MKLPATH=/opt/intel/mkl/lib/intel64
MKLINCLUDE=/opt/intel/mkl/include
LIBS = \
$(DIR)/libspooles.a \
$(DIR)/MT/src/spoolesMT.a \
../../../ARPACK_Intel/libarpack_Linux.a \
../../../Pardiso/libpardiso412-INTEL120-X86-64.so \
-lm -lc -lutil -ldl -lpthread
ccx_2.5: $(OCCXMAIN) ccx_2.5.a -L$(MKLROOT)/lib/intel64 -lmkl_scalapack_ilp64 -lmkl_cdft_core -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_ilp64 -lpthread -lm $(LIBS)
./date.pl; $(CC) $(CFLAGS) -c ccx_2.5.c; $(FC) $(FFLAGS) -o $@ $(OCCXMAIN) ccx_2.5.a -L$(MKLROOT)/lib/intel64 -lmkl_scalapack_ilp64 -lmkl_cdft_core -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmp$
ccx_2.5.a: $(OCCXF) $(OCCXC)
ar vr $@ $?
when i type Make this gives me an error :
alex@iskandhar:~/Desktop/Buildfactory/Calculix/CalculiX/ccx_2.5_Intel_Pa/src$ make
make: *** No rule to make target `-L/opt/intel/mkl/lib/intel64', needed by `ccx_2.5'. Stop.
alex@iskandhar:~/Desktop/Buildfactory/Calculix/CalculiX/ccx_2.5_Intel_Pa/src$
Where is my mistake..?
I understand nothing of makefiles, all i know is that i have to link with Intel compiled Spooles, Arpack, and Pardiso, all the sources have been compiled with icc and ifort
Can someone help me in this..?
BR
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
In the makefile you need the only two `$(OCCXMAIN) ccx_2.5.a' dependencies for target ccx_2.5. So the line should be as follows:
ccx_2.5: $(OCCXMAN) ccx_2.5.a
Also please double check used MKL libraris. E.g. there is incorrect -lmkl_blacs_intelmp$ in your post
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to reference these from a Fortran program?
I looked under PROJECT PREPERTIES, under FORTRAN,
and I jet FOUR possible choices. How would I know which one ?
Pr does it matter?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just can't compile/link, with the lastest software, an old program that I made in 2006, and I need to continue.
Having linking problems, I started trying to compile/link spsv.f90 example in different ways -mkl option, link advisor and other. But I allways have problems.
In my application (several modules) the only problem listed in compiling time is about the line:
call spgvx(mesh%K, aux, eigen(1:15) ,itype=1 ,uplo='U' ,il=1 ,iu=15 ,m=inf1 ,info=inf2) !I've tryed changing mesh%K from pointer array to allocatable array, but it didn't make any difference (the working original was pointer array).
At the head I've called the correct "use" statement, the worked in the past
program axis_fem
!library callings
use IFPORT !similar to dflib
use mkl95_PRECISION, ONLY: WP=>SP
use mkl95_LAPACK !similar to IMSL
-mkl doesn't work to spsv.f90 neither to my application
the following compiling failed both my application and the example (changes in file names were needed to the example)
#Multi thread lp64
ifort -w $MKLROOT/lib/intel64/libmkl_blas95_lp64.a $MKLROOT/lib/intel64/libmkl_lapack95_lp64.a -Wl,--start-group $MKLROOT/lib/intel64/libmkl_intel_lp64.a $MKLROOT/lib/intel64/libmkl_intel_thread.a $MKLROOT/lib/intel64/libmkl_core.a $MKLROOT/lib/intel64/libmkl_blacs_intelmpi_lp64.a -Wl,--end-group -liomp5 -lpthread -lm aux_math.f90 isoemat.f90 enodea.f90 TransfInterp.f90 equad9a.f90 emesha.f90 bondariesa.f90 dynamics.f90 postprocessing.f90 axis_condini.f90 -o axis.exe -i8 -I$MKLROOT/include/intel64/lp64 -I$MKLROOT/include
#single thread
#ifort $MKLROOT/lib/intel64/libmkl_blas95_lp64.a $MKLROOT/lib/intel64/libmkl_lapack95_lp64.a -Wl,--start-group $MKLROOT/lib/intel64/libmkl_intel_lp64.a $MKLROOT/lib/intel64/libmkl_sequential.a $MKLROOT/lib/intel64/libmkl_core.a $MKLROOT/lib/intel64/libmkl_blacs_intelmpi_lp64.a -Wl,--end-group -lpthread -lm aux_math.f90 isoemat.f90 enodea.f90 TransfInterp.f90 equad9a.f90 emesha.f90 bondariesa.f90 dynamics.f90 postprocessing.f90 axis_condini.f90 -o axis.exe -I$MKLROOT/include/intel64/lp64 -I$MKLROOT/include
#single dynamic
#ifort -L$MKLROOT/lib/intel64 $MKLROOT/lib/intel64/libmkl_blas95_lp64.a $MKLROOT/lib/intel64/libmkl_lapack95_lp64.a -lmkl_rt -lpthread -lm aux_math.f90 isoemat.f90 enodea.f90 TransfInterp.f90 equad9a.f90 emesha.f90 bondariesa.f90 dynamics.f90 postprocessing.f90 axis_condini.f90 -o axis.exe -I$MKLROOT/include/intel64/lp64 -I$MKLROOT/include
Can somebody help me please.
I know that there is a makefile to buid the examples, but it doesn't allow me to find out the problem I'm having.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[bash]ifort -mkl spsv.f90 -lmkl_lapack95
[/bash]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks mecej4, but it haven't worked yet.
"arantes@arantes:~/PROGRAMACAO/mestrado$ ifort -mkl spsv.f90 -o spsv.exe -lmkl_lapack95
ld: cannot find -lmkl_lapack95
arantes@arantes:~/PROGRAMACAO/mestrado$ echo $MKLROOT
/opt/intel/composer_xe_2013.3.163/mkl
arantes@arantes:~/PROGRAMACAO/mestrado$ ifort -mkl -lmkl_lapack95 spsv.f90 -o spsv.exe
ld: cannot find -lmkl_lapack95 "
"I can compile and run some lapack routines. I've used a mkl lapack routine (DGEMM) in the attached source code, and I can compile it in a easy way.
"
arantes@arantes:~/PROGRAMACAO$ ifort -mkl testelapack.f90 -o teste.exe -liomp5 -lpthread -lm
arantes@arantes:~/PROGRAMACAO$ ./teste.exe
Top left corner of matrix A:
1. 2. 3. 4. 5. 6.
2001. 2002. 2003. 2004. 2005. 2006.
4001. 4002. 4003. 4004. 4005. 4006.
6001. 6002. 6003. 6004. 6005. 6006.
8001. 8002. 8003. 8004. 8005. 8006.
10001. 10002. 10003. 10004. 10005. 10006.
Top left corner of matrix B:
-1. -2. -3. -4. -5. -6.
-10001. -10002. -10003. -10004. -10005. -10006.
-20001. -20002. -20003. -20004. -20005. -20006.
-30001. -30002. -30003. -30004. -30005. -30006.
-40001. -40002. -40003. -40004. -40005. -40006.
-50001. -50002. -50003. -50004. -50005. -50006.
Top left corner of matrix C:
-2.6667E+13 -2.6667E+13 -2.6667E+13 -2.6667E+13 -2.6667E+13 -2.6667E+13
-6.6647E+13 -6.6647E+13 -6.6647E+13 -6.6647E+13 -6.6647E+13 -6.6647E+13
-1.0663E+14 -1.0663E+14 -1.0663E+14 -1.0663E+14 -1.0663E+14 -1.0663E+14
-1.4661E+14 -1.4661E+14 -1.4661E+14 -1.4661E+14 -1.4661E+14 -1.4661E+14
-1.8659E+14 -1.8659E+14 -1.8659E+14 -1.8659E+14 -1.8659E+14 -1.8659E+14
-2.2657E+14 -2.2657E+14 -2.2657E+14 -2.2657E+14 -2.2657E+14 -2.2657E+14
Example completed.
arantes@arantes:~/PROGRAMACAO$"
I can just type:
"arantes@arantes:~/PROGRAMACAO$ ifort -mkl testelapack.f90 -o teste.exe
arantes@arantes:~/PROGRAMACAO$"
And get the same results (it also retuns a threaded executable for lapack routine, not the openmp part).
I belive that there is some problem related to configuration, that is avoiding me to use the lapack95.
If you have more suggestions I'll be happy to try them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are building a 64-bit target, there are two versions of the Lapack95 libraries, depending on whether you have chosen the LP64 or the ILP64 models. The MKL Link Line Advisor would have given you the correct command line arguments, if you had followed it faithfully. For the simple example that you gave above which uses Lapack95, the command line for LP64 would be
[bash]ifort -mkl spsv.f90 -lmkl_lapack95_lp64[/bash]
The second example that you gave, testelapack.f90, does not use Lapack95 and that is why your build succeeded.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear mecej4
It worked, I'll try to find what is happening to my original program (written and working in 2006), There must be a integer*8 transfered to a routine that spects a integer*4.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear mecej4
Your tip worked to spsv.f90 example. I cant undestand way -lmkl_lapack95 is needed after -mkl that worked fine to a simple gemm test.
But when compiling my old program I get this message:
arantes@arantes:~/PROGRAMACAO/mestrado$ ifort -mkl aux_math.f90 isoemat.f90 enodea.f90 TransfInterp.f90 equad9a.f90 emesha.f90 bondariesa.f90 dynamics.f90 postprocessing.f90 axis_condini.f90 -o axis.exe -lmkl_lapack95_lp64
/tmp/ifortgvLH55.o: In function `dynamics_mp_newmark_':
dynamics.f90:(.text+0x6fb): undefined reference to `sspmv_mkl95_'
dynamics.f90:(.text+0x725): undefined reference to `sspmv_mkl95_'
The original was with spgvx, but the error is the same. All integers were defined as integer*4 to avoid the lp64 vs ilp64 thing.
The commented is the original and the other is the current:
...
!call spgvx(mesh%K, aux, eigen(1:15) ,itype=1 ,uplo='U' ,il=1 ,iu=15 ,m=inf1 ,info=inf2)
call spgv(mesh%K, aux, eigen, itype=1, uplo='U', info=inf2)
...
mesh is a composite type created in one of my modules, that were compiled ok, I can see the *.mod files in the folder. mesh%K is a ponter array with form mesh%K(:).
"type(E_mesh_a),pointer::mesh" as declared in the main program.
Kind Regards.
Arantes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear mecej4
Please forget my last post. Ive forgot to use "-lmkl_blas95_lp64". After typed this, everything worked fine.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
arantesb wrote:
I can't understand way -lmkl_lapack95 is needed after -mkl; that worked fine for a simple gemm test.
The Fortran-95 routines are wrappers around the Fortran-77 routines. As the MKL documentation states, the former have shorter argument lists, may have optional arguments, and a single generic procedure name covers arguments of various real and complex types. Some glue code is needed to decode the input arguments, fill in default values of optional arguments that are not present, allocate work arrays as needed, select and call the Fortran-77 routines that are appropriate for the argument types, and map the results back to the Fortran-95 arguments. This glue code is present in the mkl_lapack95 and mkl_blas95 libraries. If your code makes any calls to routines in these libraries, you must explicitly specify them in the linking command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is an article about custom static linkage for those people who cannot employ the the begin-group / end-group linker options e.g., due to a legacy build system.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page