New user: compiling...

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

New user: compiling...

Postby macTeo » Fri Mar 30, 2007 10:46 am

Hi to everybody.

I'm fighting with the second fortran program of my life... so i think my problem should be really elementary...

I'm using the subrutine ssterf tring to evalutate the eigenvalue of a real tridiagonal matrix.

I would use it in my code like:

EXTERNAL :: sscanf
(...)
CALL sscanf(N, D, E, Info)

but how could I compile linking the lapack library?

Well I know, my ways is wrong:
g95 -o eigenX Evalutate_EigenX.F90

I could use ifort on a cluster machine too, but the result'll be the same.

"/sw/lib/odcctools590/bin/ld: Undefined symbols:
_ssterf_"

Thanx a lot for all of you...
macTeo
 
Posts: 4
Joined: Fri Mar 30, 2007 9:53 am
Location: Pavia or Enschede

Postby Julie » Fri Mar 30, 2007 11:38 am

macTEo,

Almost! You just need to add the LAPACK and the BLAS libraries to the compile/linking command.

It should look something like
g95 -o eigenX Evalutate_EigenX.F90 "PATH to LAPACK Library"/"Name of LAPACK library" "PATH to BLAS Library"/"Name of BLAS library"

For example if my LAPACK library is liblapack.a and my BLAS library is libblas.a and they are in /usr/local/lib It will do
g95 -o eigenX Evalutate_EigenX.F90 /usr/local/lib/liblapack.a /usr/local/lib/libblas.a

If you do not need performance, you can use the Reference BLAS (the one provided for LAPACK). On the opposite, if you need performance, you will need to use an optimized BLAS.
Take a look here: http://www.netlib.org/lapack/faq.html#2.5 to get some more information.

Hope it helps
Julie
Julie
 
Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

Postby macTeo » Sat Mar 31, 2007 8:22 am

Thank you for the attention.

I cannot find .a files.
I've got liblapack.dylib and libblas.dylib ones.

Here is the result:

wlan137084:~/Info/ElectronicStructure/Numerical/EX3 matteo$ g95 -o eigenX EigenX.F90 /usr/lib/liblapack.dylib /usr/lib/libblas.dylib
EigenX.F90:426:3: warning: no newline at end of file
/sw/lib/odcctools590/bin/ld: warning multiple definitions of symbol _ssterf_
/var/tmp//ccNst15G.o definition of _ssterf_ in section (__TEXT,__text)
/usr/lib/liblapack.dylib(single module) definition of _ssterf_


:?

Thanx again,
M.
macTeo
 
Posts: 4
Joined: Fri Mar 30, 2007 9:53 am
Location: Pavia or Enschede

Postby Julie » Sat Mar 31, 2007 10:28 am

macTeo,
It looks like you are running Mac OS X, aren't you?
If could seems strange but you have to install the LAPACK library in order to use it.
Or another possibility if you are running Mac OS is to use Vectib.
(Documentation here: http://developer.apple.com/hardwaredriv ... index.html and http://developer.apple.com/hardwaredriv ... rtran.html - they have example to test if Veclib is correctly installed)
try
Code: Select all
 g95 -o eigenX EigenX.F90 -framework vecLIB

or
Code: Select all
 g95 -o eigenX EigenX.F90 -Wl,-framework -Wl,vecLib

Now you can also install "by hand" the LAPACK library.
Download it from http://www.lapack.netlib.org
Copy the make.inc.gfortran from the INSTALL directory to make.inc
cp INSTALL/make.inc.gfortran make.inc
then modify the make.inc to use Veclib
then type make blaslib then make.

You may need to use an optimized blas if you are looking for performance.
See http://www.netlib.org/lapack/faq.html#2.5 for more info.

Regards
Julie
Julie
 
Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

Postby macTeo » Sun Apr 01, 2007 9:41 am

Julie: you are the godness of my day dream!!!

Yes, of course: I'm running mac OsX 10.4.9 on a Intel machine (unfortunately not a ppc one).

Some good news, some bad ones.

- I compile my program without errors using
"g95 -o eigenX EigenX.F90 -framework vecLIB"

- Tring to use the test example for Veclib taken from the developer Apple site, gcc returns to me a great ammount of error

I had tried to install lapack from netlib.org some day ago. I followed instruction similar to yours but I couldn't understand what is "You may need to supply a correct version of second.f and dsecnd.f for your machine." Where could I found that file?
I've skipped all the stuff related to that file... have I lapack installed or not? Could be the no-error-compiling result of my program a proof?

thanx you so much!
macTeo
 
Posts: 4
Joined: Fri Mar 30, 2007 9:53 am
Location: Pavia or Enschede

Postby macTeo » Sun Apr 01, 2007 10:01 am

question: have I lapack installed or not?
answer: I think so!!!

Now also this way is workink good:
g95 -o eigenX EigenX.F90 /usr/lib/liblapack.dylib /usr/lib/libblas.dylib

I'm sorry, I was wrong for other reasons...

gratefull
Matteo
macTeo
 
Posts: 4
Joined: Fri Mar 30, 2007 9:53 am
Location: Pavia or Enschede


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron