- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there!
I'm facing the problem with OneMKL2022.
The scenario is:
- Windows
- 32-bit app
- mkl_sequential
- DLL code which does a lot of stuff (including MKL).
- simple EXE which does
int testIter = 0;
while(true) {
printf("iter #%d\n", ++testIter);
HMODULE myLib = ::LoadLibrary("MyLib.dll");
/* get the address of function in .dll and call it */
::FreeLibrary(myLib);
}
The problem: after 1000+ iterations the MKL fatal error handler is called with code 3 during matrix multiplication (BUT, stack shows mkl_serv_malloc which is called somewhere from cblas_sgemm).
The `mkl_finalize` is called at the end of the function.
All the metrics don't show any leaks during running (memory/handles/anything).
Even my attempts to measure the memory "fragmentation" (finding out the 5 biggest possible memory size, which can be `malloc`'ed), don't show any fragmentation problem (btw, peak memory consumption of app is relatively small ~350 MB).
One more strange fact: it always fails on the same iteration, on the same `cblas_gemm` call.
I'm not sure that the problem is in MKL, because by this moment I didn't manage to create small clear sample for reproducing this bug (the DLL has a lot of additional code alongside with MKL computation). I'm just kinda lost here, what could be the reason of such behavior? So my questions are:
1. What is code 3? Are there any docs with these codes because I haven't found one...
2. Which resource could possibly be leaking (or ran out of)? Because 1000+ iterations show that it isn't a simple 'bug in the code' and it looks like a leak or running out of something.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've found it!
The problem was that my dll has been using vsExp/vsLn fucntions.
In that case mkl_finalize() isn't enough. After adding MKLFreeTls( DLL_PROCESS_DETACH ) before mkl_finalize() the code works just fine.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've found it!
The problem was that my dll has been using vsExp/vsLn fucntions.
In that case mkl_finalize() isn't enough. After adding MKLFreeTls( DLL_PROCESS_DETACH ) before mkl_finalize() the code works just fine.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page