Hello,
I am trying to understand how the Intel MKL works and so i created a small test code that I have cobbled together from the internet to teach myself how the libraries behave so that I can implement the capability in other projects. My code compiles, runs and reports to zero errors but returns the wrong answer for my system. I have to be doing something wrong but I have no idea what that thing is. My test code is below.
PROGRAM PardisoTest
use MKL_PARDISO
IMPLICIT NONE
TYPE(MKL_PARDISO_HANDLE), ALLOCATABLE, DIMENSION(:) :: PT
INTEGER, ALLOCATABLE, DIMENSION(:) :: idum
INTEGER, ALLOCATABLE, DIMENSION(:) :: ivect
INTEGER, ALLOCATABLE, DIMENSION(:) :: jvect
REAL, ALLOCATABLE, DIMENSION(:) :: b
REAL, ALLOCATABLE, DIMENSION(:) :: a
REAL, ALLOCATABLE, DIMENSION(:) :: x
REAL, ALLOCATABLE, DIMENSION(:) :: solution
REAL, ALLOCATABLE, DIMENSION(:) :: error
REAL, ALLOCATABLE, DIMENSION(:) :: ddum
INTEGER :: maxfct, mnum, mtype, phase, nrhs, ierr, msglvl, i, nnz, nequations
INTEGER, DIMENSION(64) :: iparm
nrhs =1
maxfct = 1
mnum = 1
nnz = 9
nequations = 3
do i = 1, 64
iparm(i) = 0
end do
!
iparm(1) = 0 ! solver default
error = 0 ! initialize error flag
msglvl = 1 ! print statistical information
mtype = 11 ! real unsymmetric --> as an example
ALLOCATE(PT(64))
ALLOCATE(idum(0))
ALLOCATE(ddum(0))
ALLOCATE(b(nEquations))
ALLOCATE(x(nEquations))
ALLOCATE(a(nnz))
ALLOCATE(ivect(nequations+1))
ALLOCATE(jvect(nnz))
ALLOCATE(error(nEquations))
do i = 1, 64
PT(i)%DUMMY = 0
end do
a=(/1,2,3,4,5,6,7,8,9/)
b=(/14,32,50/)
solution = (/1.0, 2.0, 3.0/)
jvect = (/1,2,3,1,2,3,1,2,3/)
ivect = (/1,4,7,10/)
phase = 11
CALL pardiso (PT, maxfct, mnum, mtype, phase, nequations, a, ivect, jvect, idum, nrhs, iparm, msglvl, ddum, ddum, ierr)
!
phase = 22
CALL pardiso (PT, maxfct, mnum, mtype, phase, nequations, a, ivect, jvect, idum, nrhs, iparm, msglvl, ddum, ddum, ierr)
!
phase = 33
CALL pardiso (PT, maxfct, mnum, mtype, phase, nequations, a, ivect, jvect, idum, nrhs, iparm, msglvl, b, x, ierr)
error = solution - x
END PROGRAM PardisoTest
Any help that someone could provide would be greatly appreciated.
Matt