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

MKL and LabView - Memory Allocation problem

Howard_Weiss
Beginner
913 Views
We have developed a LabView application (version 9.0) to run our instrument. The LabView applications calls .dll to evaluate the data which in turn calls MKL to perform a convolution of a 3296 x 2472 array with a 39 x 118 kernel. Code is below and is identical to the test example.

This works the first time it is invoked.

The second and subsequent times it is invoked vslsConvNewTask returns error code -2001 (Allocation Error)

The same .dll works fine when called from other applications.

The .dll is developed with the latest Intel Composer XE 2011 for Windows.

Any recommendations on how to debug or resolve this problem would be appreciated

Howard Weiss

---------------------------------------------------------------------------------------------------------------------------

/*
* Create task descriptor (create descriptor of problem)
*/
task = 0;
status = vslsConvNewTask(&task,mode,rank,xshape,yshape,zshape);
if( status != VSL_STATUS_OK ){
char tells[256];
memset(tells, 0, sizeof(tells));
sprintf(tells, "ERROR: creation of job failed, exit with %d\\n", status);
::report(tells);
return 1;
}



/*
* Execute task (Calculate 2 dimension convolution of two arrays)
*/

status = vslsConvExec(task,kernel,NULL,image,NULL,result,NULL);
if( status != VSL_STATUS_OK ){
char tells[256];
memset(tells, 0, sizeof(tells));
sprintf(tells, "ERROR: job status bad, exit with %d\\n", status);
::report(tells);
return 1;
}

/*
* Delete task object (delete descriptor of problem)
*/
status = vslConvDeleteTask(&task);
if( status != VSL_STATUS_OK ){
char tells[256];
memset(tells, 0, sizeof(tells));
sprintf(tells, "ERROR: failed to delete task object, exit with %d\\n", status);
::report(tells);
return 1;
}

0 Kudos
6 Replies
Victor_Gladkikh
New Contributor I
913 Views
Hi Howard,

Could you provide more detail about dlls? Which MKLdllsdo you use?

Victor.
0 Kudos
Howard_Weiss
Beginner
913 Views
10.3.1.1 (as part of Intel C++ Composer XE 2011)
0 Kudos
Howard_Weiss
Beginner
913 Views
My observation is memory size of my application increases by 500 MB during the execution of the convolution.

0 Kudos
Victor_Gladkikh
New Contributor I
913 Views
Hi Howard

I think this memory sizeisnormal for the problem.

Could you send simple reproducer of the issue to me?Or could you sent at least building log of you dll?

Best regards
Victor




0 Kudos
Howard_Weiss
Beginner
913 Views
Victor -

It will take some time to create a simple reproducer.

Is there a way to obtain more information regarding the memory allocation failure itself - e.g. memory size, memory request size. All I have to work with is the error code.
0 Kudos
Victor_Gladkikh
New Contributor I
913 Views

Howard,

you also can switch off MKL memory management software (set MKL_DISABLE_FAST_MM=1). As mentioned in MKL documentation:

"Intel Math Kernel Library (Intel MKL) has memory management software that controls memory buffers for the use by the library functions. New buffers that the library allocates when your application calls Intel MKL are not deallocated until the program ends. To get the amount of memory allocated by the memory management software, call the mkl_mem_stat() function. If your program needs to free memory, call mkl_free_buffers(). If another call is made to a library function that needs a memory buffer, the memory manager again allocates the buffers and they again remain allocated until either the program ends or the program deallocates the memory. This behavior facilitates better performance. However, some tools may report this behavior as a memory leak.

The memory management software is turned on by default, which leaves memory allocated by calls to Intel MKL until the program ends. To disable this behavior of the memory management software, set the MKL_DISABLE_FAST_MM environment variable to any value. This configures the memory management software to allocate and free memory from call to call. Disabling this feature will negatively impact performance of some Intel MKL routines, especially for small problem sizes"

Or you could find other option for memory manage in Intel Math Kernel Library for Windows* OS User's Guide, topicUsing Memory Management.

0 Kudos
Reply