高性能计算

scalapack 在linux.intel上的编译 安装

2009年7月29日 阅读(1,507)

LAPACK:内含BLAS
错误:
spstrf.f: In subroutine `spstrf’:
spstrf.f:102: warning:
         INTRINSIC          MAX, MIN, SQRT, MAXLOC
                                            ^
Reference to unimplemented intrinsic `MAXLOC’ at (^) (assumed EXTERNAL)
spstrf.f:102:
         INTRINSIC          MAX, MIN, SQRT, MAXLOC
                                            ^
Invalid declaration of or reference to symbol `maxloc’ at (^) [initially seen at (^)]
spstrf.f:204:
                        ITEMP = MAXLOC( WORK( (N+J):(2*N) ), 1 )
                                        1          2
Invalid token at (2) in expression or subexpression at (1)
spstrf.f:291:
                        ITEMP = MAXLOC( WORK( (N+J):(2*N) ), 1 )
                                        1          2
Invalid token at (2) in expression or subexpression at (1)

答案:
Since 3.2,  LAPACK moved to fortran 90 standard, so you cannot use g77  
to build the library anymore. gfortran, g95 are fine.
For more details on LAPACK 3.2 release, please read the
http://www.netlib.org/lapack/lapack-3.2.html
Let me know if you have any other question.
Sincerely
Julie Langou

You can not compile LAPACK with g77. (This is true since 3.2).
You can use gfortran for example.

On Mon, 24 Nov 2008, Daniel R. Grayson wrote:

最后重新下载安装了gfortran,就安装好了。

BLACS:

修改Bmake.inc

   BTOPdir = /home/duanple/scalapack/BLACS
   MPIdir = /home/duanple/intel/ict/3.0.1/mpi/3.0

   INTFACE = -DAdd_
   F77            = gfortran

copy到BLACS根目录,运行make mpi

scalapack:

修改Bmake.inc

home          = /home/duanple/scalapack/scalapack-1.8.0
BLACSdir      = /usr/local/lib

#  MPI setup; tailor to your system if using MPIBLACS
#  Will need to comment out these 6 lines if using PVM
#
USEMPI        = -DUsingMpiBlacs
SMPLIB        = /home/duanple/intel/ict/3.0.1/mpi/3.0/lib/libmpi.a
BLACSFINIT    = $(BLACSdir)/blacsF77init_MPI-LINUX-0.a
BLACSCINIT    = $(BLACSdir)/blacsCinit_MPI-LINUX-0.a
BLACSLIB      = $(BLACSdir)/blacs_MPI-LINUX-0.a

#
#  The name of the libraries to be created/linked to
#
SCALAPACKLIB  = $(home)/libscalapack.a
BLASLIB       = /home/duanple/scalapack/lapack-3.2.1/blas_LINUX.a
LAPACKLIB     = /home/duanple/scalapack/lapack-3.2.1/lapack_LINUX.a

开始运行make

错误处理:
实际上在运行make exe时出现错误

psblastst.f:(.text+0xfac7): undefined reference to `do_fio’
psblastst.f:(.text+0xfae2): undefined reference to `do_fio’
psblastst.f:(.text+0xfafc): undefined reference to `do_fio’
psblastst.f:(.text+0xfb30): undefined reference to `do_fio’
psblastst.f:(.text+0xfb4b): undefined reference to `do_fio’

I.e. you might need libg2c.so (libg2c.a?) installed on your machine. [On
our 64 bit Fedora Core 6 (AMD Opteron) the rpm file is ‘compat-libf2c’.]
But once you have your code running you probably want to either
compile faster BLAS and LAPACK libraries or use ones provided by hardware
or compiler vendors: In this case you probably could use the MKL libraries
by Intel. Then you don’t need to bother with this issue of linking.

查看make的指令实际是这样的:
mpif90 -o /home/duanple/scalapack/scalapack-1.8.0/TESTING/xdscaex pdscaex.o pdscaexinfo.o /home/duanple/scalapack/scalapack-1.8.0/libscalapack.a /home/duanple/scalapack/BLACS/LIB/blacs_MPI-LINUX-0.a /home/duanple/scalapack/BLACS/LIB/blacsCinit_MPI-LINUX-0.a  /home/duanple/scalapack/BLACS/LIB/blacsF77init_MPI-LINUX-0.a  /home/duanple/scalapack/BLACS/LIB/blacs_MPI-LINUX-0.a /home/duanple/scalapack/lapack-3.2.1/lapack_LINUX.a /home/duanple/scalapack/lapack-3.2.1/blas_LINUX.a /home/duanple/intel/ict/3.0.1/mpi/3.0/lib/libmpi.a

