Page 1 of 1


PostPosted: Sat Dec 24, 2005 10:26 am
by edf
Hello! I have installed BLAS and LAPACK (libflapack.a) within PETSC-2.3.0 installation. Now I'm installing program which uses PETSC. But this program requires LAPACK to be pre installed. Can I use the one installed with PETSC (fblaslapack)? The program's makefile states:
LAPACKLIB = -llapack.

Could you please help? Thanks in advance!

PostPosted: Sat Dec 24, 2005 1:05 pm
by Julien Langou
Can I use the one installed with PETSC (fblaslapack)?

Yes sure, this should work without any problem.

If the archive is named libflapack.a and is located in the directory LAPACKDIR then you'll need to give its location with an "-LLAPACKDIR"
and its name with an "-lflapack" (for libflapack.a)
So I assume the libflapack.a library is at the same place as the other PETSc libraries so you do not need to specify the -LLAPACKDIR (already done) and thus this:
Code: Select all
LAPACKLIB = -lflapack

should be ok

I do not know however what is libflapack.a, whether it includes a BLAS library or not, check if there is an libfblas.a in this case you certainly will need to add a "-lfblas" I guess...

you can read as well


PostPosted: Sat Dec 24, 2005 1:33 pm
by edf
Julien! Thanks for your reply.

Yes,there is BLAS library libfblas.a.

in this case you certainly will need to add a "-lfblas" I guess...

Add here I assume (when linking LAPACK)?.. Or?..
pgm_driver: pgm_driver.o $(objfiles)
$(CC) -o $@ $^ $(LAPACKLIB)$(lobpcglibLDFLAGS)

Thanks again!

PostPosted: Sat Dec 24, 2005 6:05 pm
by Julien Langou
I did not try but I would say:

in the definition of LAPACKLIB you add libflapack.a and libfblas.a
Code: Select all
LAPACKLIB = -lflapack -lfblas

I would put a space between $(LAPACKLIB) and $(lobpcglibLDFLAGS), although this might work without, I do not know what is $(lobpcglibLDFLAGS), I guess it's a kind of "-lm" in this case, it is fine after LAPACKLIB.

Note that if LAPACK has been compiled with the Fortran compiler then you'll certainly want to add a kind of "-lg2c" as well (-lg2c for g77/gcc for example, you put it at the end of the compilation line). Or more easily, you change $(CC) by $(F77) when you are making the executable.
If it's a C version of LAPACK then you should be fine with the $(CC).

And finally once everything is working, you certainly will want to have an optimized BLAS library instead of libfblas.a. See:
but that will be for after something's working.


PostPosted: Sun Dec 25, 2005 12:49 pm
by edf
I decided to install LAPACK provided as RPM. And all works now. Julien, thanks for support!!