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

linking pardiso

Hi,

I'm trying to compile and run pardiso_solv_sym_inv.f90 program from PARDISO.
My compilation is succesfull but during the execution I get a segmentation fault error.
Obviously my linking in not correct.
Can anyone advice me how to link? Thanks.

Konstantin

My makerules file:

PROGRAMS = pardiso_solv_sym_inv

pardiso_solv_sym_inv : pardiso_solv_sym_inv.o
    $(FC) $(PFLAGS) -o $@ pardiso_solv_sym_inv.o $(PLIBS)

all : $(PROGRAMS)

clean:
    rm -v *.o *.mod $(PROGRAMS)

.f90.o :
    $(FC) $(SFLAGS) -c $<


My makfile:

        .suffixes:
.SUFFIXES: .f90 .o

FC = /opt/intel/bin/ifort

MKL_MIC_ENABLE=1

DIRECTIVES = -axAVX -ansi-alias -ip -sox -mcmodel=large
PDIRECTIVES = $(DIRECTIVES)

MKLROOT = /opt/intel/composer_xe_2015.3.187

CDIRS = -I$(MKLROOT)/mkl/include -L$(MKLROOT)/mkl/lib/intel64/ -L$(MKLROOT)/mkl/lib/mic/libmkl_blacs_intelmpi_ilp64.so

COMPFLAGS = -DMKL_ILP64 -w -g -O2 -fdefault-integer-8  
PCOMPFLAGS = $(COMPFLAGS) -openmp
SFLAGS = $(COMPFLAGS) $(DIRECTIVES) $(CDIRS)
PFLAGS = $(PCOMPFLAGS) $(PDIRECTIVES) $(CDIRS)

LIBS = -lmkl_intel_ilp64 -lmkl_core -liomp5 -lm
PLIBS = $(LIBS) -lmkl_intel_thread -lpthread

 

MAKERULES = /group/adhis/Kon/mkl/fortran/makerules
include ${MAKERULES}

The error I get:


 [PARDISO]: License check was successful ...
forrtl: severe (174): SIGSEGV, segmentation fault occurred

 

0 Kudos
3 Replies
Highlighted
Black Belt
42 Views

Here are the Pardiso examples from the Parallel Studio 2016 distribution:

pardiso_sym_f.f
pardiso_sym_f90.f90
pardiso_sym_reduced_solve_f.f
pardiso_unsym_cmplx_store_restore_f.f
pardiso_unsym_complex_f.f
pardiso_unsym_f.f
sjacobi_rci_f.f

The source file name that you gave is not among those, so one needs to have the source code in order to look into the reported problem.

0 Kudos
Highlighted
Beginner
42 Views

Hi there,

Her is the source code:

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

!..     Internal solver memory pointer
        INTEGER(8) :: pt(64)

!..     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

!.. 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,          3,                 6,    7, &
                     2,    3,          5,
                           3,                             8, &
                                4,                  7,       &
                                       5,     6,    7,       &
                                              6,          8, &
                                                    7,       &
                                                          8/
      
        DATA a
           /7.d0,       1.d0,              2.d0, 7.d0, &
                 -4.d0, 8.d0,        2.d0,                   &
                        1.d0,                          5.d0, &
                              7.d0,              9.d0,       &
                                     5.d0, 1.d0, 5.d0,       &
                                           0.d0,       5.d0, &
                                                 11.d0,      &
                                                       5.d0/

!  .. set right hand side
      do i = 1, n
        b(i) = 1.d0
      end do
       
!
!  .. Setup Pardiso control parameters und initialize the solvers
!     internal adress pointers. This is only necessary for the FIRST
!     call of the PARDISO solver.
!
      mtype     = -2  ! unsymmetric matrix symmetric, indefinite
      solver    =  10  ! use sparse direct method
      
!  .. PARDISO license check and initialize solver
      call pardisoinit(pt, mtype, solver, iparm, dparm, error)
!  .. Numbers of Processors ( value of OMP_NUM_THREADS )
      iparm(3) = 1

      IF (error .NE. 0) THEN
        IF (error.EQ.-10 ) WRITE(*,*) 'No license file found'
        IF (error.EQ.-11 ) WRITE(*,*) 'License is expired'
        IF (error.EQ.-12 ) WRITE(*,*) 'Wrong username or hostname'
        STOP
      ELSE
        WRITE(*,*) '[PARDISO]: License check was successful ... '
      END IF

!  .. pardiso_chk_matrix(...)
!     Checks the consistency of the given matrix.
!     Use this functionality only for debugging purposes
      CALL pardiso_chkmatrix  (mtype, n, a, ia, ja, error);
      IF (error .NE. 0) THEN
         WRITE(*,*) 'The following ERROR was detected: ', error
        STOP
      ENDIF

! ..  pardiso_chkvec(...)
!     Checks the given vectors for infinite and NaN values
!     Input parameters (see PARDISO user manual for a description):
!     Use this functionality only for debugging purposes
      CALL pardiso_chkvec (n, nrhs, b, error);
      IF (error .NE. 0) THEN
         WRITE(*,*) 'The following ERROR was detected: ', error
        STOP
      ENDIF
 
! ..  pardiso_printstats(...)
!     prints information on the matrix to STDOUT.
!     Use this functionality only for debugging purposes

      CALL pardiso_printstats (mtype, n, a, ia, ja, nrhs, b, error);
      IF (error .NE. 0) THEN
         WRITE(*,*) 'The following ERROR was detected: ', error
        STOP
       ENDIF
     

!..   Reordering and Symbolic Factorization, This step also allocates
!     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

      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)

!.. 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

!.. 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

!.. Residual test
      normb = 0
      normr = 0
      CALL pardiso_residual (mtype, n, a, ia, ja, b, x, y, normb, normr)
      WRITE(*,*) 'The norm of the residual is ',normr/normb


!.. Selected Inversion

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

!..  Print diagonal elements of the inverse of A = (a, ia, ja) */
      do i = 1, n
        j = ia(i)
        write(*,*) 'Diagonal',i,'-element of A^{-1} = ', a(j)
      end do

!.. 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, dparm)
      END

 

0 Kudos
Highlighted
Black Belt
42 Views

The MKL version of Pardiso and the newer version from www.pardiso-project.org are not 100 percent compatible. You can adapt the example to make the calls MKL-compatible, or use it as is but link with the Pardiso library from that site.

0 Kudos