For what reasons can mkl_free() fail?

For what reasons can mkl_free() fail?

I am working with Intel's MKL in C++ and I get a lot of runtime errors with themkl_free(some_matrix); call. Usually, it just hangs when it reaches the matrix. What are the reasons that can cause it to fail?

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

>>...the mkl_free( some_matrix )

It is not enough and more technical details are needed.

>>...What are the reasons that can cause it to fail?

Please provide an example of how you use MKL functions.

Thanks for your reply Sergey. I am using MS Visual Studio 2008 to build with MKL 11.0.5. When I run the application in Release mode, the program simply hangs so I was looking for ideas on how to debug the issue. A sample of the mkl_free() call can be found here on line 1464:

Could you please prepare the standalone example shows the problem? the example you provided cannot be compiled. 

Could you comment everything between these two blocks in order to very that simple allocation-deallocation works without any problems?

void Registration::multiObjectAtlasShapeCoefFunction( ... )
{
...
// Initialize some variables
double* Tr = (double*)mkl_malloc(4 * 4 * sizeof(double), 64);
double* Tr2 = (double*)mkl_malloc(4 * 4 * sizeof(double), 64);
...
/*
Comment all codes between allocations and deallocations
*/
...
cout << "Before free" << endl;
// Free all local variables
mkl_free_buffers();
cout << "a" << endl;
mkl_free(Tr); // fails to free
cout << "b" << endl;
mkl_free(Tr2);
// cout << "c" << endl;
// mkl_free(pose_feature_transform);
// cout << "d" << endl;
// mkl_free(pose_feature_transform2);
// cout << "e" << endl;
// mkl_free(ones);
// cout << "f" << endl;
// mkl_free(part1);
// cout << "g" << endl;
// mkl_free(part2);
// cout << "h" << endl;
// mkl_free(part1_2);
// cout << "done." << endl;
}

Then, start uncommenting line-by-line with verifications of binaries ( in Debug and Release configurations ) until you reproduce the problem. If you manage to reproduce it follow these simple steps a last uncommented piece of codes is where the problem is.

 

Quote:

Sergey Kostrov wrote:

>>...the mkl_free( some_matrix )

It is not enough and more technical details are needed.

>>...What are the reasons that can cause it to fail?

Please provide an example of how you use MKL functions.

Hi Sergey,
I revive this old post because I have some problems with mkl_free that throws exceptions and I disagree with your answers.
Compared to all of you I'm a ultra-novice programmer, but I heard that, if I have to write a function/method, I have two choices:
1 - make it exception free
2 - don't make it exception free
If 1 applies then we would be all happy.
If 2 applies I have two choices:
2a - my software is open-source and I don't want to support any user that would use my library/program. I could say:
        "An exception is thrown? P**s off, and give a look at the definition yourself"
2b - my software is closed, I sell it, I make a lot of money and just because of this I provide a rich documentation about every single exception that can be thrown.
No matter "how you use MKL functions", no matter about "technical details" of the end-user program.
It's true: at 99% the user is wrong. He misused the function, he messed up everything, etc... but let him discover his own mistakes ! Let him debug his own code! Don't give him bread. Give him the tools needed to grow wheat.

Having said that, I might be wrong and if so I'm sorry, but if not, please think about it.

 

 

 

 

 

Leave a Comment

Please sign in to add a comment. Not a member? Join today