Hi, According to the user's manual, I should include the above file to set the allocation functions used by mkl. a) this file does not exist in the distribution I have (MKL 10.2.4.032) !! b) even if I go for the static libraries file (i_malloc.h) and try to assign the tbb malloc/free (scallable_..) the compiler complains that they are already defined (the function pointers). What am I doing wrong?? The only example in the manual, sets the pointers w/in some main. What if I want to promote it to my allocation "policy" in a library? (I assumed it to be the same if in global namespace, correct?) Thank you in advance for your help. Petros
PS1: Usng win7, mkl 10.2, vs2010 (ms compiler), tbb4. PS2: It might be a good idea if different products from intel hpc effort had the same "allocators". For Example IPP does not even provided for such an overwritting mechanism. Just saying ;-))
Hi Victor, Thank you for your response. hat about the compilation error? Here is what I get:
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int 1>c:_petros_otcsrcotclibexternalmklmemory.h(13): error C2373: 'i_malloc' : redefinition; different type modifiers 1> c:program filesintelmkl10.2.4.032includei_malloc.h(127) : see declaration of 'i_malloc' 1>c:_petros_otcsrcotclibexternalmklmemory.h(13): error C2065: 'scallabe_malloc' : undeclared identifier etc..
This source is not complete so first three errors are not clear for me. Maybe you need some self-contained file for reassigning TBB-allocator instead of MKL memory manager? But please fix a typo: TBB-functions are to be with names scalable_* not scallabe_*
//std #include using std::string; #include using std::stringstream; #include using std::cout; using std::endl; //boost #include using boost::array;
/*--------------------------------------------------- Class to encapsulate mkl's: -memory choices -array boundaries -2-d array lda -thread management:
The ppc macros: OTC_USE_MKL_ALLOCATORS OTC_USE_TBB_ALLOCATORS OTC_USE_TBB_ALLOCATORS_FOR_MKL act with the following precedence rules: If OTC_USE_MKL_ALLOCATORS is defined the mkl_malloc/free are used. If not and the other two macros are defined then the tbb scallable_malloc/free will be used. O/wise the OS malloc/free is employed. ---------------------------------------------------*/
Hi Victor, As I said, this is only an example! - please, refer to previous e-mail. The goal here is to create a library which will be using mkl. If this is to link against the mkl dll's how is it supposed to be done? It seems to me there is no provision. Given that LAPaCK is a central piece of code in a lot of packages, if one has to link against te static libs, many problems will appear (from multiple definitions of the same functions in the linking phase, in case some of these libs are compiled together towards amn executable, to large footprints for individual builds). What did the mkl designers have in mind? Thank you for your help, Petros
It needs to have a correct example to see how it works.
If your goal is to create a separate library linked with MKL, then substituting MKL memory allocator is done differently. Maybe, the best variant for you is to create MKL custom (dynamic) library with additional object wheresubstituting i_malloc/i_free is done instead standard MKL settings.