Example:
How to use Lapack on the IBM-cluster
The program below can be compiled and linked, either with ATLAS or with
Lapack. It works both in 32 and 64 bit mode.
- To compile and link with Lapack:
- xlf_r linear.f -L/usr/local/lib -llapack -lessl
-
- To compile and link with ATLAS
- xlf_r linear.f -L/usr/local/ATLAS/lib -llapack -lcblas -lf77blas -latlas
The program linear.f
program linear
parameter (isize=3)
external sgesv
real A(isize,isize), b(isize), AT(isize*isize)
integer i, j, c1, c2, pivot(isize), ok
data A /3.1, 1.3, -5.7,
& 1.0, -6.9, 5.8,
& 3.4, 7.2, -8.8/
data b / -1.3, -0.1, 1.8 /
C Transpose
do 100, i=1,isize
do 101, j=1,isize
AT(j+isize*(i-1)) = A(i,j)
101 continue
100 continue
c1 = isize
c2 = 1
call sgesv(c1, c2, AT, c1, pivot, b, c1, ok)
C Should output: 1.0 1.0 1.0
write (*,'(3f4.1)') b(:)
end
Back