Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

imsl routine for linear system equations

Chien-Yuan_H_
Beginner
548 Views

I tried to use the IMSL routine 'DLSLXD' to solve sparse and symmetrical positive definite linear system equations. The coefficient matrix of the system was stored in the required sparse form. When the code was executed, the responses was 'the system is not positive definite'. So I reconstructed  the coefficient matrix in the two dimensional n by n form from the sparse format and called another subroutine DLSLDS which solves positive definite linear system equations (not symmetrical, not sparse). The reconstructed matrix passed the verification of positive definiteness by DLSLDS and the routine solved the system successfully. Because the  n by n matrix was constructed from the same matrix in the sparse form, I think there is no problem with my sparse matrix. DLSLXD saves a huge amount of computation time, I have to use it, but what's wrong with it. My compiler is Intel Parallel Studio XE Composer Edition.

CYHou

0 Kudos
8 Replies
mecej4
Honored Contributor III
548 Views

You may not be aware of another option that is open to you. Parallel Studio comes with MKL, which includes the PARDISO sparse solver. This solver takes the matrix data in CSR (Compressed Sparse Row) format, and is structured to make it easy to call it in phases and, in particular, to solve with more than one r.h.s. array without repeating the factorization.

Whether you use DLSLXD or MKL/PARDISO, if you think that if the library subroutine is claiming the input matrix to be not positive definite, you will need to provide the matrix data and the code that uses that matrix data. You should also state the versions of Parallel Studio and IMSL used, the OS version, and the list of compiler options used.

0 Kudos
Chien-Yuan_H_
Beginner
548 Views

Thank you for the responses. The sparse A matrix (sparseK.txt) and B vector (RHS.txt)  are attached. In sparseK.txt the 2nd and 3rd columns are respectively irow and jcol in DLSLXD, the 4th column is the matrix entity value. The values of r.h.s. are stored in the 2nd column of RHS column. There are 12324 equations. I use Window 7, Intel Visual Fortran Compiler 16.0,  IMSL FNL 7.0.1 for Intel 64. The code is

!******************************************
        subroutine sparse_solve(ntotv,nsprs,i_row,j_col,sprsk,soluf,asdis)
!******************************************
        double precision sprsk(nsprs),soluf(ntotv),asdis(ntotv)
        integer    i_row(nsprs),j_col(nsprs)

        ITWKSP =   100000000

         call dlslxd(ntotv,nsprs,sprsk,i_row,j_col,soluf,itwksp,asdis)

        return
        end

0 Kudos
mecej4
Honored Contributor III
548 Views

I ran the program given below to solve your system of equations on Windows 10-64. The program ran and gave a seemingly correct output, and there were no IMSL error messages from the run.

program xdlslxd
implicit none
integer :: N=12324
integer, allocatable :: row(:),col(:)
double precision, allocatable :: val(:),b(:),x(:)
integer :: i,j,k,nnz,iwlen
!
open(10,file='mat.txt')
nnz=0
do while(.true.)
  read(10,*,end=10)i,j,k
  nnz=nnz+1
  if(j < k)write(*,*)'Item ',i,' has row = ',j,', col = ',k
end do
10 write(*,*)'Matrix contains ',nnz,' entries'
allocate(row(nnz),col(nnz),val(nnz),x(N),b(N))
rewind(10)
read(10,*)(j,row(i),col(i),val(i),i=1,nnz)
close(10)
open(10,file='b.txt')
read(10,*)(j,b(i),i=1,N)
close(10)
iwlen=30000000
call dlslxd(n,nnz,val,row,col,b,iwlen,x)
open(10,file='sol.txt',status='replace')
write(10,'(i5,1x,1pD23.15)')(i,x(i),i=1,n)
close(10)
end program

 

0 Kudos
Chien-Yuan_H_
Beginner
548 Views

I tried your program but it does not work in my desktop. The error message is the same. I guess when I called DLSLXD, the matrix coefficients were not properly transferred to the routine in my computer. Is it possible the environment setting problem? If this is true, why other routines work in my desktop?

0 Kudos
mecej4
Honored Contributor III
548 Views

That is rather unexpected. If you have the 32-bit compiler and 32-bit IMSL installed, please try that combination. On my system, both worked. I also ran the same program with CVF 6.6C and the IMSL 4 that came with it, and the solutions were the same to at least ten digits (upon cursory inspection).

What is the model of the processor on your PC, and how much memory do you have? Can you run the example toy problem for which the code is given in the IMSL manual?

0 Kudos
Chien-Yuan_H_
Beginner
548 Views

I have a Fortran PowerStation 4.0 which is 32 bit in my 64 bit computer. DLSLXD in FPS 4.0 works fine for my case. But I can't use FPS4.0 because I will run larger size problems for which the 32 bit FPS4.0 does not work. My computer has 8G RAM and DLSLXD in my Intel Fortran solves the example problem successfully. My processor is Intel i7-6500U. 

0 Kudos
mecej4
Honored Contributor III
548 Views

The problem that you presented in #3 can be solved using 32-bit IMSL. The small program in #4 requires less than 1 GB to run.

I seems that more investigation is needed to find out why even the small program of #4 will not run on your system.

0 Kudos
Chien-Yuan_H_
Beginner
548 Views

OK. Thank you for your help.

0 Kudos
Reply