- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was trying to run MKL sample code with VS2019 and encounter a Linking error.
LNK2019: unresolved external symbol _DASUM_F95 referenced in function _MAIN__ 1.obj Error fatal error
LNK1120: 1 unresolved externals Debug\Console1.exe
I think the "program" is well defined. It seems to be related to MKL. If I comment out "use f95_precision, only: wp => dp use blas95, only: asum" and other statements related to MKLit will compile. So please help me to solve it. Thx!
program DASUM_MAIN use f95_precision, only: wp => dp use blas95, only: asum implicit none integer :: n integer :: incx integer :: nx, nx1, nx2 real(wp), allocatable :: x(:) real(wp) :: sum integer :: i ! Intrinsic Functions intrinsic abs ! External Subroutines external PrintVectorD ! Executable Statements print* print*,' D A S U M EXAMPLE PROGRAM' ! Read input data from input file read* read*, n, incx nx = 1+(n-1)*abs(incx) allocate(x(n)) read*, (x(i),i=1,nx) ! Print input data print* print*, ' INPUT DATA' print 100, n call PrintVectorD(0,n,x,incx,'X ') ! Call DASUM subroutine if (incx > 0) then nx1 = 1 nx2 = nx else nx1 = nx nx2 = 1 end if sum = ASUM(x(nx1:nx2:incx)) print* print*, ' OUTPUT DATA' print 101, sum deallocate(x) 100 format(7x,'N=',i2) 101 format(10x,'DASUM = ',f8.3) stop end
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you build code that uses BLAS95 routines, you have to tell the linker to look up the BLAS95 library at link time. Similarly, you have to compile the utility file common_func.f and link the resulting OBJ file.
For example, to compile for X64 using 32-bit integer arguments to MKL routines, the command to compile and link is
ifort /Qmkl dasumx.f90 common_func.f mkl_blas95_lp64.lib
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mecej4, thanks for the reply. I am really new here, so please forgive me if my question looks stupid. Where to input this command line?
I tried to figure out myself, but it does not work.
And it gave me these two errors.
Warning warning #10006: ignoring unknown option '/Qmkl' Link
Error fatal error LNK1181: cannot open input file 'ifort.obj' LINK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Open an Intel Parallel Studio command window from the Windows Start Menu, change to your working directory, and enter the command there. If you are going to build for Win32, the library name should be mkl_blas95.lib.
If you must use Visual Studio, instead, you will need to read the documentation and look for tutorials relevant to building a Fortran application that uses MKL routines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Will:
Seeing as you are new, I will offer some free advice.
When Great Pumpkin came down to the patch there were 11 commandments only the Pumpkin dropped the stone and the 11th broke off, but it read.
Just do what mecej4 says.
I realize this is humour and some people may not be into Charlie Brown, but what the heck.
To get a command window look under the Intel Folder on the Start menu.
Of course there is the age old question, if there was a head to head Fortran competition between mecej4 and Dr Fortran and Jim Dempsey who would win?
The Great Pumpkin may reveal that to Linus one day - up until then we mere mortals and may merely look on in awe.
Have a nice day
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mecej4,
Thanks for the reply. I think I have figured out how to compile it with CMD.
But I really need to do it in visual studio as I am working on a big project which needs the MKL library to solve for system of nonlinear equations. I found a tutorial by
It seems to be just a single click, but it does not work.
But after I manually add the mkl_blas95.lib to the resource files, it works!
mecej4 (Blackbelt) wrote:Open an Intel Parallel Studio command window from the Windows Start Menu, change to your working directory, and enter the command there. If you are going to build for Win32, the library name should be mkl_blas95.lib.
If you must use Visual Studio, instead, you will need to read the documentation and look for tutorials relevant to building a Fortran application that uses MKL routines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Look through the recent mecej4 posts here and on the MKL Forum -- he has addressed this issue in the last two months.
Do exactly what he says.
If you click his name you will be led to all his posts -- you will need to hunt or do a search on BLAS etc...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do also note that this is the Intel Fortran forum, not the MKL forum. MKL has its own forum here - questions about linking to MKL or issues calling MKL should be asked in the MKL forum.
![](/skins/images/D3C0B914909A6564BBB97F4AD1ED1973/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page