Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Using Pardiso in a dll

jpharvey1981
Beginner
377 Views
I am using the Pardiso routine in a dll (The code is a copy/paste from the pardiso_sym_f.f available in the example folder of mkl... I just removed theWRITE statements)and I get the following error message on compilation:



...The type of the actual argument differs from the type of the dummy argument...




However, when using the exact same code in a console application, there are no error messages, I can run the application, see the results, etc.


Why am I not able to compile my dll while the exact same code in an application console is working properly?



0 Kudos
4 Replies
Ying_H_Intel
Employee
377 Views
Hello jpharvel,

How do you call the Pardiso Routine in a dll? Could you attached a small test case?

According tothe error message, I check in Intel Fortran compiler forum, http://software.intel.com/en-us/forums/showthread.php?t=61735. The problem seems hint itself. There is parameter ormodule, which actual argument is diff from the dummy arguments.

Other discussion like http://coding.derkeiler.com/Archive/Fortran/comp.lang.fortran/2005-10/msg00640.html

BestRegards,
Ying
0 Kudos
jpharvey1981
Beginner
377 Views

Dear Ying,

I tried to reproduce the error message that I got yesterday but now the code can be compiledproperly...

I honestly does not have any clues how I made it work...

Here is the test code for the dll:


subroutine test()

!DEC$ ATTRIBUTES DLLEXPORT :: test

!DEC$ ATTRIBUTES STDCALL :: test

!DEC$ ATTRIBUTES REFERENCE :: test

C.. Internal solver memory pointer for 64-bit architectures

C.. INTEGER*8 pt(64)

C.. Internal solver memory pointer for 32-bit architectures

C.. INTEGER*4 pt(64)

C.. This is OK in both cases

INTEGER*8 pt(64)

C.. All other variables

INTEGER maxfct, mnum, mtype, phase, n, nrhs, error, msglvl

INTEGER iparm(64)

INTEGER ia(9)

INTEGER ja(18)

REAL*8 a(18)

REAL*8 b(8)

REAL*8 x(8)

INTEGER i, idum

REAL*8 waltime1, waltime2, ddum

C.. Fill all arrays containing matrix data.

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.. Set up PARDISO control parameter

C..

do i = 1, 64

iparm(i) = 0

end do

iparm(1) = 1 ! no solver default

iparm(2) = 2 ! fill-in reordering from METIS

iparm(3) = 1 ! numbers of processors

iparm(4) = 0 ! no iterative-direct algorithm

iparm(5) = 0 ! no user fill-in reducing permutation

iparm(6) = 0 ! =0 solution on the first n compoments of x

iparm(7) = 0 ! not in use

iparm(8) = 9 ! numbers of iterative refinement steps

iparm(9) = 0 ! not in use

iparm(10) = 13 ! perturbe the pivot elements with 1E-13

iparm(11) = 1 ! use nonsymmetric permutation and scaling MPS

iparm(12) = 0 ! not in use

iparm(13) = 0 ! maximum weighted matching algorithm is switched-off (default for symmetric). Try iparm(13) = 1 in case of inappropriate accuracy

iparm(14) = 0 ! Output: number of perturbed pivots

iparm(15) = 0 ! not in use

iparm(16) = 0 ! not in use

iparm(17) = 0 ! not in use

iparm(18) = -1 ! Output: number of nonzeros in the factor LU

iparm(19) = -1 ! Output: Mflops for LU factorization

iparm(20) = 0 ! Output: Numbers of CG Iterations

error = 0 ! initialize error flag

msglvl = 1 ! print statistical information

mtype = -2 ! symmetric, indefinite

C.. Initiliaze the internal solver memory pointer. This is only

C necessary for the FIRST call of the PARDISO solver.

do i = 1, 64

pt(i) = 0

end do

C.. Reordering and Symbolic Factorization, This step also allocates

C all memory that is necessary for the factorization

phase = 11 ! only reordering and symbolic factorization

CALL PARDISO (pt, maxfct, mnum, mtype, phase, n, a, ia, ja,

1 idum, nrhs, iparm, msglvl, ddum, ddum, error)

WRITE(*,*) 'Reordering completed ... '

IF (error .NE. 0) THEN

WRITE(*,*) 'The following ERROR was detected: ', error

STOP 1

END IF

WRITE(*,*) 'Number of nonzeros in factors = ',iparm(18)

WRITE(*,*) 'Number of factorization MFLOPS = ',iparm(19)

C.. Factorization.

phase = 22 ! only factorization

CALL pardiso (pt, maxfct, mnum, mtype, phase, n, a, ia, ja,

1 idum, nrhs, iparm, msglvl, ddum, ddum, error)

WRITE(*,*) 'Factorization completed ... '

IF (error .NE. 0) THEN

WRITE(*,*) 'The following ERROR was detected: ', error

STOP 1

ENDIF

C.. Back substitution and iterative refinement

iparm(8) = 2 ! max numbers of iterative refinement steps

phase = 33 ! only factorization

do i = 1, n

b(i) = 1.d0

end do

CALL pardiso (pt, maxfct, mnum, mtype, phase, n, a, ia, ja,

1 idum, nrhs, iparm, msglvl, b, x, error)

WRITE(*,*) 'Solve completed ... '

WRITE(*,*) 'The solution of the system is '

DO i = 1, n

WRITE(*,*) ' x(',i,') = ', x(i)

END DO

C.. Termination and release of memory

phase = -1 ! release internal memory

CALL pardiso (pt, maxfct, mnum, mtype, phase, n, ddum, idum, idum,

1 idum, nrhs, iparm, msglvl, ddum, ddum, error)

END

I was also able to use successfully a similar dll in my delphi project so sorry about my thread!

thank you for your attention

0 Kudos
abhimodak
New Contributor I
377 Views
Hello jpharvey1981

A remote remote chance, but perhaps were you using /gen-interfaces and /warn-interfaces? If so, did you make any modifications in the interface of the subroutines? If so, did you happen to do a "clean" project before you built it again?

Hope this is not too much a digression.

Abhi
0 Kudos
jpharvey1981
Beginner
377 Views
The major problem when using Microsoft Visual Studio is thatyou loose the knowledge ofthe command lines sent to the intel fortran compiler. I am an occasional user of the intel visual fortran compiler and I am not taking care of the command lines sent to the compiler...unfortunately.

I did start aproject from scratch (clean project)this morning, knowing exactly how to solve the problematic (after a long night of trials and errors I managed to use the mkl_pardiso.f90 version)...

JP
0 Kudos
Reply