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
Link Copied
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
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!
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.
could you please show the linking line
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
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
Thank you Maria! Now it worked.
Renato
For more complete information about compiler optimizations, see our Optimization Notice.