- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I'm new to Intel MKL. Here's a problem I've come across -- apparently a problem not related to MKL itself, but to the problem of how to declare and pass an array of hitherto unknown size as an output of a subroutine to another subroutine.
I'm trying to use mkl_ddnscsr to convert a matrix to its CSR format suitable for calling by Pardiso:
CALL mkl_ddnscsr(job,Nt,Nt,Adns,Nt,Acsr,ja,ia,info)
CALL PARDISO(pt,1,1,11,13,Nt,Acsr,ia,ja,perm,1,iparm,0,b,x,errr)
Problem is, I have no idea what the length of the CSR form Acsr and the index vector ja before calling the mkl_ddnscsr subroutine. How should one declare Acsr and ja in the main program, or the subroutine where these two lines are located?
I tried something like
INTERFACE SUBROUTINE mkl_ddnscsr(job, m, n, Adns, lda, Acsr, ja, ia, info) IMPLICIT NONE INTEGER :: job(8) INTEGER :: m, n, lda, info INTEGER, ALLOCATABLE :: ja(:) INTEGER :: ia(m+1) REAL(KIND=8), ALLOCATABLE :: Acsr(:) REAL(KIND=8) :: Adns(:) END SUBROUTINE END INTERFACEand then
INTEGER, ALLOCATABLE :: ja(:) REAL(KIND=8), ALLOCATABLE :: Acsr(:)
outside the INTERFACE, in the main program. But this configuration gives me the segmentation fault upon running.
On the other hand, if I try something like
INTERFACE SUBROUTINE mkl_ddnscsr(job, m, n, Adns, lda, Acsr, ja, ia, info) IMPLICIT NONE INTEGER :: job(8) INTEGER :: m, n, lda, info INTEGER :: ja(:), ia(m+1) REAL(KIND=8) :: Acsr(:), Adns(:) END SUBROUTINE END INTERFACE
and then
INTEGER, DIMENSION(:) :: ja REAL(KIND=8), DIMENSION(:) :: Acsr
Then ifort would give me the following message:
error #6596: If a deferred-shape array is intended, then the ALLOCATABLE or POINTER attribute is missing; if an assumed-shape array is intended, the array must be a dummy argument.
Anyone got any idea how to work around this? What's the right way to declare ja and Acsr in the main program (or main subroutine) and pass them around? Thanks in advance.
Link Copied
0 Replies
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