ifort and lapack for dummies

Open discussion regarding features, bugs, issues, vendors, etc.

ifort and lapack for dummies

Postby guillaume » Tue May 30, 2006 2:36 am

Hi

i'm currently trying to improve my fortran code using LAPACK routines. My compiler is ifort. But among the compiler options i've found to invoque lapack (-llapack...) not one worked.
Do you know any website where to understand clearly how to do that or can anyone explain me ? I'd like to found something like : "ifort -o tr.o -llapack tr.f90"...

Guillaume
guillaume
 
Posts: 4
Joined: Tue May 30, 2006 2:29 am

Postby Julien Langou » Tue May 30, 2006 10:13 am

Bonjour Guillaume,
several options:


I see that your main is in Fortran 90, be careful when you call LAPACK or BLAS routines. If you call for example: DGESV( N, NRHS, A, LDA, ... ) then there is lots of chance that your compiler makes a copy of A before calling DGESV. (I do not know specifically about ifort but let's be cautious.)

There is no much way to avoid this if you want to be compatible with the Fortran standard, however you can make some assumptions on the compiler and use a little trick to avoid the copy.

To avoid the copy, just call: DGESV( N, NRHS, A(1,1), LDA, ... ) . The compiler is not going to make any copy in that case.

The problem is that the latter approach ( DGESV( N, NRHS, A(1,1), LDA, ... ) ) assumes that A is stored in a contiguous piece of memory. And this is not necessarily guarantee by allocate. However this has always worked for me in practice.

Julien
Julien Langou
 
Posts: 834
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

Postby guillaume » Wed May 31, 2006 1:23 am

Thanks

now i think lapack is correctly installed. To begin with using lapack, i use such a command:
$ ifort /usr/lib/liblapack.so.2.0 truc.f

is there anything wrong with it (it seems to word with a few examples) ?

Guillaume
guillaume
 
Posts: 4
Joined: Tue May 30, 2006 2:29 am

Postby Julien Langou » Wed May 31, 2006 8:49 am

If your compile line works with some examples, you should be good.

Where do you get your liblapack from?
In general you want to make sure you know which BLAS you are using behind LAPACK. In your compile line I do not see which BLAS you are using so I guess it is included in liblapack.so in which case I wonder how much optimized it is.

Also if you want to fully test your liblapack.so you can use the TESTING in the LAPACK distribution.

Julien
Julien Langou
 
Posts: 834
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

Postby guillaume » Wed May 31, 2006 9:03 am

I have run BLAS routines with others examples before, but without any special command line. I juste had to include : external [...] in the fortran code (for example : external dgeem, and nothing special for the compiler : ifort truc.f )
Is that strange ?
I will try to understand where my lapack comes from and to use this TESTING thing, and i reply again.
Thanks
guillaume
 
Posts: 4
Joined: Tue May 30, 2006 2:29 am

Postby guillaume » Wed May 31, 2006 9:32 am

In fact my /usr/lib contains all this things (find /usr/lib -name "*lapack*" -print ):

./atlas/liblapack.so.2.3
./atlas/liblapack.so.3.0
./atlas/liblapack.so.2
./atlas/liblapack.so.3
./liblapack_atlas.so.2.3
./liblapack_atlas.so.2
./liblapack.so.2.0
./liblapack.so.2
./liblapack_atlas.so.3.0
./liblapack_atlas.so.3

Some seem to have the same function according to the examples i have run. I have installed some by myself but perharps some were already there...
guillaume
 
Posts: 4
Joined: Tue May 30, 2006 2:29 am


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 4 guests