Random number routines (MKL-VSL) and linking during compilation

Random number routines (MKL-VSL) and linking during compilation

Hello,I have a module wherein I have a gaussian random number generator (that uses the VSL Gaussian generator from MKL Library). I am using that module now to write a small program that generates 10 random numbers. I am now having a whole bunch of issues to link the programs together to create an executable. I am using Mac OSX with 64 bit architecture and Intel processor. Here is the shell script I am using:The module: randomGenerator.f90The program: testRandomGaussian.f90The script:

#! /bin/sh

echo 'compiling an MKL random generator example'





ifort -c randomGenerator.f90 -L$MKLPATH -I$MKLINCLUDE -I$MKLINCLUDE/intel64/lp64 -lmkl_blas95_lp64 -lmkl_lapack95_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -liomp5

ifort -c testRandomGaussian.f90 -L$MKLPATH -I$MKLINCLUDE -I$MKLINCLUDE/intel64/lp64 -lmkl_blas95_lp64 -lmkl_lapack95_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -liomp5

ifort -L$MKLPATH -I$MKLINCLUDE -I$MKLINCLUDE/intel64/lp64 -lmkl_blas95_lp64 -lmkl_lapack95_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -liomp5 randomGenerator.o testRandomGaussian.o -o testRandomGaussian.out

The above creates the .out executable but when i run the .out file it ends up giving me an error saying:

dyld: Library not loaded: libmkl_intel_lp64.dylib Referenced from: /Users/debanjanmukherjee/Workfiles/Work/Simple-particle-OOP/sources/./testRandomGaussian.out Reason: image not foundTrace/BPT trap: 5dyld: Library not loaded: libmkl_intel_lp64.dylib Referenced from: /Users/debanjanmukherjee/Workfiles/Work/Simple-particle-OOP/sources/./testRandomGaussian.out Reason: image not foundTrace/BPT trap: 5Can someone please offer some help t show what I am doing wrong?I can upload my codes too in case that is needed, but since the compilation completes I believe the code itself is okay and I have an error in the linking.Many thanks

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

There is no problem with compiling or linking.

The problem is related to the loading of the dynamically loaded libraries when your a.out is run and reaches a point where routines in those libraries are invoked. If the MKL *.dylib libraries are not accessible (in Linux this may be achieved by setting $LD_LIBRARY_PATH, or by modifying the ldd configuration file). The error messages are from the dynamic library loader. In looks in the usual system directories and does not find the needed .dylib files.

So what should I be doing to get this fixed ? Can I set LD_LIBRARY_PATH in Mac too ?

Hi Debanjan,

The error message dyld: Library not loaded: libmkl_intel_lp64.dylib means the system can't find the library.

So whatever in Xcode environment (either4.0 or 3.2.4)or in terminal environment, to define DYLD_LIBRARY_PATH environment variable is required.

You candefinethe variable eitherby mklvars.* or define the DYLD_LIBRARY_PATH manually.

Please refer to http://software.intel.com/en-us/forums/showthread.php?t=106397&p=1#189389

Best Regards,

Leave a Comment

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