 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
zwang82
Joined: 14 Oct 2014 Posts: 3
|
Posted: Tue Oct 14, 2014 8:28 pm Post subject: Using BLAS and LAPACK |
|
|
Hi, so I am very new to Fortran and learning to do some simple matrix calculation using LAPACK. I have already downloaded the BLAS and LAPACK library from http://icl.cs.utk.edu/lapack-for-windows/lapack/. I tried to link the library to the program and it told me it does not have any error. And here is what I did to import the library
ftn95 -o lapack_example.f95 /IMPORT_LIB libblas.lib
ftn95 -o lapack_example.f95 /IMPORT_LIB liblapack.lib
The response is NO ERRORS
However, whenever I try to run the program, it gives me an error message "Error 29, Call to missing routine: _DGEMV at 0x004010e5".
And here is my code
program matrixlapack
implicit none
real, dimension(3) :: X=(/1.D0, 2.D0, 3.D0/)
REAL, dimension(3):: Y=(/2.D0, 2.D0, 2.D0/)
real:: Z
CALL DGEMV('N', 1, 3, 1.D0, X, 1, Y, 1, 0.D0, Z, 1)
PRINT *, Z
STOP
END
Can anyone tell me what's wrong? Thank you very much!!  |
|
Back to top |
|
 |
zwang82
Joined: 14 Oct 2014 Posts: 3
|
Posted: Tue Oct 14, 2014 10:28 pm Post subject: |
|
|
Maybe a better question to ask is how do I complie LAPACK using silverfrost? |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Wed Oct 15, 2014 7:32 am Post subject: |
|
|
-o is the same as /old_arrays. Is that what you intend?
/import_lib is for a library using STDCALL. If you compiled using FTN95 without using F_STDCALL then you should not use /import_lib.
I think a correction would be to use /LIBRARY instead and you could probably use the DLL name or the LIB name. If not then try /REF. Either may work. |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2923 Location: South Pole, Antarctica
|
Posted: Fri Oct 17, 2014 6:20 am Post subject: |
|
|
Please post how you succeeded |
|
Back to top |
|
 |
mecej4
Joined: 31 Oct 2006 Posts: 1899
|
Posted: Fri Oct 17, 2014 2:31 pm Post subject: Re: |
|
|
zwang82 wrote: | Maybe a better question to ask is how do I complie LAPACK using silverfrost? | The only routine that you need is ?GEMV, which is in BLAS, not Lapack.
The UTK prebuilt libraries are difficult, if not impossible, to use with FTN95. This is because they were built with and for compilers other than FTN95, and therefore depend on facilities provided in the runtime libraries of those compilers. As they state on their web page, one way to satisfy the dependencies is to install MinGW32 and Gfortran libraries.
For you, the simplest route is to (i) download the BLAS source distribution from http://www.netlib.org/blas/blas.tgz, (ii) extract the files using 7Zip or some such utility, (iii) compile all the source files using FTN95, (iv) package the resulting OBJ files into a library using "slim *.obj /out:BLAS.lib".
Your tiny example program has errors. In particular, you have mixed up REAL and DOUBLE PRECISION types haphazardly.
If your input arrays are of type REAL, the routine to call is SGEMV, not DGEMV. The arguments alpha and beta have to be of type REAL, not double, so the call should read
Code: | CALL SGEMV('N', 1, 3, 1.0, X, 1, Y, 1, 0.0, Z, 1) |
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|