- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
This is the first time that I am using libraries. I need to calculate the inverse matrix of a square matrix. I found the routine PDGETRF + PDGETRI from ScaLAPACK in the MKL documentation that can solve my problem, but I'm in trouble to compile this routines.
Can anyone help me?
The code I am trying to compile is:
program Invtest implicit none ! Variables integer :: i, j, info, lwork, liwork integer, parameter :: dlen_ = 9, ia = 1, ja = 1, m=3, n=3 real(kind = 8), dimension(m,n) :: A, Ainv, Mf, LU integer, dimension(size(A,1)) :: ipiv integer, dimension(dlen_) :: desca real(kind = 8), dimension(size(A,1)) :: work, iwork external PDGETRF, PDGETRI ! Body of Invtest A = reshape(source = (/1, 1, 1, 0, 3, 2, 0, 1, 0/), shape = (/3, 3/)) do i=1,m print *, (A(i,j), j=1,n) end do info = 0 lwork = size(A,1) work = 0 liwork = size(A,1) iwork = 0 ! PDGETRF computes an LU factorization of a general M-by-N distributed matrix. LU = A call pdgetrf(n, n, LU, ia, ja, desca, ipiv, info) ! PDGETRI computes the inverse of a matrix using the LU factorization computed by PDGETRF. Ainv = LU call pdgetri(n, Ainv, ia, ja, desca, ipiv, work, lwork, iwork, liwork, info) ! Computation of A^{-1} * A to check the inverse Mf = matmul(Ainv,A) print*,"Mf = " do i=1,m print*,Mf(i,:) end do pause end program Invtest
When I compile this code I get the following error message:
{ -1, -1}: On entry to PDGETRF parameter number 602 had an illegal value { -1, -1}: On entry to PDGETRI parameter number 502 had an illegal value
The university computer that I am using has installed Microsoft Visual Studio Professional 2013 Update 3, Intel Parallel Studio XE 2016 Update 2 Cluster Edition for Windows with Intel Math Kernel Library 11.3.
Thanks for the attention.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jeferson,
I replied your question from your another post.
For C sample, here is one https://software.intel.com/en-us/articles/using-cluster-mkl-pblasscalapack-fortran-routine-in-your-c-program =>
https://software.intel.com/sites/default/files/article/165948/pdgemv.c
for fortran sample, you may search the scalapack function in internet.
like http://acts.nersc.gov/tau/example-pdgesv/pdgesvdriver.f90.html
In the code, you need at least some MPI init or blacs init code. for example mkl build-in example
******************************************************************************* C---------------------------------------------------------------------- C Example program to show the use of the "CLUSTER_SPARSE_SOLVER" routine C for solving symmetric linear systems C---------------------------------------------------------------------- program cluster_sparse_solver_sym implicit none include 'mkl_cluster_sparse_solver.f77' include 'mpif.h' C.. Internal solver memory pointer for 64-bit architectures INTEGER*8 pt(64) C.. All other variables INTEGER maxfct, mnum, mtype, phase, n, nrhs, error, msglvl INTEGER*4 rank, mpi_stat INTEGER iparm(64) INTEGER ia(9) INTEGER ja(18) REAL*8 a(18) REAL*8 b(8) REAL*8 bs(8) REAL*8 x(8) INTEGER i, idum(1) REAL*8 ddum(1) REAL*8 res, res0 external mkl_dcsrsymv C.. Fill all arrays containing matrix data. Necessary only on master process DATA n /8/, nrhs /1/, maxfct /1/, mnum /1/ DATA ia /1,5,8,10,12,15,17,18,19/ DATA ja 1 /1, 3, 6,7, 2 2,3, 5, 3 3, 8, 4 4, 7, 5 5,6,7, 6 6, 8, 7 7, 8 8/ DATA a 1 /7.d0, 1.d0, 2.d0,7.d0, 2 -4.d0,8.d0, 2.d0, 3 1.d0, 5.d0, 4 7.d0, 9.d0, 5 5.d0,1.d0,5.d0, 6 -1.d0, 5.d0, 7 11.d0, 8 5.d0/ C.. C.. Initialize MPI. call MPI_INIT(mpi_stat) call MPI_COMM_RANK(MPI_COMM_WORLD, rank, mpi_stat) C..
call MPI_FINALIZE(mpi_stat)
end
Best Regards,
Ying
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page