Community
cancel
Showing results for 
Search instead for 
Did you mean: 
bstrouse
Beginner
79 Views

MKL memory allocation: Is there an mkl_realloc?

Hello,

I know that dynamic arrays being used by the Intel MKL functions needed to be allocated and deleted by the mkl_malloc and mkl_free. I was wondering if there was an mkl_realloc function provided in case you wanted to attempt and change the amount of memory allocated for a specific address stored inside a pointer.

Thanks.
0 Kudos
4 Replies
Chao_Y_Intel
Employee
79 Views

Hello,

MKL only has the malloc functions, and no remalloc functions. mkl_malloc is calling the system malloc function, and it may allocate a little larger memory size, and make sure it can return the aligned the memory address. If you need to have a aligned remalloc function, I think may do something like that with system remalloc system call.

Thanks,
Chao

bstrouse
Beginner
79 Views

So basically, I would have to write my own remalloc function to replace the standard one. If I wanted to do this, do I only need to make sure that remalloc is assigning chunks in multiples of the byte alignment (for example 16 bytes alignment)?

Thanks,
Blake
Chao_Y_Intel
Employee
79 Views

Blake,

I just have quick search, in windows, the system runtime library provide the API: _aligned_realloc:
http://msdn.microsoft.com/en-us/library/y69db7sx(v=VS.71).aspx

Thanks,
Chao

TimP
Black Belt
79 Views

I just have quick search, in windows, the system runtime library provide the API: _aligned_realloc:
http://msdn.microsoft.com/en-us/library/y69db7sx(v=VS.71).aspx

Then you should use the corresponding Microsoft aligned_malloc and free functions, in case the MKL definitions aren't fully compatible.
Reply