- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In Intel® MKL mkl_dcscmv and gemv produce different result .
At first,I use the mkl_dcscmv to compute K*X=ANS ,where matrix K(2280,2280) converts to the sparse format CSC (COPPTR,ROWIND,VALUES or ROWIND,VALUES,pointer_B,pointer_E) as follows:
program CSC_MATRIX_VECTOR
implicit none
integer::i,j
integer,parameter::nRows=2280
integer,parameter::nNonzero=25395
integer,allocatable::COPPTR(:),ROWIND(:),pointer_B(:),pointer_E(:)
double precision,allocatable::VALUES(:)
double precision,allocatable::X(:),ANS(:)
double precision::alpha,beta
character(6):: matdescra
allocate(COPPTR(nRows+1))
open(unit=10,file='COPPTR.txt')
read(10,*)COPPTR
close(10,status="keep")
allocate(ROWIND(nNonzero))
open(unit=10,file='ROWIND.txt')
read(10,*)ROWIND
close(10,status="keep")
allocate(VALUES(nNonzero))
open(unit=10,file='VALUES.txt')
read(10,*)VALUES
close(10,status="keep")
allocate(X(nRows))
allocate(ANS(nRows))
open(unit=10,file='X.txt')
read(10,*)X
close(10,status="keep")
alpha=1.0
beta=0.0
matdescra='SLNF'
allocate(pointer_B(nRows))
allocate(pointer_E(nRows))
do i=1,nRows
pointer_B(i)=COPPTR(i)
pointer_E(i)=COPPTR(i+1)
end do
call mkl_dcscmv('N', nRows, nRows, alpha, matdescra, VALUES, ROWIND, pointer_B,
pointer_E,X, beta, ANS)
open(unit=10,file='ANS.txt')
write(10,'(D24.16)')ANS
end
result::
ANS(CSC).txt
Secondly,I use gemv to compute K*X=ANS,as follows:
include 'blas.f90'
program FULL_MATRIX_VECTOR
use MKL95_BLAS
use f95_precision
implicit none
integer::i,j
integer,parameter::nRows=2280
double precision,allocatable::K(:,:),X(:),ANS(:)
double precision::alpha,beta
allocate(K(nRows,nRows))
open(unit=10,file='K.txt')
read(10,*)((K(i,j),j=1,nRows),i=1,nRows)
close(10,status="keep")
allocate(X(nRows))
open(unit=10,file='X.txt')
read(10,*)X
close(10,status="keep")
allocate(ANS(nRows))
alpha=1.0
beta=0.0
call gemv(K, X, ANS,alpha ,beta ,'N')
open(unit=10,file='ANS.txt')
write(10,'(D24.16)')ANS
end
the result is
ANS(full).txt
Some elements in the results are quite different,I don't understand why the mkl_dcscmv and gemv cannot produce the same accuracy.
Thanks for your help.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some elements in the results are quite different,I don't understand whyThe result vectors that you gave (ansfull.txt,anscsc.txt) have elements as large as 1.6 E4, but the largest difference between the two is 3.7 E-6. On what basis do you say that the results are "quite different"? How much precision do you have in the input matrix and vector, and is a variation of 3.7 E-6 between the two results quite reasonable in that perspective?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have double precision ,15 or16 significant digits are accurate. I think the order of magnitude may be 1.0E-10 at least.How did you come to this conclusion? Things may work out in that fashion for some matrices, and not so for others. You did not show the input file K.txt, which. presumably, contains the same coefficients as in the compressed matrix, augmented by zero elements. We have to establish that the two K matrices are mathematically identical before we compare the two results for K.x.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page