13.07.2015 Views

Intel(R) - Computational and Systems Biology at MIT

Intel(R) - Computational and Systems Biology at MIT

Intel(R) - Computational and Systems Biology at MIT

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Managing Performance <strong>and</strong> Memory 6The memory management software is turned on by default. To disable the software usingthe environment variable, set MKL_DISABLE_FAST_MM to any value, which will causememory to be alloc<strong>at</strong>ed <strong>and</strong> freed from call to call. Disabling this fe<strong>at</strong>ure will neg<strong>at</strong>ivelyimpact performance of routines such as the level 3 BLAS, especially for small problemsizes.Using one of these methods to release memory will not necessarily stop programs fromreporting memory leaks, <strong>and</strong>, in fact, may increase the number of such reports in case youmake multiple calls to the library, thereby requiring new alloc<strong>at</strong>ions with each call. Memorynot released by one of the methods described will be released by the system when theprogram ends.Redefining Memory FunctionsStarting with MKL 9.0, you can replace memory functions th<strong>at</strong> the library uses by defaultwith your own ones. It is possible due to the memory renaming fe<strong>at</strong>ure.Memory renamingIn general, if users try to employ their own memory management functions instead ofsimilar system functions (malloc, free, calloc, <strong>and</strong> realloc), actually, the memorygets managed by two independent memory management packages, which may causememory issues. To prevent from such issues, the memory renaming fe<strong>at</strong>ure wasintroduced in certain <strong>Intel</strong>® libraries <strong>and</strong> in particular in <strong>Intel</strong> MKL. This fe<strong>at</strong>ure enablesusers to redefine memory management functions.Redefining is possible because <strong>Intel</strong> MKL actually uses pointers to memory functions(i_malloc, i_free, i_calloc, i_realloc) r<strong>at</strong>her than the functions themselves. Thesepointers initially hold addresses of respective system memory management functions(malloc, free, calloc, realloc) <strong>and</strong> are visible <strong>at</strong> the applic<strong>at</strong>ion level. So, the pointervalues can be redefined programm<strong>at</strong>ically.Once a user has redirected these pointers to their own respective memory managementfunctions, the memory will be managed with user-defined functions r<strong>at</strong>her than systemones. As only one (user-defined) memory management package is in oper<strong>at</strong>ion, the issuesare avoided.<strong>Intel</strong> MKL memory management by default uses st<strong>and</strong>ard C run-time memory functions toalloc<strong>at</strong>e or free memory. These functions can be replaced using memory renaming.How to redefine memory functionsTo redefine memory functions, you may use the following procedure:6-17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!