Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

quad precision -- natlib -- mkl

diedro
Beginner
1,044 Views
Dear All,
I would like to compile my source code with double precision. However, I have to useGETRI andGETRF.
TimP suggested me to use "netlib functions".
I usually compile with:
[bash] ifort -r8 -i8 *.f90 -L$MKLPATH/lib/em64t  -lmkl_blas95_ilp64 -lmkl_lapack95_ilp64 -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lpthread -warn all -check all -debug all[/bash]
Is it possible to do the same withnetlib in intel fortran?
Thank to every one
0 Kudos
9 Replies
mecej4
Honored Contributor III
1,044 Views
Your request is somewhat inconsistent. The title talks about quad precision, but in the body you mention wanting double precision, and the use of the -r8 option suggests that you wish to promote source code written for single-precision to double precision. I do not know why you use the -i8 option.

You do not have to use Netlib source code. Here is an example of using GETRF.

[fortran]program invert
use mkl95_lapack,only : getrf,getri
implicit none
integer, parameter :: N = 7
integer :: i,j
double precision, dimension(N,N) :: A = &
  (/ 1.0658d0,   -0.6313d0, 0.0000d0, 0.0000d0, 0.0000d0, 0.0000d0, 0.0000d0, &
   -0.6313d0, 4.2632d0,  -1.8940d0, 0.0000d0, 0.0000d0, 0.0000d0, 0.0000d0, &
  0.0000d0,  -1.8940d0, 8.5265d0,  -3.1567d0, 0.0000d0, 0.0000d0, 0.0000d0, &
  0.0000d0, 0.0000d0,  -3.1567d0,  23.2603d0,  -3.6892d0, 0.0000d0, 0.0000d0, &
  0.0000d0, 0.0000d0, 0.0000d0,  -3.6892d0,  37.5680d0, -4.8192d0, 0.0000d0, &
  0.0000d0, 0.0000d0, 0.0000d0, 0.0000d0,  -4.8192d0,  47.5467d0,  -5.9492d0, &
  0.0000d0, 0.0000d0, 0.0000d0, 0.0000d0, 0.0000d0,  -5.9492d0,  57.5255d0 /)
integer, dimension(N) :: piv
integer :: info

call getrf( a, piv, info )
call getri( a, piv, info )
write(*,10)((a(i,j),j=1,N),i=1,N)
stop

10 format(1x,7F12.6)
end program invert
[/fortran]
0 Kudos
diedro
Beginner
1,044 Views
hi,
my fault, really sorry.
I would like to compile as:
[bash]ifort -r16 *.f90 -L$MKLPATH/lib/em64t  -lmkl_blas95_ilp64 -lmkl_lapack95_ilp64 -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lpthread -warn all -check all -debug all
[/bash]
so quad precision.
Now concerning -i8
Consider the following program:
[bash]PROGRAM TestPrecisione
USE lapack95
INTEGER    ::i
REAL       ::r
INTEGER                 :: info
INTEGER, DIMENSION(3)   :: IPIV
REAL,    DIMENSION(3,3) :: INV
i=3
r=3
write(*,*) INT
CALL GETRI(INV,IPIV,info)
CALL GETRF(INV,IPIV,info)
ENDPROGRAM[/bash]
If I compile with
[bash]ifort -r8 *.f90 -L$MKLPATH/lib/em64t  -lmkl_blas95_ilp64 -lmkl_lapack95_ilp64 -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lpthread -warn all -check all -debug all[/bash]
I get the errors:
[bash]There is no matching specific subroutine for this generic subroutine call.   [GETRI]
CALL GETRI(INV,IPIV,info)
-----^
error #6285: There is no matching specific subroutine for this generic subroutine call.   [GETRF]
CALL GETRF(INV,IPIV,info)
[/bash]
it seems to work only with -i8
0 Kudos
pbkenned1
Employee
1,044 Views
It only works with -i8 because you're linking against the 64-bit integer MKL libraries (the *ilp64 libraries), but you've declared standard 32-bit integers. You should either declare your integers as 64-bit (INTEGER(8) :: iFoo)), or link against the 32-bit MKL libraries (the *lp64 libraries). I chose the latter option

$ ifort -V

Intel Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.1.1.256 Build 20111011

$ ifort U101663.f90 -L$MKLROOT/lib/intel64 -I$F95ROOT/include/intel64/lp64 -lmkl_lapack95_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -o U101663.x

$ ./U101663.x

3

$


P.S. -- I'm not sure it's safe to use -i8 with source declared 32-bit integers && link against the *ilp64 MKL libraries. I'll try to confirm.

Patrick Kennedy
Intel Developer Support
0 Kudos
TimP
Honored Contributor III
1,044 Views
Source built with -i8, linking to MKL ilp64, is a model on which many customers rely. It requires use of the Intel64 compiler throughout and the 64-bit OS.
0 Kudos
diedro
Beginner
1,044 Views
hi,
thank you.
I would like to compile with only -r8
I tryed with:
[bash]
ifort -r8 *.f90 -L$MKLPATH -I$MKLROOT -lmkl_blas95_lp64 -lmkl_lapack95_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -warn all -check all -debug all -o prova.exe
[/bash]
[bash]
[/bash]
However I get the same error
Is the link wrong?
Thank a lot
0 Kudos
TimP
Honored Contributor III
1,044 Views
You have omitted the required -lmkl_intel_lp64.
0 Kudos
diedro
Beginner
1,044 Views
Hi,
my fault:
I went to bash file and I change the path:
[bash]PATH="/opt/intel/composerxe-2011.0.084/mkl/bin/intel64$PATH"
source /opt/intel/composerxe-2011.0.084/mkl/bin/mklvars.sh intel64 mod lp64
export PATH[/bash]
Now it seems to work
Regarding the initial question. How can have quad precision (I need to invert a Square matrix) ?
Thanks a lot
0 Kudos
TimP
Honored Contributor III
1,044 Views
MKL doesn't offer any quad precision libraries. You're free to compile the subroutines of your choice from open source code.
0 Kudos
mecej4
Honored Contributor III
1,044 Views
> You're free to compile the subroutines of your choice from open source code.

True, but there is no guarantee that any Lapack algorithm when run with auto-promotion to quad-precision will deliver results with more precision than double-precision.

Performing iterative refinement using quad-precision and starting with double-precision results may suffice in some cases.

0 Kudos
Reply