Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
1 View

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

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
Highlighted
1 View

A test program would be

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

Retired 12/31/2016
0 Kudos
Highlighted
Beginner
1 View

Thanks for comment, steve.

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
Highlighted
Black Belt
1 View

Quote:Ki-Tae K. wrote:

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
Highlighted
1 View

Please tell us what you found

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

Retired 12/31/2016
0 Kudos
Highlighted
Beginner
1 View

Dear Steve,

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