回 帖 发 新 帖 刷新版面

主题:【lapack编译出问题,请给位高手指导】

首先说下我的电脑配置:
   处理器:Intel(R) Core i7 CPU 950@3.07GHz
   安装内存:6.00GB
   系统类型:win7 x64
   编译器配置:VS2008 ,IVF11.1.054
按论坛里大家讨论的方法配置lapack3.2.1,编译一部分之后出现如下问题:

        ifort -optimize:3 -c zherk.f -o zherk.o
Intel(R) Visual Fortran Intel(R) 64 Compiler Professional for applications runni
ng on Intel(R) 64, Version 11.1    Build 20091130 Package ID: w_cprof_p_11.1.054

Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

        ifort -optimize:3 -c zher2k.f -o zher2k.o
Intel(R) Visual Fortran Intel(R) 64 Compiler Professional for applications runni
ng on Intel(R) 64, Version 11.1    Build 20091130 Package ID: w_cprof_p_11.1.054

Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

        ifort -optimize:3 -c lsame.f -o lsame.o
Intel(R) Visual Fortran Intel(R) 64 Compiler Professional for applications runni
ng on Intel(R) 64, Version 11.1    Build 20091130 Package ID: w_cprof_p_11.1.054

Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

        ifort -optimize:3 -c xerbla.f -o xerbla.o
Intel(R) Visual Fortran Intel(R) 64 Compiler Professional for applications runni
ng on Intel(R) 64, Version 11.1    Build 20091130 Package ID: w_cprof_p_11.1.054

Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

        ifort -optimize:3 -c xerbla_array.f -o xerbla_array.o
Intel(R) Visual Fortran Intel(R) 64 Compiler Professional for applications runni
ng on Intel(R) 64, Version 11.1    Build 20091130 Package ID: w_cprof_p_11.1.054

Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

      [b]  lib -out: ..\..\blas_WIN64.lib [/b]isamax.o sasum.o saxpy.o scopy.o sdot.o snrm2.o  srot.o srotg.o sscal.o sswap.o sdsdot.o srotmg.o srotm.o sgemv.o sgbmv.o ssymv.o ssbmv.o sspmv.o  strmv.o stbmv.o stpmv.o strsv.o stbsv.o stpsv.o  sger.o ssyr.o sspr.o ssyr2.o sspr2.o sgemm.o ssymm.o ssyrk.o ssyr2k.o strmm.o strsm.o
 idamax.o dasum.o daxpy.o dcopy.o ddot.o dnrm2.o  drot.o drotg.o dscal.o dsdot.o
 dswap.o drotmg.o drotm.o dgemv.o dgbmv.o dsymv.o dsbmv.o dspmv.o  dtrmv.o dtbmv
.o dtpmv.o dtrsv.o dtbsv.o dtpsv.o  dger.o dsyr.o dspr.o dsyr2.o dspr2.o dgemm.o
 dsymm.o dsyrk.o dsyr2k.o dtrmm.o dtrsm.o        scabs1.o scasum.o scnrm2.o icam
ax.o caxpy.o ccopy.o  cdotc.o cdotu.o csscal.o crotg.o cscal.o cswap.o csrot.o c
gemv.o cgbmv.o chemv.o chbmv.o chpmv.o  ctrmv.o ctbmv.o ctpmv.o ctrsv.o ctbsv.o
ctpsv.o  cgerc.o cgeru.o cher.o chpr.o cher2.o chpr2.o cgemm.o csymm.o csyrk.o c
syr2k.o ctrmm.o ctrsm.o  chemm.o cherk.o cher2k.o dcabs1.o dzasum.o dznrm2.o iza
max.o zaxpy.o zcopy.o  zdotc.o zdotu.o zdscal.o zrotg.o zscal.o zswap.o zdrot.o
 zgemv.o zgbmv.o zhemv.o zhbmv.o zhpmv.o  ztrmv.o ztbmv.o ztpmv.o ztrsv.o ztbsv.
o ztpsv.o  zgerc.o zgeru.o zher.o zhpr.o zher2.o zhpr2.o zgemm.o zsymm.o zsyrk.o
 zsyr2k.o ztrmm.o ztrsm.o  zhemm.o zherk.o zher2k.o lsame.o xerbla.o xerbla_arra
y.o
Microsoft (R) Library Manager Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.

[size=5]LINK : fatal error LNK1146: 没有用选项“/out:”指定的参数[/size]NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio 9.0
\VC\BIN\amd64\lib.EXE"”: 返回代码“0x47a”
Stop.
NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio 9.0
\VC\BIN\amd64\nmake.exe"”: 返回代码“0x2”
Stop.
急,请各位高手给予指导!!!

