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

Difficulties to use dgetri and dgetrf functions in VS

Guizzh
Beginner
2,012 Views

Hi,

I have a problem in a code using dgetri and dgetrf functions. I try to compile a fortran project in VS, and I have installed hpc and base toolkit. I thought mkl package would be sufficient to run those functions but when I run my code I get an error message saying :

"Unhandled exception at 0x00007FF733103FA2 in Project.exe: 0xC0000005: Access violation while reading location 0xFFFFFFFFFFFFFFFF." 

I found out that the code runs until it calls those functions.

Does anyone have an idea ? I found that downloading Lapack could work but it seems quite hard to install and I would rather use another method.

Thank you !

0 Kudos
15 Replies
Arjen_Markus
Honored Contributor I
1,961 Views

You do not show how you call these routines. The message indicates that there is some memory access problem. You should check that the arguments are correct. Also: it helps us to answer your question if you post the code that is causing the problems. Quite often a small reproducing program is the best way to get useful suggestions. In this case it looks like a problem with the actual call - wrong arguments or arguments (arrays) that do not have the correct size.

0 Kudos
Guizzh
Beginner
1,953 Views

Thank you for your answer. Sadly I can't show the code here because it is composed of several files and it is quite long. 

I didn't write the code myself it has been  given to me by a collegue and it worked on his computer so I don't think that the problem comes from wrong arguments.

0 Kudos
andrew_4619
Honored Contributor II
1,935 Views

Despite what you may think the problem is most likely the call arguments, that is the first thing to verify. Copy the declarations of all the args and the call itself and post that. Also the build options.

0 Kudos
Guizzh
Beginner
1,926 Views

integer, dimension(2) :: work, ipivJ

integer :: info

JacobMatrix(1,1) = dot_product( B_xi, Coord_Dofs( :, 2 ) )
JacobMatrix(1,2) = dot_product( B_eta, Coord_Dofs( :, 2 ) )
JacobMatrix(2,1) = dot_product( B_xi, Coord_Dofs( :, 3 ) )
JacobMatrix(2,2) = dot_product( B_eta, Coord_Dofs( :, 3 ) )

 

call dgetrf( 2, 2, JacobMatrix, 2, ipivJ, info )
call dgetri( 2, JacobMatrix, 2, ipivJ, work, 2, info )

What do you mean by "build options" ?

0 Kudos
Arjen_Markus
Honored Contributor I
1,920 Views

JacobMatrix is a double-precision matrix in your code?

0 Kudos
Guizzh
Beginner
1,915 Views

Sorry I forgot to send this : 

real*8, dimension(2,2) :: JacobMatrix

0 Kudos
Arjen_Markus
Honored Contributor I
1,908 Views

You define the array work as an integer array. According to the LAPACK documentation (http://www.netlib.org/lapack/explore-3.1.1-html/dgetri.f.html) it should be a double precision array. That makes a lot of difference.

0 Kudos
Guizzh
Beginner
1,902 Views

Double precision is this : "real*8, dimension(2) :: work" right ?

I tried this but it still doesn't work.

 

 

0 Kudos
Arjen_Markus
Honored Contributor I
1,897 Views

Yes, that should have done it.

Since it still does not work, you should try one of the other options I suggested. The problem could very well be elsewhere in the program.

Another thing: try a small program with just the code you provided (correctly filled) and see whether that works or not.

0 Kudos
Guizzh
Beginner
1,894 Views
 

I tried to put prints in several places in the code just to see how far the code run, and it stops when calling these functions, so I believe they are the problem. I will try the other methods you suggested.

Thank you very much for your time and help.

0 Kudos
mecej4
Honored Contributor III
1,879 Views

Guizzh wrote: "I can't show the code here because it is composed of several files and it is quite long."

Trim the sources and create a "reproducer", i.e., a set of sources that contain just enough code to enable someone else to reproduce the same error that you are seeing in the larger code.

If you cannot do so, zip up the source, include and data files, and instructions for building and reproducing the error, and provide the zip file as an attachment or a link to a cloud  service(such as Google Drive, OneDrive, Dropbox, etc.).

There are complete example source files that come with MKL. Building and running these examples may help you to identify the error. Questions related to MKL routines are better suited for the MKL forum.

Why does your program compute the inverse matrix explicitly? Except for a few special cases (e.g., computing the covariance matrix as part of nonlinear regression), a program that calculates the explicit inverse is a telltale sign of a beginner making a poor choice. 

Your fragmented descriptions and incorrect assumptions are not of much use. 

0 Kudos
Arjen_Markus
Honored Contributor I
1,936 Views

I would not count on it:

  • Are you using the same executable program or did you recompile it for your computer?
  • Did you use a different compiler?
  • Loads of other reasons why a program with problematic behaviour may not show the same symptoms on another computer

All that aside, the least you could do is show the calls and the declaration of the actual variables (scalars and arrays) that you pass to them.

Another thing to try: build with runtime checking, such as array-bound checks.

Does the program produce a traceback? You may need to use a compile option.

Still more possibilities: use a tool like valgrind or Intel Inspector to examine where in the code things are actually going wrong.

0 Kudos
Alina_S_Intel
Employee
1,838 Views

You are using Intel Fortran compiler Classic in your VS project, right?

Could you please provide a simple reproducer?


Please, refer to `check` options to determine what exactly causes the issue: https://software.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/language-options/check.html

Navigate Project Properties -> Fortran -> Run-Time. There are should be two options enabled by default: Check array and string bounds AND Check Stack Frame. You can try switching Runtime Error Checking from 'Custom' to 'All' and look what happens or enable \ disable options one by one.


0 Kudos
Bernard
Valued Contributor I
1,791 Views

@Guizzh wrote:

Hi,

I have a problem in a code using dgetri and dgetrf functions. I try to compile a fortran project in VS, and I have installed hpc and base toolkit. I thought mkl package would be sufficient to run those functions but when I run my code I get an error message saying :

"Unhandled exception at 0x00007FF733103FA2 in Project.exe: 0xC0000005: Access violation while reading location 0xFFFFFFFFFFFFFFFF." 

I found out that the code runs until it calls those functions.

Does anyone have an idea ? I found that downloading Lapack could work but it seems quite hard to install and I would rather use another method.

Thank you !


Next time it is advised to post a failed process "Project.exe" minidump file. The system message i.e "Unhandled exception at ......" is not sufficient to understand  a possible culprit.

0 Kudos
Alina_S_Intel
Employee
1,762 Views

We will no longer respond to this thread. 

If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.

Thanks,


0 Kudos
Reply