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

int, long, vslSkipAheadStream, and a bug in MKL?

jond2
初学者
1,418 次查看
by default vslSkipAheadStream takes int as argument for how far to skip ahead, no surprice, this int will overflow quickly in a typical simulation (a negative argument makes vslSkipAheadStream hang running full speed)
ok so I compile with -DMKL_ILP64 to make all ints long, then vdRngGaussian will not work.
MKL ERROR : Parameter 2 was incorrect on entry to vdRngGaussia

entire code is
double qq[20];
VSLStreamStatePtr stream,;
vslNewStream( &stream, VSL_BRNG_MCG31, 1 );
vdRngGaussian( VSL_METHOD_DGAUSSIAN_ICDF,stream, 20, qq, 0.0f, 1.0f );

I cannot see how to solve this, either argument to vslSkipAheadStream will not work, for skipping ahead too far, or vdRngGaussian gives this message. so help....


by the way vslSkipAheadStream should take long, not int as argument by default.
0 项奖励
5 回复数
TimP
名誉分销商 III
1,418 次查看
Doesn't your MKL ILP64 installation /include directory have include files with prototypes to promote your arguments? If you don't have a prototype in scope, you will have to be careful about your arguments, using e.g. 20L, qq, 0.0, 1.0 I doubt any MKL function would take a mixture of float and double arguments, such as you quote.
0 项奖励
jond2
初学者
1,418 次查看
true, but this is not the problem, the second argument, the one it complains about is VSLStreamStatePtr, and this only arises when I compile with -DMKL_ILP64.

true, the float should not have been there, the prototype is
mkl_vsl_functions.h:_Vsl_Api(int,vdRngGaussian,(MKL_INT , VSLStreamStatePtr , MKL_INT , double [], double , double ))
but it happily look it as quoted, and it maked no difference to output.

e.g. following code
double qq[2];
MKL_INT NN=2,i1=0,i2=1.0;
VSLStreamStatePtr stream;
vslNewStream( &stream, VSL_BRNG_MCG31, 1 );
vdRngGaussian( VSL_METHOD_DGAUSSIAN_ICDF,stream, NN, qq, i1, i2 );
for (int i=0;i
will give
Dina ~/temp/t >./sim
0 -6.12076
1 0.0686268

but when compiled with -DMKL_ILP64
Dina ~/temp/t >./sim MKL ERROR : Parameter 2 was incorrect on entry to vdRngGaussia
0 -3.26076e-232
1 -3.30687e-232

0 项奖励
Andrey_N_Intel
1,418 次查看

When using -DMKL_ILP64 please link your application to the suitable library locatedin the lib_ilp64 sub-directory of MKL folder (for example,..lib_ilp64em64tlibmkl_em64t.lib). Please, let us know how it works for you.

0 项奖励
jond2
初学者
1,418 次查看
that is what the manual says, but but the ilp libs are not included in the mac version I have, under /Library/Frameworks/Intel_MKL.framework
0 项奖励
Andrey_N_Intel
1,418 次查看
ILP64 support for MAC starts from MKL 10 Beta. As temporary work around you may want to replace one call to SkipAhead with 64-bit nskip parameter with sequence of calls to the same routine with proper 32-bit value of nskip. For generators like MCG31 32-bit version of SkipAheadwould be enough.
0 项奖励
回复