Community
cancel
Showing results for 
Search instead for 
Did you mean: 
WSinc
New Contributor I
110 Views

How do I use those LAPACK and/or BlAS routines?

Nowhere does it tell us what USE statements to put into our source code.

at least nothing that works.

 

I tried USE LAPACK, LAPACK95, BLAS, BLAS95, and 

include MKL.FI

None of those will compile.

Why dont they give ONE example of something that actually works ?

0 Kudos
19 Replies
WSinc
New Contributor I
110 Views

This source code does not compile:

 

Program main
    use lapack95
    use f95_precision
    real(8) x(4)
    data x/-1,-0.5,0.5,1/
    real(8) y(4,5),z(4)
    
    data y/20*0.0/,z/4*1.0/
    call gesv(Y,5,Z)
end

It tells me "check include statements"

Why doesn't the compiler recognize those?

Should I get the premium support package?

WSinc
New Contributor I
110 Views

Actually, we went thru this back in August, and it was a long and complicated process finally getting it to work.

I installed the latest version of the MKL, and it has the same issues as before.

 

Well, I can go back to that, but I am wondering why no one bothered to improve this interface.

mecej4
Black Belt
110 Views

You can find a description of which USE statements give access to Lapack-95 in the MKL manual at https://software.intel.com/en-us/node/468668#ACDBFCE7-4EF8-48F7-80A5-0ED2F6E3BAA5 .

Your arguments to gesv() are wrong. For a description of the correct arguments, see the bottom of the following page: https://software.intel.com/en-us/node/468876 . For GESV to work, the matrix must be square and nonsingular.

Here is a complete example:

Program main
    USE LAPACK95, ONLY: GESV
    integer, parameter :: n = 4
    real(8) :: b(n), x(n)
    real(8) :: A(n,n)
    
    do i = 1, n
    	A(i,1:i-1) = -1d0
    	A(i,i+1:n) = -1d0
    	A(i,i) = 5d0
    	b(i)   = i
    end do
    x = b
    call gesv(A,x)
    print *,x
end

 

WSinc
New Contributor I
110 Views

That stuff they tell me does not work -

I tried that before.

This does not compile:

program trap
  use lapack95, only: gesv

end

Is there someone there who knows the correct answer ?

WSinc
New Contributor I
110 Views

That  "complete example" does not compile either.

It does not connect to the library from the USE statement, it does not know anything about it.
 
Is there a way to get remote access. rather than endless guessing ?
 
 
WSinc
New Contributor I
110 Views

Actually, there are three library directories that have stuff installed with very similar names - - 

It appears that the LAPACK stuff may have gotten put into the wrong place when I installed it.

 

so where is it actually supposed to be ? I had no control over that - - 

 

anyway, the issue is not about how I called the routine, but actually getting the linker to connect to it

to start with. When you specify a USE statement, the compiler is supposed to know where to get the entry points,

and apparently, the installation of the MKL libraries does not connect the two.

WSinc
New Contributor I
110 Views

Something really weird --

I went back to the computer that had a working version of the program in it, back in August.

But when I start a NEW project, it no longer compiles, using the very same USE statements.

 

Why would an OLD project compile, while a new one does NOT compile ???

I am wondering if there was something special i had to put into the project properties back in August,

and did not do the same thing for the new project. But the write-ups dont specify anything like that.

 

There are both on the very same computer, BTW.

mecej4
Black Belt
110 Views

To use any MKL routines in a Fortran program, use the /Qmkl option at the command line or make the appropriate selection in Visual Studio.

WSinc
New Contributor I
110 Views

OK, I will try that - where do I put that /Qmkl option ?

 

Apparently is it not enough to have the correct USE statements?

mecej4
Black Belt
110 Views

In Visual Studio, for the configuration that you wish to use (Release or Debug), in the project property pages click on Configuration Properties:Fortran:Libraries:Use Intel Math Kernel Library, and in the drop-down list that appears, choose "Sequential".

Alternatively, look at the item below "Libraries", named "Command Line". You can add /Qmkl there.

Steven_L_Intel1
Employee
110 Views

You shouldn't add /Qmkl to the command line if you set the project property "Use Intel Math Kernel Library"

mecej4
Black Belt
110 Views

Is there some URL where one can look up differences in the project properties menus between different versions of Visual Studio? As of now, I can only look at the properties listed in my installed version of VS and hope that they would not be much different in a different version of VS.

