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

mkl_realloc alignment

DarioMangoni
初學者
941 檢視

Hi,
I'm facing a problem probably due to misalignment so I decided to use mkl_*alloc with Parallel Direct Sparse Solver.

The solver needs 64byte alignment that is succesfully obtained my mkl_malloc/mkl_calloc specifying the alignment parameter.
Unfortunately this is not possible with mkl_realloc: its default is a simple 16byte alignment and nothing can be done to bypass this default behaviour.
Any workaround?

Thanks,
Dario

0 積分
5 回應
Gennady_F_Intel
941 檢視

voidmkl_realloc (void *ptrsize_t size);  If ptr is NULL, the function works as mkl_malloc !

DarioMangoni
初學者
941 檢視

Sorry, maybe I didn't specify that I WANT to reallocate that vector! If I didn't want to, I'd use mkl_malloc!
If I use mkl_realloc to reallocate, the address is no more 64byte aligned!

I can create another array with mkl_malloc and then copy the data, but the memory peak (mkl_peak_mem_usage()) is incredibly higher than using mkl_realloc.

Another question... does mkl_realloc try to "expand" the current array before moving it elsewhere?

Gennady_F_Intel
941 檢視

thanks for the issue. mkl_realloc doesn't remember the alignment of the "original" array but it must to keep this alignment. We will fix this into one of the next releases/updates.

 

Gennady_F_Intel
941 檢視

the problem has been fixed in MKL v.11.3.1

Eugene_S_1
初學者
941 檢視

Please amend the documentation on mkl_realloc by explicitly stating that alignment is preserved. Now it says nothing about the alignment of a new buffer.

回覆