一。这样添加上-lg2c
mpif90 -lg2c -o /home/duanple/scalapack/scalapack-1.8.0/TESTING/xdscaex pdscaex.o pdscaexinfo.o /home/duanple/scalapack/scalapack-1.8.0/libscalapack.a /home/duanple/scalapack/BLACS/LIB/blacs_MPI-LINUX-0.a /home/duanple/scalapack/BLACS/LIB/blacsCinit_MPI-LINUX-0.a  /home/duanple/scalapack/BLACS/LIB/blacsF77init_MPI-LINUX-0.a  /home/duanple/scalapack/BLACS/LIB/blacs_MPI-LINUX-0.a /home/duanple/scalapack/lapack-3.2.1/lapack_LINUX.a /home/duanple/scalapack/lapack-3.2.1/blas_LINUX.a /home/duanple/intel/ict/3.0.1/mpi/3.0/lib/libmpi.a

仍然有如下错误:
pdscaex.o: In function `MAIN__’:
pdscaex.f:(.text+0x4d): undefined reference to `blacs_pinfo_’
pdscaex.f:(.text+0xca): undefined reference to `blacs_get_’
pdscaex.f:(.text+0xf0): undefined reference to `blacs_gridinit_’
pdscaex.f:(.text+0x114): undefined reference to `blacs_gridinfo_’
pdscaex.f:(.text+0x14a): undefined reference to `blacs_exit_’
pdscaex.f:(.text+0x590): undefined reference to `blacs_gridexit_’
/home/duanple/scalapack/BLACS/LIB/blacsF77init_MPI-LINUX-0.a(Cblacs_pinfo.o): In function `Cblacs_pinfo’:
blacs_pinfo_.c:(.text+0x65): undefined reference to `bi_f77_get_constants__’
blacs_pinfo_.c:(.text+0x9d): undefined reference to `bi_f77_init__’
collect2: ld 返回 1
make: *** [pdscaex] 错误 1

二。原因有了,解决方案大概如下:
Hi,
I’m replying to my own message, as I have found a
dirty trick to bypass the problem.

At final linking stage of my code, I add the file
BLACS/SRC/MPI/INTERNAL/bi_f77_get_constants.o
to the list of object files and libraries.
Then the problem of the undefined reference is solved.

For some strange reason, this object file doesn’t make it into
the blacs library files.

简单来说就是链接时直接加上这个文件:bi_f77_get_constants.o
mpif90 -lg2c -o /home/duanple/scalapack/scalapack-1.8.0/TESTING/xdscaex pdscaex.o pdscaexinfo.o  /home/duanple/scalapack/scalapack-1.8.0/libscalapack.a /home/duanple/scalapack/BLACS/LIB/blacs_MPI-LINUX-0.a /home/duanple/scalapack/BLACS/LIB/blacsCinit_MPI-LINUX-0.a  /home/duanple/scalapack/BLACS/LIB/blacsF77init_MPI-LINUX-0.a  /home/duanple/scalapack/BLACS/LIB/blacs_MPI-LINUX-0.a /home/duanple/scalapack/lapack-3.2.1/lapack_LINUX.a /home/duanple/scalapack/lapack-3.2.1/blas_LINUX.a /home/duanple/intel/ict/3.0.1/mpi/3.0/lib/libmpi.a /home/duanple/scalapack/BLACS/SRC/MPI/INTERNAL/bi_f77_get_constants.o

三。bi_f77_get_constants__没了,仍然有:
pdscaex.o: In function `MAIN__’:
pdscaex.f:(.text+0x4d): undefined reference to `blacs_pinfo_’
pdscaex.f:(.text+0xca): undefined reference to `blacs_get_’
pdscaex.f:(.text+0xf0): undefined reference to `blacs_gridinit_’
pdscaex.f:(.text+0x114): undefined reference to `blacs_gridinfo_’
pdscaex.f:(.text+0x14a): undefined reference to `blacs_exit_’
pdscaex.f:(.text+0x590): undefined reference to `blacs_gridexit_’
collect2: ld 返回 1

再看一个回答:
Bas van der Vlies wrote:
> Our environment is : Debian Etch
> g77       : 3.4.6
> gfortran  : 4.1.2
> gcc       : 4.1.2
> When we compile blacs with mvapich1 (0.9.8) and mvapich2 (0.9.8) with
> F77=g77 and F90=gfortran we can compile the blacs library and run the
> test program.
> But when we use gfortran for F77 and F90 we can compile the blacs
> library but the test program fails to run.
> Does anybody have a clue?

Hi. I’ve been looking into this as well. I think the issue might simply
be with the default output bufferring in gfortran. I’d also like to know
what you are observing, but maybe you can simply try:

export GFORTRAN_UNBUFFERED_ALL=y

and then trying the tests? When building blacs, I also set the following
in my Bmake.inc file:
INTFACE = -DAdd_
TRANSCOMM = -DCSameF77
This was specifically for the case where I built MVAPICH2 0.9.8 with
F77=gfortran and F90=gfortran.
Does any of this help solve the problem you are having?

也就是要注意这几项设置。重新编译下blacs

实际上最根本的原因,是因为在编译BLACS LAPACK Scalpack的时候,没有设置相同的fortran编译器,开始lapack必须用gfortran编译器,但是编译blacs的时候使用了g77,最后编译scalapack的时候又使用了mpif90
后来重新调整了各个*.inc的设置,BLACS LAPACK均使用gfortran,scalapack是用mpif90,最后再在scalapack里make exe就没有出现任何错误了。

You Might Also Like