Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Pardiso memory problem with Visual Fortran

Ioannis_K_
New Contributor I
398 Views

I use mkl with Visual Fortran Compiler XE 14.0.0.103. 

I employ the pardiso function for a program that involves solution of a system of linear equations: {x} = {b}, where , {b} are given and we want to find vector {x}. My code has to solve this system of equations repeatedly (for many iterations), for different values of , {b}.  The values of , {b} at each iteration depends on the value of {x} from the previous iteration, so the algorithm is something like this:

Initialize {x}

do i = 1,Niter

[Find , {b}, given {x}]

[Solve {x} = {b} and find updated {x}]

end do !i

My code has encountered a SERIOUS problem with memory management. Specifically, I see a continuous increase in the amount of memory used, until my computer runs out of memory and the program aborts. I do not have any dynamic memory allocation in my code (I do not use pointers), so I believe that the problem is due to mkl. 

I tried to include the line:

call mkl_free_buffers()

but this did not help in any way. I found some posts in this forum with similar comments, but I did not find anything helpful. Any help on this issue would be greatly appreciated!!

0 Kudos
7 Replies
Gennady_F_Intel
Moderator
398 Views

yes, we had similar problems with those versions. I recommend to try one of the latest versions of MKL ( 2018 ) and let us know if the problem is still exists on your side.

0 Kudos
Ioannis_K_
New Contributor I
398 Views

Thank you Gennady. I had a follow-up question: can I download a newer version of mkl and install it on my computer, so that I replace the older version that I am currently using, or do I need to purchase a newer version of Visual Fortran? If I can download a new version of mkl, can you please briefly explain where I can find it and how to install it? For example, is special care required to manually replace existing lib files with newer versions? 

0 Kudos
Gennady_F_Intel
Moderator
398 Views

You may take the latest version of mkl for evaluation. Here are the links to pages show how to download: https://software.intel.com/en-us/mkl ;  and to install: https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-2018-install-guide.

 

 

 

0 Kudos
Ioannis_K_
New Contributor I
398 Views

Gennady,

I installed a trial version of the latest Intel Parallel Studio, but the problem still persists. Is there a way for me to check which version of mkl I am using? 

 

0 Kudos
Gennady_F_Intel
Moderator
398 Views

yes sure that's possible. The fastest way - to check mkl_version.h file or you may add into your code mkl_get_version routine. the code may look like as follow

#include <stdio.h> 

#include "mkl.h"

int main(void) 
{
  int len=198;
  char buf[198];
  mkl_get_version_string(buf, len);
  printf("%s\n",buf);
  printf("\n");
  return 0; 
}
0 Kudos
Ioannis_K_
New Contributor I
398 Views

OK, thank you. I checked and my mkl version is indeed the 2018 one: 

Intel(R) Math Kernel Library Version 2018.0.2 Product Build 20180127 for Intel(R) 64 architecture applications  

What could I do to try and resolve the issue? Is there any alternative for parallel solution of systems of equations (direct or iterative), which will circumvent the need for pardiso and may prevent the occurrence of the specific problem?

0 Kudos
Ioannis_K_
New Contributor I
398 Views

Gennady,

I think I may have found an "ad hoc fix" to the problem: I am going to describe the process I am following, for solving a sparse problem where the coefficient array is described by 3 vectors, namely, Values, rowIndex and columns, and my right-hand-side vector is bvec.

1) Create "copies of the input", that is: Values2 = Values, rowIndex2 = rowIndex, columns2 = columns, and bvec2 = bvec

2) call pardiso passing the "copies" as input arguments.

3) if pardiso has completed without error, then copy the solution vector to bvec.

4) Call pardiso again, this time using a value of parameter phase = -1.

Following these steps leads to a constant memory use in my program. Please note that I HAD to define and use the "copies" of the input arguments. If I tried to follow the above process without step "1", then the program aborted with error (access violation).

 

 

 

0 Kudos
Reply