回复列表 (共10个回复)

沙发


我的makefile文件如下:
#
#  Top Level Makefile for LAPACK
#  Version 3.2
#  November 2008
#

include <make.inc>

all: install lib

lib: blaslib lapacklib tmglib

clean: cleanlib cleantesting cleantiming

install:
    cd $(HOME)\install
    $(MAKE)
    testlsame.exe
    testslamch.exe
    testdlamch.exe
    testsecond.exe
    testdsecnd.exe
    testieee.exe
    copy lsame.f $(HOME)\blas\src\
    copy lsame.f $(HOME)\src\
    copy slamch.f $(HOME)\src\
    copy dlamch.f $(HOME)\src\
    copy second.f $(HOME)\src\
    copy dsecnd.f $(HOME)\src\

blaslib:
    cd $(HOME)\blas\src
    $(MAKE)

lapacklib:
    cd $(HOME)\src
    $(MAKE)

tmglib:
    cd $(HOME)\testing\matgen
    $(MAKE)

testing:
    cd $(HOME)\testing
    $(MAKE)

blas_testing:
    cd $(HOME)\blas\testing
    $(MAKE) -f makeblat1
    cd $(HOME)\blas
    xblat1s > sblat1.out
    xblat1d > dblat1.out
    xblat1c > cblat1.out
    xblat1z > zblat1.out

    cd $(HOME)\blas\testing
    $(MAKE) -f makeblat2
    cd $(HOME)\blas
    xblat2s < sblat2.in
    xblat2d < dblat2.in
    xblat2c < cblat2.in
    xblat2z < zblat2.in

    cd $(HOME)\blas\testing
    $(MAKE) -f makeblat3
    cd $(HOME)\blas
    xblat3s < sblat3.in
    xblat3d < dblat3.in
    xblat3c < cblat3.in
    xblat3z < zblat3.in

timing:
    cd $(HOME)\timing
    $(MAKE)

blas_timing:
    cd $(HOME)\timing\lin
    $(MAKE)
    cd $(HOME)\timing
    xlintims < sblasa.in > sblasa.out
    xlintims < sblasb.in > sblasb.out
    xlintims < sblasc.in > sblasc.out
    cd $(HOME)\timing
    xlintimd < dblasa.in > dblasa.out
    xlintimd < dblasb.in > dblasb.out
    xlintimd < dblasc.in > dblasc.out
    cd $(HOME)\timing
    xlintimc < cblasa.in > cblasa.out
    xlintimc < cblasb.in > cblasb.out
    xlintimc < cblasc.in > cblasc.out
    cd $(HOME)\timing
    xlintimz < zblasa.in > zblasa.out
    xlintimz < zblasb.in > zblasb.out
    xlintimz < zblasc.in > zblasc.out

cleanlib:
    cd $(HOME)\install
    $(MAKE) clean
    cd $(HOME)\blas\src
    $(MAKE) clean
    cd $(HOME)\src
    $(MAKE) clean
    cd $(HOME)\testing\matgen
    $(MAKE) clean

cleantesting:
    cd $(HOME)\testing\lin
    $(MAKE) clean
    cd $(HOME)\testing\eig
    $(MAKE) clean
    cd $(HOME)\testing
    del xlin*.exe xeig*.exe

cleantiming:
    cd $(HOME)\timing\lin
    $(MAKE) clean
    cd $(HOME)\timing\lin\linsrc
    $(MAKE) clean
    cd $(HOME)\timing\eig
    $(MAKE) clean
    cd $(HOME)\timing\eig\eigsrc
    $(MAKE) clean
    cd $(HOME)\timing
    del xlin*.exe xeig*.exe
make.inc文件如下:
# -*- Makefile -*-
####################################################################
#  LAPACK make include file.                                       #
#  LAPACK, Version 3.2.1                                           #
#  April 2009                                                      #
####################################################################
#
# See the INSTALL/ directory for more examples.
#
HOME = G:\lapack-3.2.1
#
#  The machine (platform) identifier to append to the library names
#
PLAT = _WIN64
#  
#  Modify the FORTRAN and OPTS definitions to refer to the
#  compiler and desired compiler options for your machine.  NOOPT
#  refers to the compiler options desired when NO OPTIMIZATION is
#  selected.  Define LOADER and LOADOPTS to refer to the loader
#  and desired load options for your machine.
#
FORTRAN  = ifort
OPTS     =  -optimize:3
DRVOPTS  = $(OPTS)
NOOPT    = -optimize:0
LOADER   = ifort
LOADOPTS =
#
#
#  The archiver and the flag(s) to use when building archive (library)
#  If you system has no ranlib, set RANLIB = echo.
#
ARCH     = lib
ARCHFLAGS= -out:
RANLIB   = ranlib
#
#  The location of the libraries to which you will link.  (The 
#  machine-specific, optimized BLAS library should be used whenever
#  possible.)
#
BLASLIB      = ..\..\blas$(PLAT).lib
#BLASLIB     = c:\plsuite\lib\mkl_w.lib
#BLASLIB     = -lblas
LAPACKLIB    = lapack$(PLAT).lib
TMGLIB       = tmglib$(PLAT).lib
EIGSRCLIB    = eigsrc$(PLAT).lib
LINSRCLIB    = linsrc$(PLAT).lib

