Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
55 Views

Calling Pardiso failed after enabling OpenMP in Visual studio

Hi,

 

Pardiso in my Fortran program works well if I do not use OpenMP.

 

However, after I change the setting in Visual studio for enabling OpenMP, by:

         Project > Configuration Properties > Fortran > Language > Process OpenMP Directives > Generate Parallel Code (/Qopenmp)

The error comes at calling Pardiso, showing:

         forrtl: severe (157): Program Exception - access violation

 

Does anyone know how to solve this problem?

Thanks a lot!

 

Yongli

0 Kudos
7 Replies
Highlighted
Employee
55 Views

Hi Yongli,
Can you please provide more details about your MKL version and reproducer for the case if possible?

Best regards,
Maria

0 Kudos
Highlighted
Beginner
55 Views

Hi Maria,

Thank you very much for your reply.

My MKL version: Intel® MKL 2018

Besides, I attached the code for reproducer. The code was downloaded from (http://www.pardiso-project.org) with minor modifications.

If I set  Project > Configuration Properties > Fortran > Language > Process OpenMP Directives > Generate Sequential Code (/Qopenmp_stubs), the program works.

However, the problem (as previously described) comes when the above setting is changed as " ....> Process OpenMP Directives > Generate Parallel Code (/Qopenmp)".

 

Thanks and best regards,

Yongli

C----------------------------------------------------------------------
C       Example program to show the use of the "PARDISO" routine
C       for symmetric linear systems
C -------------------------------------------------------------------- 
C      This program can be downloaded from the following site:  
C      http://www.pardiso-project.org                           
C                                                               
C  (C) Olaf Schenk, Institute of Computational Science          
C      Universita della Svizzera italiana, Lugano, Switzerland. 
C      Email: olaf.schenk@usi.ch                                
C -------------------------------------------------------------------- 
        PROGRAM pardiso_sym
        
        use omp_lib
        
        IMPLICIT NONE

C..     Internal solver memory pointer 
        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  dparm(64) 
        REAL*8  a(18) 
        REAL*8  b(8)
        REAL*8  x(8)
        REAL*8  y(8)

        INTEGER i, j, idum, solver
        REAL*8  waltime1, waltime2, ddum, normb, normr

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                                     0.d0,       5.d0,         
     7                                           11.d0,      
     8                                                 5.d0/

C  .. set right hand side
      do i = 1, n
        b(i) = 1.d0
      end do
       
C
C  .. Setup Pardiso control parameters und initialize the solvers     
C     internal adress pointers. This is only necessary for the FIRST   
C     call of the PARDISO solver.                                     
C     
      mtype     = -2  ! unsymmetric matrix symmetric, indefinite
      solver    =  10  ! use sparse direct method
      

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
      msglvl    = 1      ! with statistical information
      iparm(33) = 1      ! compute determinant
      
      !write(*,*) "proc nums:", omp_get_num_procs()
      call mkl_set_dynamic(0)
      call omp_set_num_threads(2)
      call mkl_set_num_threads(2)
      IPARM(3) = 2
      
      CALL pardiso (pt, maxfct, mnum, mtype, phase, n, a, ia, ja,
     1              idum, nrhs, iparm, msglvl, ddum, ddum, error, dparm)
     
      WRITE(*,*) 'Reordering completed ... '

      IF (error .NE. 0) THEN
        WRITE(*,*) 'The following ERROR was detected: ', error
        STOP
      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, dparm) 

      IF (iparm(33).EQ.1)  THEN
            write(*,*) 'Log of determinant is  ',  dparm(33)
      ENDIF

      WRITE(*,*) 'Factorization completed ... '
      IF (error .NE. 0) THEN
         WRITE(*,*) 'The following ERROR was detected: ', error
        STOP
      ENDIF 

C.. Back substitution and iterative refinement
      iparm(8)  = 1   ! max numbers of iterative refinement steps
      phase     = 33  ! only solve
      
     

      CALL pardiso (pt, maxfct, mnum, mtype, phase, n, a, ia, ja, 
     1              idum, nrhs, iparm, msglvl, b, x, error, dparm) 

      WRITE(*,*) 'Solve completed ...  '
     
      WRITE(*,*) 'The solution of the system is '
      DO i = 1, n
        WRITE(*,*) ' x(',i,') = ', x(i)
      END DO
      
       call sleep(3) 

 
      END

 

 

0 Kudos
Highlighted
Employee
55 Views

Hi Yongli,

First thing that I've noticed: the Intel(R) MKL PARDISO interface is a little bit different, there is no dparm parameter, for instance.
Please refer to the https://software.intel.com/en-us/mkl-developer-reference-fortran-pardiso for the detailed description.
Can you please adjust your code accordingly and double check if the issue is still there?

