FLY 发表于 2014-7-22 20:20:55

调用MKL函数无法解析

本帖最后由 FLY 于 2014-7-23 09:50 编辑

      各位大大,小白又来了。我在调用MKL函数时,可以调用sgemm[求单精度实数矩阵的乘积,fortran77接口],但是调用gemm[任何数据类型的矩阵乘积,fortran95接口,设置的参数少]编译时则提醒无法解析。求指导。
    按照9L大大的指导能运行,但是举一反三的时候又错了,怎么办?求助。    具体的错误细节在12楼

珊瑚虫 发表于 2014-7-22 21:51:31

检查一下函数名称是不是写错了,此外,相应的库有没有配置好

FLY 发表于 2014-7-22 22:31:44

珊瑚虫 发表于 2014-7-22 21:51
检查一下函数名称是不是写错了,此外,相应的库有没有配置好

怎么配置相应的库文件啊,我是用的最新的IVF编译器,所以在项目—属性—Fortran-library-Use Intel Math Library设置的。还需要其他的设置么?

珊瑚虫 发表于 2014-7-22 22:41:32

请参考
http://fcode.cn/guide-58-1.html

FLY 发表于 2014-7-23 00:13:16

珊瑚虫 发表于 2014-7-22 22:41
请参考
http://fcode.cn/guide-58-1.html

还是不行啊,亲。错误如下:
error #6404: This name does not have a type, and must have an explicit type.   
    dot函数在MKL手册中第59页,fortran95接口,还有两个同样功能的函数sdot和ddot,可以使用,但是是fortran77接口。

vvt 发表于 2014-7-23 06:40:52

代码发出来看看吧。应该是没有 use 模块。

编译错误,要么是没有 use,要么是没有设置好 include。

http://fcode.cn/uploadfile/2014/0626/20140626080839663.png

理解这 4 个步骤,一切函数库的使用,都是这 4 个操作。

FLY 发表于 2014-7-23 06:48:09

vvt 发表于 2014-7-23 06:40
代码发出来看看吧。应该是没有 use 模块。

编译错误,要么是没有 use,要么是没有设置好 include。


不是直接就能用么,需要USE模块。
Subroutine Test_sdot!矢量点乘
    implicit none
    real x(10), y(10), sdot, res
    integer n, incx, incy, i
    external dot
    n = 5
    incx = 2
    incy = 1
    do i = 1, 10
       x(i) = 1
       y(i) = 1
    end do
    res = sdot (n, x, incx, y, incy)
    print*,"SDOT=",res
    res=dot(x,y)
    write(*,*) res
End subroutine

FLY 发表于 2014-7-23 06:49:54

不知道是不是需要激活的原因

vvt 发表于 2014-7-23 06:59:02

Program www_fcode_cn
call Test_sdot()
End Program www_fcode_cn

Subroutine Test_sdot!矢量点乘
use BLAS95 !// 必须 use 某个module
implicit none
real x(10), y(10), res !// sdot 和 dot 无需声明
integer n, incx, incy, i
!external dot // 同上
n = 5
incx = 2
incy = 1
do i = 1, 10
    x(i) = 1
    y(i) = 1
end do
res = dot ( x,y ) !// F95 的接口很简单,两个参数既可
print*,"SDOT=",res
res=dot(x,y)
write(*,*) res
End subroutine

另外,你可能需要设置
项目—属性—Linker-Input-Additional Dependencies 输入 mkl_blas95.lib

FLY 发表于 2014-7-23 07:23:52

vvt 发表于 2014-7-23 06:59
Program www_fcode_cn
call Test_sdot()
End Program www_fcode_cn


按照你的指导,已经可以运行了。现在有几个问题想继续请教一下:
1、之前帖子http://fcode.cn/guide-58-1.html中说只需要在:项目-属性-Fortran-Libraries,选择 Use Intel math Kernel Library设置即可,为什么还需要设置:项目—属性—Linker-Input-Additional Dependencies 输入 mkl_blas95.lib
2、是通过何种方式知道要加载mkl_blas95.lib这个库文件,也就是说当实现不同功能时如何去获取其他库文件的名字。
3、use BLAS95这个类的名字是如何获取的,那个文档我看的不仔细,没找到啊。比如说我想求逆阵和复数矩阵的所有特征值、特征向量该加载哪一个呢?
4、当用了use BLAS95模块之后,之前的fortran77的sdot函数将不能在同一个过程中继续使用,这是为何?有没有什么办法可以继续使用,如果需要的话。
5、最后程序编译完成时是DLL,我在转移生成的DLL时需要打包使用的库文件么?如果生成EXE文件,是否同样需要。
      谢谢啦
页: [1] 2
查看完整版本: 调用MKL函数无法解析