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

'Link line advisor' recommendations don't work for me

hpf_cyg
Beginner
540 Views

Hi, I want to compile a simple fortran code with gfortran containing an Intel MKL random number generator but it seems like my compiler options or link line are wrong. I tested multiple options recommended by the ‘link line advisor’ and recommendations in forums but none of them work and it’s driving me crazy.

 

I use a simple example code ( ${MKL}/examples/vslf/source/vsrnggaussian.f )

 

 

      include 'mkl_vsl.f90'
      include "errcheck.inc"

      program MKL_VSL_TEST

      USE MKL_VSL_TYPE
      USE MKL_VSL

      integer(kind=4) i,nn
      integer n
      integer(kind=4) errcode
      real(kind=4) a,sigma
      real(kind=4) r(1000)
      integer brng,method,seed
      real(kind=8) tM,tD,tQ,tD2
      real(kind=8) sM,sD
      real(kind=8) sum, sum2
      real(kind=8) s
      real(kind=8) DeltaM,DeltaD
      TYPE (VSL_STREAM_STATE) :: stream

      n=1000
      nn=10
      brng=VSL_BRNG_MCG31
      method=VSL_RNG_METHOD_GAUSSIAN_ICDF
      seed=777
      a=0.0
      sigma=1.0

!     ***** Initialize *****
      errcode=vslnewstream( stream, brng,  seed )
      call CheckVslError(errcode)

!     ***** Call RNG *****
      errcode=vsrnggaussian( method, stream, n, r, a, sigma)
      call CheckVslError(errcode)

       [………]     

!     ***** Deinitialize *****
      errcode=vsldeletestream( stream )
      call CheckVslError(errcode)

10    format(F7.3)
11    format(A,F5.3)
12    format(A,F5.2,A,F5.2,A,F5.2,A,F5.2,A)
      end

 

 

compiler + link line:

gfortran -m64 -fallow-invalid-boz -g vsrnggaussian.f -o vsrnggaussian.exe -I"%MKLROOT%/include/" "%MKLROOT%/lib/intel64_win/mkl_intel_lp64.lib" "%MKLROOT%/lib/intel64_win/mkl_sequential.lib" "%MKLROOT%/lib/intel64_win/mkl_core.lib"

 

(instead of env variable %MKLROOT% I use the hard path)

 

spec:

-Windows 10 Enterprise x64

-Intel Parallel Studio XE 2016 (I used the 'link line advisor' recommendations for v2017 )

-gfortran 10 (gcc version 10.2.0)

-VS 2015

 

I always get following errors:

  • undefined reference to `vsldeletestream_'
  • undefined reference to `vslnewstream_'
  • undefined reference to `vsrnggaussian_'

 

I guess since there is no error on the INCLUDE mkl_vsl.f90 or USE MKL_VSL_TYPE / MKL_VSL, the problem has to be the linking to the libraries which contain the 3 functions that aren't referenced. Is this correct? What am I missing in my compiler line?

0 Kudos
5 Replies
mecej4
Honored Contributor III
521 Views

The link line advisor does not cover the use of Gfortran on Windows. Since there is no official binary release of Gfortran for Windows, the third party (Cygwin, Mingw, etc.) repackaging adds another level of uncertainty to the name decoration.

If you want to just get the example code to compile and run, try linking to the run-time DLL directly:

 

gfortran vsrnggaussian.f %mklroot%\redist\intel64\mkl_rt.1.dll

 

0 Kudos
hpf_cyg
Beginner
517 Views

Thanks for the advice. I've tried it but it didn't work.

 

I use the ifort compiler now and it perfektly works. For anyone who wants to use gfortran on windows with intel mkl in the future... Just don't do it.

0 Kudos
MRajesh_intel
Moderator
503 Views

Hi,


Currently, on Windows Intel Fortran, Intel Fortran (Beta) and PGI Fortran compilers are only supported.


Please let us know if you have any other issues. If not, can we close this thread?


Regards

Rajesh.


0 Kudos
hpf_cyg
Beginner
495 Views

It works with ifort, i won't try it anymore with gfortran. The thread can be closed.

0 Kudos
MRajesh_intel
Moderator
478 Views

  

Hi,


Thanks for the confirmation!


As this issue has been resolved, we will no longer respond to this thread. If you require any additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.


Have a Good day.


Regards

Rajesh


0 Kudos
Reply