Gennady_F_Intel
Moderator
110 Views

please have a look at the KB article follow this link 

https://software.intel.com/en-us/articles/how-to-use-lapack95 ;

hope that helps to start lapack95 examples.

Ondrej_R_
Beginner
110 Views

I have also the same problem. I have Intel Parallel Studio XE 2015 Composer Edition for Fortran Windows* in Visual Studio 2010. I want to use MKL LAPACK95 in Win32, specific subroutine getrs to solve linear equations. I tried many many possibilities writen in this forum, MKL userguide and help. Nothing function. There are always some errors and it seems there is no easy way to use MKL LAPACK95.

I think it is a pitty because it should be very easy to set everything and it should be functioning example in userguide or help.

In project property> fortran>libraries I should switch "use intel math kernel library" to sequential. Should I write to main program something like include 'mkl_lapack.fi' or external GETRS or USE LAPACK95 ?

Even if i switched to use the sequentional usage of MKL, should i manualy write some path somewhere or names of specific libraries? I tried many things and it doesn't function. So please help me to make it correctly.

Thank you very much

Ondrej Rozum

Doosan SKODA Power

SW analyst

mecej4
Black Belt
110 Views

Did you try the Web page that Gennady Fedorov listed in #14? If you get error messages, you should note them down and post them along with a description of the circumstances.

Look in the ...\Composer XE 2015\mkl\include\<arch> directory on your computer, where <arch> is either "ia32" or "intel64", for module files whose names contain "95". Those are the modules that you will need to USE in your Fortran sources if you want to use MKL routines with the Fortran 95 interfaces.

For linking, consult the MKL Link Line Advisor, which is installed in your Start Menu, or use the Web version at https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor .

Earlier in this thread and elsewhere there have been discussions of how to configure Visual Studio to enable access to the necessary modules, libraries and DLLs in a project. The details may slightly vary with target architecture, Visual Studio version and compiler/MKL versions. The number of possible combinations is too many to list every one of them, but it is not too difficult to work out what needs to be done.

Ying_H_Intel
Employee
110 Views

Hi OndrejR,

If you have USE LAPACK95, , you don't need to write include 'mkl_lapack.fi' or external GETRS

we create one article to address the issue.  https://software.intel.com/en-us/articles/how-to-use-lapack95

You may refer to the last screencopy  and change your project property,  at least

1) In project Properties page, select Fortran » Libraries >> Use Intel Math Kernal Library : Parallel (/Qmkl:parallel)  or other

2) Select Linker » Input, and then in Additional Dependencies add the Intel® MKL libraries:

mkl_lapack95_lp64.lib  (mkl_lapack95.lib if 32bit) 

Please let us know if any problem.

Regards,

Ying

Frank_M
Beginner
110 Views

One of the issue my be that lapack wants precision specified with SP or DP

    USE f95_precision, ONLY: WP => DP
    USE lapack95, ONLY: HSEQR    


    COMPLEX(WP),    DIMENSION(:,:),         ALLOCATABLE     :: matrixA
    COMPLEX(WP),    DIMENSION(:),           ALLOCATABLE     :: roots

    CALL HSEQR(matrixA, roots)

  It won't compile if you use numbers 8 or 16. (It used to)

Hope this helps.

mecej4
Black Belt
110 Views

Frank_M wrote:

One of the issue my be that lapack wants precision specified with SP or DP

    USE f95_precision, ONLY: WP => DP
    USE lapack95, ONLY: HSEQR    

    COMPLEX(WP),    DIMENSION(:,:),         ALLOCATABLE     :: matrixA
    COMPLEX(WP),    DIMENSION(:),           ALLOCATABLE     :: roots

    CALL HSEQR(matrixA, roots)

  It won't compile if you use numbers 8 or 16. (It used to)

The conclusion stated in the last line is not completely correct, and can be misleading.

COMPLEX(16) variables cannot be used as arguments to MKL routines because MKL does not support quadruple precision. COMPLEX(16) is the same as the F77 type COMPLEX*32; see my comment in your other thread, https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/601249#comment-1853935 .

TimP
Black Belt
110 Views

MKL supports COMPLEX(REAL32) and COMPLEX(REAL64), where USE iso_fortran_env gives those the values 4 and 8.  I don't know how you might have been able to make MKL work with kind=16.  As mecej4 pointed out, complex*16 (not F77 but a common extension) is the same as COMPLEX(REAL64).

Reply