Community
cancel
Showing results for 
Search instead for 
Did you mean: 
watanabe__renato
Beginner
334 Views

ifort with mkl and function mkl_sparse_d_mv

Jump to solution

 

I compile my program and it gives the following error:

forrtl: severe (174): SIGSEGV, segmentation fault occurred

I isolated the problem and it is occurring at the call of the mkl_sparse_d_mv function of the following function:

function dVdt(self, t, V)
        class(MotorUnitPool), intent(inout) :: self
        real(wp), intent(in) :: t
        real(wp), intent(in) :: V(:)
        real(wp), dimension(self%totalNumberOfCompartments) :: dVdt
        integer :: i, j, stat
        real(wp), dimension(:), allocatable :: matInt

        allocate(matInt(self%totalNumberOfCompartments))
              
        do i = 1, self%MUnumber
            do j = 1, self%unit(i)%compNumber
                self%iIonic((i-1)*self%unit(i)%compNumber+j) = self%unit(i)%Compartments(j)%computeCurrent(t, V((i-1)*self%unit(i)%compNumber+j))
            end do
        end do       
        
        stat = mkl_sparse_d_mv(self%spOperation, &
                                                self%spAlpha, &
                                                self%GSp, &
                                                self%spDescr, &
                                                V, &
                                                self%spBeta, &
                                                matInt)
        
        dVdt = (self%iIonic + matInt + self%iInjected + self%EqCurrent_nA) * self%capacitanceInv       
end function

I compile with gfortran without any problems. As compiler options to the ifort compiler i tried to use the option -heap_arrays, whith no success.

This function is part of a bigger program, with some files. If you want to see the whole software, you can find it in https://github.com/rnwatanabe/projectFR . 

 

Thanks in advance,

 

Renato Watanabe

 

 

 

0 Kudos

Accepted Solutions
MariaZh
Employee
334 Views

Hi,

I don't see a call to the mkl_sparse_destroy() routine.
(please, refer to https://software.intel.com/en-us/mkl-developer-reference-fortran-mkl-sparse-destroy)
I guess this can be a root cause for the memory leak in your implementation.

Please, let me know what you find out!
Best regards,
Maria

View solution in original post

7 Replies
Gennady_F_Intel
Moderator
334 Views

could you isolate the case in the form of standalone example whicj we may compile and execute on our side w/o extracted the code from your project!  

watanabe__renato
Beginner
334 Views

Thank you for  your answer Gennady.

I isolated the problem in one file.  It has a run-time segmentation fault  with ifort and not with gfortran:

forrtl: severe (174): SIGSEGV, segmentation fault occurred

Image              PC                Routine            Line        Source
spTest             0000000000860BAD  Unknown               Unknown  Unknown
libpthread-2.23.s  00007FBA1A709390  Unknown               Unknown  Unknown
spTest             0000000000545E88  Unknown               Unknown  Unknown
spTest             00000000004090B0  Unknown               Unknown  Unknown
spTest             0000000000406DAA  Unknown               Unknown  Unknown
spTest             000000000040484C  Unknown               Unknown  Unknown
spTest             000000000040332E  Unknown               Unknown  Unknown
libc-2.23.so       00007FBA19E41830  __libc_start_main     Unknown  Unknown
spTest             0000000000403229  Unknown               Unknown  Unknown

The file is attached.

 

Gennady_F_Intel
Moderator
334 Views

could you please show the linking line

watanabe__renato
Beginner
334 Views

The whole command line I used is :

 

ifort -c $MKLROOT/include/mkl_spblas.f90 &  ifort spTest.f90 -o spTest -O3  -Wl,--start-group $MKLROOT/lib/intel64/libmkl_intel_lp64.a $MKLROOT/lib/intel64/libmkl_sequential.a $MKLROOT/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl -I$MKLROOT/include

The Linux version is:

 

Linux  4.15.0-33-generic #36-Ubuntu  x86_64 x86_64 x86_64 GNU/Linux

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic

The ifort version is:

ifort (IFORT) 18.0.3 20180410
 

The MKL version is the version released in May 2018.

 

Thank you,

 

Renato

 

 

 

watanabe__renato
Beginner
334 Views

I found a way to solve the issue. If I create the sparse matrix every step of the simulation, it works fine, both with gfortran and ifort. The code is attached. The problem now is that there is a memory leak. on the creation of the sparse matrix. Any idea of why?

MariaZh
Employee
335 Views

Hi,

I don't see a call to the mkl_sparse_destroy() routine.
(please, refer to https://software.intel.com/en-us/mkl-developer-reference-fortran-mkl-sparse-destroy)
I guess this can be a root cause for the memory leak in your implementation.

Please, let me know what you find out!
Best regards,
Maria

View solution in original post

watanabe__renato
Beginner
334 Views

Thank you Maria! Now it worked.

Renato