Best regards,
Maria
 

0 Kudos
Highlighted
Beginner
55 Views

Hi Maria,

Thank you very much for your quick reply and suggestions.

Then, I will check it as your suggestion first.

 

Thanks and best regards,

Yongli

Zhukova, Maria (Intel) wrote:

Hi Yongli,

First thing that I've noticed: the Intel(R) MKL PARDISO interface is a little bit different, there is no dparm parameter, for instance.
Please refer to the https://software.intel.com/en-us/mkl-developer-reference-fortran-pardiso for the detailed description.
Can you please adjust your code accordingly and double check if the issue is still there?

Best regards,
Maria
 

0 Kudos
Highlighted
Beginner
55 Views

Hi Maria,

The interface has been adjusted to be the same as the attached code.

However, the problem remains.

Your further suggestions will be highly appreciated.

 

Best regards,

Yongli

C----------------------------------------------------------------------
C       Example program to show the use of the "PARDISO" routine
C       for symmetric linear systems
C -------------------------------------------------------------------- 
C      This program can be downloaded from the following site:  
C      http://www.pardiso-project.org                           
C                                                               
C  (C) Olaf Schenk, Institute of Computational Science          
C      Universita della Svizzera italiana, Lugano, Switzerland. 
C      Email: olaf.schenk@usi.ch                                
C -------------------------------------------------------------------- 
        PROGRAM pardiso_sym
        
        use omp_lib
        
        IMPLICIT NONE

C..     Internal solver memory pointer 
        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  dparm(64) 
        REAL*8  a(18) 
        REAL*8  b(8)
        REAL*8  x(8)
        REAL*8  y(8)

        INTEGER i, j, perm, solver
        REAL*8  waltime1, waltime2, ddum, normb, normr

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                                     0.d0,       5.d0,         
     7                                           11.d0,      
     8                                                 5.d0/

C  .. set right hand side
      do i = 1, n
        b(i) = 1.d0
      end do
       
C
C  .. Setup Pardiso control parameters und initialize the solvers     
C     internal adress pointers. This is only necessary for the FIRST   
C     call of the PARDISO solver.                                     
C     
      mtype     = -2  ! unsymmetric matrix symmetric, indefinite
      solver    =  10  ! use sparse direct method
      

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
      msglvl    = 1      ! with statistical information
      iparm(33) = 1      ! compute determinant
      
      !write(*,*) "proc nums:", omp_get_num_procs()
      call mkl_set_dynamic(0)
      call omp_set_num_threads(2)
      call mkl_set_num_threads(2)
      IPARM(3) = 2
      
      call pardiso (pt, maxfct, mnum, mtype, phase, n, a, ia, ja,
     1              perm, nrhs, iparm, msglvl, b, x, error)
     
      WRITE(*,*) 'Reordering completed ... '

      IF (error .NE. 0) THEN
        WRITE(*,*) 'The following ERROR was detected: ', error
        STOP
      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              perm, nrhs, iparm, msglvl, b, x, error) 

      IF (iparm(33).EQ.1)  THEN
            write(*,*) 'Log of determinant is  ',  dparm(33)
      ENDIF

      WRITE(*,*) 'Factorization completed ... '
      IF (error .NE. 0) THEN
         WRITE(*,*) 'The following ERROR was detected: ', error
        STOP
      ENDIF 

C.. Back substitution and iterative refinement
      iparm(8)  = 1   ! max numbers of iterative refinement steps
      phase     = 33  ! only solve
        
      call pardiso (pt, maxfct, mnum, mtype, phase, n, a, ia, ja,
     1              perm, 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
      
       call sleep(3) 

 
      END

Zhukova, Maria (Intel) wrote:

Hi Yongli,

First thing that I've noticed: the Intel(R) MKL PARDISO interface is a little bit different, there is no dparm parameter, for instance.
Please refer to the https://software.intel.com/en-us/mkl-developer-reference-fortran-pardiso for the detailed description.
Can you please adjust your code accordingly and double check if the issue is still there?

Best regards,
Maria
 

0 Kudos
Highlighted
Moderator
55 Views

I checked the problem with the latest 2019 u3 version of mkl from command line, win64, lp64 API linked. the test passed. the log file is attached.

0 Kudos
Highlighted
Beginner
55 Views

Dear Maria and Gennady,

 

Much appreciated for your kind replies and suggestions.

Now, the code works even the version is 2018. I just checked and adjusted the previous code according to the examples in the folder of the Intel MKL installation directory: • examples/solverf/source.

 

Best regards,

Yongli

 

0 Kudos