Version 18 not finding constants defined in mkl_vsl_defines.h

Version 18 not finding constants defined in mkl_vsl_defines.h

I downloaded and built the latest version of the intel c/c++ compilers yesterday and have been trying to do some simple random number generation examples, but keep getting the compile error: 

icpc test.cpp -o test -lmkl_rt
>> test.cpp(40): error: identifier "VSL_METHOD_DGAUSSIAN_ICDF" is undefined
>>    errcode = vdRngGaussian( METHOD, stream, N, A, a, sigma );

 

My example code is given below. If I uncomment out the line redefining method to be 2, the constant from mkl_vsl_defines.h, the code compiles and runs as expected.

Does anybody know why this could be happening? And if in the meantime, is it possible to add a dynamically linked library to workaround not finding these constants.

#include <mkl.h> 
#include <iostream>
#define SEED 0
#define BRNG VSL_BRNG_MCG31
#define METHOD VSL_METHOD_DGAUSSIAN_ICDF
//#define METHOD 2

using namespace std;

int main(int argc, char **argv) { 
    const int N = 1000;
    double A[N] __attribute__((aligned(64))); 
    int status; 
    double a = 0, sigma = 1.0;
    
    VSLStreamStatePtr stream;
    int errcode;
    errcode = vslNewStream( &stream, BRNG, SEED );
    errcode = vdRngGaussian( METHOD, stream, N, A, a, sigma );
    errcode = vslDeleteStream( &stream );
    cout << errcode;

    return 0; 
} 

 

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I solved it. 

This was a silly mistake, I was going off old guides but I think the constant names have changed. The help for vRngGaussian found here:

https://software.intel.com/en-us/mkl-developer-reference-c-vrnggaussian#...

has the list of constants available and I should have been using

#define METHOD VSL_RNG_METHOD_GAUSSIAN_ICDF

 

 

Glad you were able to figure out. If the question pertains to MKL I would ask any future questions like this in that forum, i.e.:

https://software.intel.com/en-us/forums/intel-math-kernel-library

 

Leave a Comment

Please sign in to add a comment. Not a member? Join today