Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Version 18 not finding constants defined in mkl_vsl_defines.h

Fergal_C_
Beginner
504 Views

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 __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; 
} 

 

0 Kudos
2 Replies
Fergal_C_
Beginner
504 Views

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#40716A0C-A831-465F-9285-D28DFA06C46A

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

#define METHOD VSL_RNG_METHOD_GAUSSIAN_ICDF

 

0 Kudos
Judith_W_Intel
Employee
504 Views

 

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

 

0 Kudos
Reply