blas, lapack, fortran and FC5
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2006
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    blas, lapack, fortran and FC5

    Hi all,

    I am new to Linux and Fortran programming. I have started my work using Intel ifort and the gfortran compiler. I have blas and lapack installed from extras repo.

    I am unable to link BLAS LAPACK using:

    ifort -I/usr/lib prog.f90 -L/usr/lib -lblas -llapack

    The compile is fine without blas or lapack.

    Can anyone help me?
    Please tell me in detail how to?

    Thanks

  2. #2
    Join Date
    Dec 2005
    Location
    EU
    Age
    46
    Posts
    637
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi Atique,

    1. I never used pre-installed blas and lapack libraries, ever included them into my code and compiled them with the code everytime... it is then easier to port the code onto an other platform.

    2. I tested you case and I think your command is wrong. i tried a test program with
    Code:
    ifort -c test.f  -L/usr/lib/ -lblas
    and it worked for me...
    The software required «Windows 98 or better», so I installed Linux.

  3. #3
    Join Date
    Dec 2005
    Location
    EU
    Age
    46
    Posts
    637
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    forgot something...
    you can download the blas and lapack sources (and much more) at

    http://www.netlib.org/blas/
    http://www.netlib.org/lapack/

    I might be a bit tricky to compile it for the first time but believe me it is simple and comfortable to use it as source if you need to use the code on different platforms or machines.
    in my case, it is needed on windows, linux, alpha and nec-sx...

    have a lot of fun!
    The software required «Windows 98 or better», so I installed Linux.

  4. #4
    Join Date
    Nov 2005
    Location
    Los Angeles area
    Posts
    887
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try the following (as root)
    Code:
    # yum install lapack lapack-devel blas blas-devel

  5. #5
    Join Date
    Apr 2006
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot,
    ifort -c test.f -L/usr/lib/ -lblas
    does not give the error "ld: cannot find -lblas"
    however, now I get this error when using SGESV routine

    truss2d.o: In function `MAIN__':truss2d.f90.text+0x597): undefined reference to `sgesv_'

    Similar error messages appear when I use any of BLAS or LAPACK routines.

    Kindly post some small program (say solution to linear equations A x = b ) using LAPACK, alongwith the compiler command.

    Thanks

  6. #6
    Join Date
    Nov 2005
    Location
    Los Angeles area
    Posts
    887
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try "-llapack -lblas" instead of "-lblas"
    And I don't think you need "-L/usr/lib/"

  7. #7
    Join Date
    Apr 2006
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I dont get any error message when compiling ( -c option) only. It is when I link the libraries blas or lapack that I get the errors like:
    truss2d.o: In function `MAIN__':truss2d.f90: (.text+0x597): undefined reference to `sgesv_'

    What could I be doing wrong...?

  8. #8
    Join Date
    Nov 2005
    Location
    Los Angeles area
    Posts
    887
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check the compiler for use of underscores. Some compilers will compile
    fortran fuction "abc" to "abc_". For example, the gfortran compiler has the
    options "-fno-underscoring" and "-funderscoring".

    Well, now I take that back. The lapack on my machine has:
    Code:
    # nm liblapack.a | grep sgesv
    dsgesv.o:
    00000000 T dsgesv_
    sgesvd.o:
    00000000 T sgesvd_
    sgesv.o:
    00000000 T sgesv_
    sgesvx.o:
    00000000 T sgesvx_
    Are you linking with "-llapack -lblas" ?

Similar Threads

  1. Lapack
    By GammaPoint in forum Using Fedora
    Replies: 1
    Last Post: 25th June 2007, 04:02 AM
  2. How do I use LAPACK?
    By seanie in forum Programming & Packaging
    Replies: 1
    Last Post: 29th June 2005, 02:20 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •