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

How to allocate arbitrary sized array of MKL_Complex16 numbers?

Bogdan_S_
Beginner
412 Views

Hi all,

I have been trying to alloacate arbitrary sized array of complex numbers using mkl_malloc and MKL_Complex16 or 8. However the regular mkl_malloc syntax (used say for array of double values) seems to produce segmentation_fault. On the other hand if mkl_malloc is changed to regular malloc everything passes but MKL_FFT functions don't return correct result. Here is the line I try to use:

struct _MKL_Complex16 * x = (struct _MKL_Complex16*) mkl_malloc(128 * sizeof(struct _MKL_Complex16), 64);

Where for example I try to allocate memory for 128 complex numbers. and 64 is allignment becuase my OS is 64-bit (is this correct?)... In real pratcitce I will need to allocate much more then 128 numbers. My advisor is telling me that on cluster we will need arrays sized in gigabytes so I really need a mechanism that can allocate lots of memory on heap.

Thanks for any help,

Bogdan

0 Kudos
2 Replies
Dmitry_B_Intel
Employee
412 Views

Please make sure the compiler knows the prototype of mkl_malloc function. That is, #include <mkl.h> or at least #include <mkl_service.h>. Including just mkl_types.h is not enough.

Also, a correct program may produce segmentation faults if it is linked incorrectly. Could you post your build lines?

Thanks

Dima

0 Kudos
Bogdan_S_
Beginner
412 Views

Hi Dima, 

you where actually right. I forgot to put mkl.h into includes. I only put #include "mkl_dfti.h" which was not enough.

Everything works now.

Thanks!

 

0 Kudos
Reply