- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
program copy_main
implicit none
real(8) :: x(10), y(10)
integer :: n, incx, incy, i
n=3
incx=3
incy=1
do i=1,10
x(i) = i
end do
call copy (x, y)
print*, 'Y = ', (y(i), i=1,n)
end
Upon execution (ifort copy_main.f90 -L$MKLPATH -I$MKLINCLUDE -lmkl_intel -lmkl_intel_thread -lmkl_core -lguide -lpthread) I get the message:
ld: Undefined symbols:
_copy_
Do I need a USE statement (I don't need a USE statement in Fortran 77)? If so, what file do I need to reference for this? Any help would be greatly appreciated. I am running Mac OS X 10.4.11.
mandrew
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
use mkl_blas
as described in the Fortran 95 interface section of the manual. You would be able to avoid a USE or include file in either f95 or f77 only by using the specific function names, and forgoing a compile-time check on correctness of interface.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
program copy_main
use mkl95_blas
implicit none
real(8) :: x(10), y(10)
integer :: n, incx, incy, i
n=3
incx=3
incy=1
do i=1,10
x(i) = i
end do
call copy (x, y)
print*, 'Y = ', (y(i), i=1,n)
end
Upon compilation I get the following:
copy_main.f90(12): (col. 7) remark: LOOP WAS VECTORIZED.
ld: Undefined symbols:
_dcopy_mkl95_
Any suggestions as to why this is occurring?
Also, what do you mean by "specific function names?" Using the F77 syntax:
program copy_main
real x(10), y(10)
integer n, incx incy, i
n=3
incx=3
incy=1
do i=1,10
x(i) = i
end do
call scopy (n, x, incx, y, incy)
print*, 'Y = ', (y(i), i=1,n)
end
gives satisfactory results without a USE statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mandrew,
Of course, USE statement is required to call MKL blas95 and lapack95 subroutines.
As you can find in the Intel Fortran documentation,
You need an interface block for a subroutine when:
- Calling arguments use argument keywords.
- Some arguments are optional.
- A dummy argument is an assumed-shape array, a pointer, or a target.
- The subroutine extends intrinsic assignment.
- The subroutine can be referenced by a generic name.
- The subroutine is in a dynamic-link library.
So, if you compile your program without USE statement, usual Fortran 77 interface is assumed.
You can find the correspondent MKL examples, for instance:
Note, you can build .mod files and Fortran 95 libraries first.
To do this just run blas95 examples as described in the MKL user guide.
See examples execution command line also for the proper linking options.
Thanks,
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've tried running the example dcopyx.f90 as you suggested. I first built the .mod files (mkl95_blas, mkl95_precision) and placed them in the same directory as dcopyx.f90. When I compile (ifort dcopyx.f90 -L$MKLPATH -I$MKLINCLUDE -lmkl_intel -lmkl_intel_thread -lmkl_core -lguide -lpthread), I get the following message:
ld: Undefined symbols:
_printvectord_
_dcopy_mkl95_
Can you tell me why I get this message? Am I not compiling correctly, or do I need another file of some sort?
Thanks,
mandrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mandrew,
You forgot to add mkl_blas95 library (_dcopy_mkl95_ Undefined symbols) and source/common_func.f file (_printvectord_ Undefined symbols). So, try the next command line:
ifort dcopyx.f90 common_func.f -I$MKLINCLUDE -L$MKLPATH -lmkl_blas95 -lmkl_intel -lmkl_intel_thread -lmkl_core -lguide lpthread
You can find libmkl_blas95.a library in the same directory as .mod files after examples run. Copy it into $MKLPATH directory, where other MKL libraries are located.
Thanks,
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many thanks for your help - things are working great now.
mandrew
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page