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

How to write ILP64-version vdRngUniform? (Namely, very long random number array)

kingking_r_
Beginner
470 Views
......
MKL_LONG status;
VSLStreamStatePtr stream;
......
int main(){
vslNewStream(&stream, VSL_BRNG_SFMT19937, 777);
rnd_data = (double*)malloc(total * sizeof(double));
status = vdRngUniform(VSL_RNG_METHOD_UNIFORM_STD, stream, total, rnd_data, 0.0, 1.0);
vslDeleteStream(&stream);
......
}

The above quite standard c++ VSL code gives 'MKL ERROR: Parameter 3 was incorrect on entry to vdRngUniform' once the variable 'total' is large than 2^32-1. I'm trying to write a ILP64 version to overcome this. In so far as I've tried, by referring to MKL manual https://software.intel.com/sites/products/documentation/hpc/mkl/lin/MKL_UG_structure/Support_for_ILP64_Programming.htm, the error remained all along. I tried using compilation command 'icpc -DMKL_ILP64 -mkl a.cpp' and defining variable 'total' as MKL_INT type. I'm using some 64-bit linux machine.

Could you kindly help me on this? Thanks in advance!

 

0 Kudos
1 Reply
Andrey_N_Intel
Employee
470 Views

Hello,

Can you please check status of the dynamic memory allocation in your environment and let me know if the memory for rnd_data is successfully allocated in both modes, with -DMKL_INT64 and without it?

Please, use MKL_INT type for the variable total.

Andrey

0 Kudos
Reply