Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Access violation when using "-heap-arrays" option and math kernel library

Ki-Tae_K_
Beginner
526 Views

Hi~, I am developing a program and use a routine in intel math kernel library. I am in a trouble and I will appreciate your helps.

The subroutine used from intel mkl is "dspev".

When I compile without "-heap-arrays" option, it works very well, but if I compile with "-heap-arrays" it gives an error:

--------------------------------------------------------------------------------------------------------------------

forrtl: severe (157): Program Exception - access violation
Image              PC                Routine            Line        Source
mkl_avx2.dll       00007FF9FE337F0F  Unknown               Unknown  Unknown
mkl_core.dll       00007FFA00216E60  Unknown               Unknown  Unknown
mkl_sequential.dl  00007FFA02460C4C  Unknown               Unknown  Unknown
mkl_core.dll       00007FFA0020FDEB  Unknown               Unknown  Unknown
Imp_subspace-m1a.  00007FF7C1519619  Unknown               Unknown  Unknown
Imp_subspace-m1a.  00007FF7C1506E1B  Unknown               Unknown  Unknown
Imp_subspace-m1a.  00007FF7C150280D  Unknown               Unknown  Unknown
Imp_subspace-m1a.  00007FF7C150BC83  Unknown               Unknown  Unknown
Imp_subspace-m1a.  00007FF7C1509D0E  Unknown               Unknown  Unknown
Imp_subspace-m1a.  00007FF7C1519C0E  Unknown               Unknown  Unknown
Imp_subspace-m1a.  00007FF7C1519FDC  Unknown               Unknown  Unknown
KERNEL32.DLL       00007FFA3AEA8102  Unknown               Unknown  Unknown
ntdll.dll          00007FFA3BA5C5B4  Unknown               Unknown  Unknown
Press any key to continue . . .

--------------------------------------------------------------------------------------------------------------------

My compile option is: /nologo /O2 /module:"x64\Release\\" /object:"x64\Release\\" /Fd"x64\Release\vc140.pdb" /libs:dll /threads /Qmkl:sequential /c -heap-arrays.

I am using Windows 10 64bit and Intel® Parallel Studio XE 2016 Update 2 Composer Edition for Fortran Windows.

I will really appreciate your helps!

Thank you!

0 Kudos
5 Replies
Steven_L_Intel1
Employee
526 Views

A test program would be really useful. Since I have to guess, I'll surmise that you're running off the end of an array somewhere (maybe by passing the wrong size to MKL) and that the lack of an error when not using -heap-arrays doesn't mean the program is running correctly.

But looking at the traceback, where I see mkl_avx2, makes me wonder if MKL is assuming (or requiring) that the data be naturally aligned and what you're passing isn't. I think this might also trigger an access violation if an AVX2 instruction tried to load unaligned data. (I am sure that Tim P or others will jump in to correct me if I'm wrong - that's not a subject I am very familiar with.)

0 Kudos
Ki-Tae_K_
Beginner
526 Views

Thanks for comment, steve.

I have a big program in which a subroutine calls "dspev". The subroutine (let us denote ABC) which calls "dspev" is called several times. Because the program is a little bit big, it is hard to post the program.

The subroutine "dspev" is called like: call DSPEV('N','L',ctt,BRT(1:nctt),DD(1:ctt),DUMQ(1,1:ctt),1,WORK(1:3*ctt),info) where ctt and nctt have different values when the subroutine ABC is called.

---------------------------------------------------------------------------------------------------------------------

Oh, I found what is the problem, I am sorry steve.

Thank you very much steve, have a nice day!

0 Kudos
TimP
Honored Contributor III
526 Views

Ki-Tae K. wrote:

Thanks for comment, steve.

I have a big program in which a subroutine calls "dspev". The subroutine (let us denote ABC) which calls "dspev" is called several times. Because the program is a little bit big, it is hard to post the program.

The subroutine "dspev" is called like: call DSPEV('N','L',ctt,BRT(1:nctt),DD(1:ctt),DUMQ(1,1:ctt),1,WORK(1:3*ctt),info) where ctt and nctt have different values when the subroutine ABC is called.

---------------------------------------------------------------------------------------------------------------------

Oh, I found what is the problem, I am sorry steve.

Thank you very much steve, have a nice day!

I would hope that that correct USE files would cause the compiler to point out any problems with passing an array subsection to OUT and INOUT arguments.

We can't see how MKL dspev was built; as Steve mentioned, it is possible that it could be coded with aligned move simd intrinsics.  I doubt that this could account for any access violation. Setting the compile option -align:array64byte might help to comply with the advice about alignment in the MKL docs.  Surprisingly, I worked recently with an application which ran slower with the -align settings.

0 Kudos
Steven_L_Intel1
Employee
526 Views

Please tell us what you found so that other readers can learn from it.

0 Kudos
Ki-Tae_K_
Beginner
526 Views

Dear Steve,

It was because wrong input arguments, I made a mistake in my program. So, it works fine with "-heap-arrays" option without any problems.

Thanks for all your comments!

0 Kudos
Reply