- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, everyone!
I used a subroutine named 'spevd' (in Fortran 95 syntax) provided in Intel MKL for Linux to obtain eigenvalues of a real symmetric matrix. The source code and Makefile are attached below. The problem that I encountered was the static executable was OK, but dynamic executable could cause segmentation fault.
Suggestions are appreciated!
Thank you!
! More detailed information goes here!
The OS and ifort version are:
abc@debian:~/test/eigentest$ uname -a
Linux debian 2.6.26-1-amd64 #1 SMP Sat Jan 10 17:57:00 UTC 2009 x86_64 GNU/Linux
abc@debian:~/test/eigentest$ ifort -V
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.0 Build 20081105 Package ID: l_cprof_p_11.0.074
Copyright (C) 1985-2008 Intel Corporation. All rights reserved.
The fortran source code is:
abc@debian:~/test/eigentest$ cat eigentest.f90
program eigentest
! This program is used to calculate the eigenvalues of a symmetric
! matrix mat(6,6).
use mkl95_precision, only: wp => sp
use mkl95_lapack, only: spevd
implicit none
integer,parameter::n=6,pklen=(1+n)*n/2
! matev(n) is the eigenvalues of mat(n,n).
real::mat(n,n),matev(n)
integer::r,c,err,k
real,allocatable::matpk(:)
data ((mat(c,r),c=1,r),r=1,6) &
& / 1.81311, &
& -0.19827, 1.21229, &
& -0.26697, 0.14556, 1.30019, &
& 0.00000, 0.00000, 0.00000, 2.00000, &
& 0.33784, 0.92300, 0.06331, 0.00000, 0.83720, &
& 0.33784,-0.20619, 0.90189, 0.00000,-0.05861, 0.83720 /
do r=1, n-1
do c=r+1, n
mat(c,r)=mat(r,c)
enddo
enddo
write(*,"('----------------------------',/,'MAT(6,6)')")
write(*,"(6F10.5)") mat
allocate(matpk(pklen),stat=err)
if (err/=0) then
write(*,"('The band storage of MAT(6,6) failed (stat= ',I3,').')") err
stop
endif
! matpk(pklen) is a packed storage of mat(n,n)
do r=1, n
k=r*(r-1)/2
matpk(1+k:r+k) = mat(1:r,r)
enddo
write(*,"('----------------------------',/,'MAT(6,6) Packed Storage')")
write(*,"(7F10.5)") matpk
call spevd(matpk, matev)
write(*,"('----------------------------',/,'Eigenvalues of MAT(6,6)')")
write(*,"(6F10.5)") matev
stop
end
The Makefile is:
abc@debian:~/test/eigentest$ cat Makefile
FC = ifort
MKLOPT = -lmkl_lapack95
SLIBS = -lguide -lpthread
LDFLAGS = -L$(MKLPATH)
INFLAGS = -I$(MKLINCLUDE)
static:
$(FC) eigentest.f90 $(LDFLAGS) $(INFLAGS) $(MKLOPT) \
-Wl,--start-group \
$(MKLPATH)/libmkl_intel_lp64.a \
$(MKLPATH)/libmkl_intel_thread.a \
$(MKLPATH)/libmkl_lapack.a \
$(MKLPATH)/libmkl_em64t.a \
$(MKLPATH)/libmkl_core.a \
-Wl,--end-group \
$(SLIBS) -o eigentest.exe
dynamic:
$(FC) eigentest.f90 $(LDFLAGS) $(INFLAGS) $(MKLOPT) \
-lmkl_intel_lp64 \
-lmkl_intel_thread \
-lmkl_lapack \
-lmkl_em64t \
-lmkl_core \
$(SLIBS) -o eigentest.exe
I used a subroutine named 'spevd' (in Fortran 95 syntax) provided in Intel MKL for Linux to obtain eigenvalues of a real symmetric matrix. The source code and Makefile are attached below. The problem that I encountered was the static executable was OK, but dynamic executable could cause segmentation fault.
Suggestions are appreciated!
Thank you!
! More detailed information goes here!
The OS and ifort version are:
abc@debian:~/test/eigentest$ uname -a
Linux debian 2.6.26-1-amd64 #1 SMP Sat Jan 10 17:57:00 UTC 2009 x86_64 GNU/Linux
abc@debian:~/test/eigentest$ ifort -V
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.0 Build 20081105 Package ID: l_cprof_p_11.0.074
Copyright (C) 1985-2008 Intel Corporation. All rights reserved.
The fortran source code is:
abc@debian:~/test/eigentest$ cat eigentest.f90
program eigentest
! This program is used to calculate the eigenvalues of a symmetric
! matrix mat(6,6).
use mkl95_precision, only: wp => sp
use mkl95_lapack, only: spevd
implicit none
integer,parameter::n=6,pklen=(1+n)*n/2
! matev(n) is the eigenvalues of mat(n,n).
real::mat(n,n),matev(n)
integer::r,c,err,k
real,allocatable::matpk(:)
data ((mat(c,r),c=1,r),r=1,6) &
& / 1.81311, &
& -0.19827, 1.21229, &
& -0.26697, 0.14556, 1.30019, &
& 0.00000, 0.00000, 0.00000, 2.00000, &
& 0.33784, 0.92300, 0.06331, 0.00000, 0.83720, &
& 0.33784,-0.20619, 0.90189, 0.00000,-0.05861, 0.83720 /
do r=1, n-1
do c=r+1, n
mat(c,r)=mat(r,c)
enddo
enddo
write(*,"('----------------------------',/,'MAT(6,6)')")
write(*,"(6F10.5)") mat
allocate(matpk(pklen),stat=err)
if (err/=0) then
write(*,"('The band storage of MAT(6,6) failed (stat= ',I3,').')") err
stop
endif
! matpk(pklen) is a packed storage of mat(n,n)
do r=1, n
k=r*(r-1)/2
matpk(1+k:r+k) = mat(1:r,r)
enddo
write(*,"('----------------------------',/,'MAT(6,6) Packed Storage')")
write(*,"(7F10.5)") matpk
call spevd(matpk, matev)
write(*,"('----------------------------',/,'Eigenvalues of MAT(6,6)')")
write(*,"(6F10.5)") matev
stop
end
The Makefile is:
abc@debian:~/test/eigentest$ cat Makefile
FC = ifort
MKLOPT = -lmkl_lapack95
SLIBS = -lguide -lpthread
LDFLAGS = -L$(MKLPATH)
INFLAGS = -I$(MKLINCLUDE)
static:
$(FC) eigentest.f90 $(LDFLAGS) $(INFLAGS) $(MKLOPT) \
-Wl,--start-group \
$(MKLPATH)/libmkl_intel_lp64.a \
$(MKLPATH)/libmkl_intel_thread.a \
$(MKLPATH)/libmkl_lapack.a \
$(MKLPATH)/libmkl_em64t.a \
$(MKLPATH)/libmkl_core.a \
-Wl,--end-group \
$(SLIBS) -o eigentest.exe
dynamic:
$(FC) eigentest.f90 $(LDFLAGS) $(INFLAGS) $(MKLOPT) \
-lmkl_intel_lp64 \
-lmkl_intel_thread \
-lmkl_lapack \
-lmkl_em64t \
-lmkl_core \
$(SLIBS) -o eigentest.exe
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, I think I really need to read the Intel MKL User's Guide very carefully!
After I read Chapter 3 and 5, I found the aforementioned problem is in the Makefile.
The corrected one is attached:
abc@debian:~/test/eigentest$ cat Makefile
FC = ifort
MKLOPT = -lmkl_lapack95
SLIBS = -lguide -lpthread
LDFLAGS = -L$(MKLPATH)
INFLAGS = -I$(MKLINCLUDE)
static:
$(FC) eigentest.f90 $(LDFLAGS) $(INFLAGS) $(MKLOPT)
-Wl,--start-group
$(MKLPATH)/libmkl_intel_lp64.a
$(MKLPATH)/libmkl_intel_thread.a
$(MKLPATH)/libmkl_core.a
-Wl,--end-group
$(SLIBS) -o eigentest.exe
dynamic:
$(FC) eigentest.f90 $(LDFLAGS) $(INFLAGS) $(MKLOPT)
-lmkl_intel_lp64
-lmkl_intel_thread
-lmkl_core
$(SLIBS) -o eigentest.exe
After I read Chapter 3 and 5, I found the aforementioned problem is in the Makefile.
The corrected one is attached:
abc@debian:~/test/eigentest$ cat Makefile
FC = ifort
MKLOPT = -lmkl_lapack95
SLIBS = -lguide -lpthread
LDFLAGS = -L$(MKLPATH)
INFLAGS = -I$(MKLINCLUDE)
static:
$(FC) eigentest.f90 $(LDFLAGS) $(INFLAGS) $(MKLOPT)
-Wl,--start-group
$(MKLPATH)/libmkl_intel_lp64.a
$(MKLPATH)/libmkl_intel_thread.a
$(MKLPATH)/libmkl_core.a
-Wl,--end-group
$(SLIBS) -o eigentest.exe
dynamic:
$(FC) eigentest.f90 $(LDFLAGS) $(INFLAGS) $(MKLOPT)
-lmkl_intel_lp64
-lmkl_intel_thread
-lmkl_core
$(SLIBS) -o eigentest.exe
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page