Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
6557 Discussions

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

hpf_cyg
Beginner
249 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
Black Belt
230 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

 

hpf_cyg
Beginner
226 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.

MRajesh_intel
Moderator
212 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.


hpf_cyg
Beginner
204 Views

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

MRajesh_intel
Moderator
187 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


Reply