板凳

都安装ivf了,正常使用的话,有必要在自己编译lapack吗?

3 楼

不好意思,我对这方面了解的不多,难道IVF中已经集成了lapack?

4 楼

IVF 有MKL, 集成了lapack
lapack的makefile是写给linux的, windows恐怕不是直接make吧.

5 楼

呵呵,我将这两个文件都进行改写了,而且也不是完全不能编译,只是在中间出了问题。我查了下,说可能是编译器版本比VS的低,但是好像IVF11.1应该不会比VS2008低的:
Directly speaking, this problem is caused by using an older version of compiler(cl.exe) than your VS's one. Take a look carefully underlined lines explaining version and copyright of the compiler. Again, that build log was captured from VS2010 but it's saying that copyright is valid in 1984-1998. In VS2008 and VS2010(earlier versions are not tested), when you try to build a project, VS searches a compiler to use for your build. In this step, VS doesn't choose it's own cl.exe directly but searches directories specified in the environmental variable 'path' first. (I think that VS calls cl.exe without path) Because of that, if there's another version of cl.exe in some directory of env-path, VS unexpectedly use it! This is the reason why your VS use an older one than yours. In my case, there was another cl.exe in C:\Windows\SysWOW64(I'm using Windows 7 64bit).

6 楼

IVF11.1 是完全支持VS2008的, 而且IVF11.1.038之后已经与win7兼容.
原来的lapack遵循gnu make, 我觉得在windows下直接用那个makefile可能不妥当.
lapack官网http://www.netlib.org/lapack/ 上有个cmake版支持其他系统下编译楼主可以试试看

7 楼

谢谢各位的帮助,问题已经解决。2楼和4楼说的很对,IVF11已经集成了lapack,所以直接用就可以了。另外不一定要自己编译lapack,在lapack主页上http://icl.cs.utk.edu/lapack-for-windows/可以直接下载编译好的lib文件使用就可以了,上面有编译好的32位和64位的lib文件。

8 楼

[quote]谢谢各位的帮助,问题已经解决。2楼和4楼说的很对,IVF11已经集成了lapack,所以直接用就可以了。另外不一定要自己编译lapack,在lapack主页上http://icl.cs.utk.edu/lapack-for-windows/可以直接下载编译好的lib文件使用就可以了,上面有编译好的32位和64位的lib文件。[/quote]
lib /out: 的文件名加引号试试
或者换用 link /lib /out: 命令

lapack最好自己编译或者直接使用源码为好
因为lib和调用程序不能使用跨文件优化
还可以简单修改源码使用openmp
官方的是按照/O2编译的,性能肯定有所保留

9 楼

不知道你编译过lapack没有,-out:是lib输出的固定格式,后面的文件名根据编译的文件自动添加,所以在哪加引号?在上面的那个编译中lib -out:[u] [/u]..\..\blas_WIN64.lib isamax.o sasum.o saxpy.o scopy.o sdot.o snrm2....这句中其实就是因为-out:之后多了一个空格符,如果没有空格符就能正常编译。

10 楼

[quote]不知道你编译过lapack没有,-out:是lib输出的固定格式,后面的文件名根据编译的文件自动添加,所以在哪加引号?在上面的那个编译中lib -out:[u] [/u]..\..\blas_WIN64.lib isamax.o sasum.o saxpy.o scopy.o sdot.o snrm2....这句中其实就是因为-out:之后多了一个空格符,如果没有空格符就能正常编译。[/quote]
我不用ivf 所以不很清楚lib的用法
所以我怀疑你的路径里有空格 在makefile里加入引号可以避免这个问题
有时lib使用失败时 可以用link /lib的做法 这也是vs推荐的做法
还有你的默认选项 把lapack的性能降低了很多很多 那还不如直接下官方的lib
怕麻烦的话 官方提供cmake工程 可以直接转成VS的工程 然后修改编译选项进行编译

我来回复

您尚未登录,请登录后再回复。点此登录或注册