||
siesta-3.0-rc2的并行编译
网上很多人反映siesta-3.0-rc2的并行编译的时候没什么问题,但是不能并行计算,并行计算的时候往往会报错。比如堆栈和内存报错等等。这几天闲着没事,对siesta进行了编译,发现确实存在这类问题。
特别是用intel ifort11编译的时候。后来我发现用以下两种方法可以解决siesta并行计算的问题。
(一)如果你坚持要用intel ifort 11来进行编译。可以采取如下方式(siesta网站主页上的方法,见http://www.icmab.es/siesta/)
在生成的arch.make文件中新加入
DUMMY_FOX= --enable-dummy
FFLAGS_DEBUG= -g -O2
而后在Obj文件夹中的makefile文件修改第148-153行,将这几行写成如下形式
$(FoX_configured):
(cd FoX; touch arch.make ; \
CONFIGURE="$(VPATH)/FoX/configure"; \
$$CONFIGURE VPATH="$(VPATH)/FoX" \
FC="$(FC_SERIAL)" FCFLAGS="$(FFLAGS_DEBUG)" \
--enable-wcml $(DUMMY_FOX) || false )
注意(cd FoX; touch arch.make ; 这一行前是一个Tab空格,而不是一个space空格
将这两个地方修改好后,
make clen
make
之后生成的siesta可执行文件并行计算不会出现问题。但要注意的是,arch.make文件中的优化级别是FFLAGS=-g -O2或FFLAGS=-g -O1或FFLAGS=-g -O0,不能是FFLAGS=-g -O3,我试了一下FFLAGS=-g -O3,发现计算过程中出现下面的错误
SPLIT: Orbitals with angular momentum L= 0
SPLIT: Basis orbitals for state 4s
izeta = 1
lambda = 1.000000
rc = 6.000769
energy = -0.359899
kinetic = 0.368794
potential(screened) = -0.728693
potential(ionic) = -6.200046
WARNING: Minimum split_norm parameter: 0.52689. Will not be able to generate orbital with split_norm = 0.15000
See manual for new split options
ERROR STOP from Node: 0
当改用FFLAGS=-g -O2和FFLAGS=-g -O0或FFLAGS=-g -O1之后则没用出现类似的错误提示,具体原因我就没去深究了。当然不同的优化级别在计算时间上会有一些差异。
比如用FFLAGS=-g -O2时,运行时间如下(用的Fe.fdf例子)
* Running on 8 nodes in parallel
>> Start of run: 6-DEC-2010 17:19:33
>> End of run: 6-DEC-2010 17:27:54
当改用FFLAGS=-g -O0时,运行时间如下(用的Fe.fdf例子)
* Running on 8 nodes in parallel
>> Start of run: 6-DEC-2010 16:48:25
>> End of run: 6-DEC-2010 16:58:58
(二)如果你不使用ifort11编译器,而是使用ifort10或以下的版本,建议配合使用openmpi来进行并行计算。
1)安装openmpi,详细步骤不说了,只是在configure的时候我使用的是如下的命令:
./configure --prefix=要安装的目录 F77=ifort FC=ifort FCFLAGS=-em64t FFLAGS=-em64t
FCFLAGS和FFLAGS是告诉编译器用的是64位的编译器,如果机器不是64位的就不用了。
make
make install
安装完成后还得添加环境变量,至于怎么添加,网上很多,搜索一下就知道了。
2)编译siesta
步骤就写了,大家都知道。下面是我的arch.make文件
#
# This file is part of the SIESTA package.
#
# Copyright (c) Fundacion General Universidad Autonoma de Madrid:
# E.Artacho, J.Gale, A.Garcia, J.Junquera, P.Ordejon, D.Sanchez-Portal
# and J.M.Soler, 1996- .
#
# Use of this software constitutes agreement with the full conditions
# given in the SIESTA license, as signed by all legitimate users.
#
.SUFFIXES:
.SUFFIXES: .f .F .o .a .f90 .F90
SIESTA_ARCH=x86_64-unknown-linux-gnu--unknown
FPP=
FPP_OUTPUT=
FC=mpif90
RANLIB=ranlib
SYS=nag
SP_KIND=4
DP_KIND=8
KINDS=$(SP_KIND) $(DP_KIND)
FFLAGS=-g -O2 #-i-static
FPPFLAGS= -DFC_HAVE_FLUSH -DFC_HAVE_ABORT -DMPI
LDFLAGS=
FFLAGS_DEBUG= -g -O2 # whatever options you might need,guohuazhong
DUMMY_FOX= --enable-dummy # whatever options you might need,guohuazhong
ARFLAGS_EXTRA=
FCFLAGS_fixed_f=
FCFLAGS_free_f90=
FPPFLAGS_fixed_F=
FPPFLAGS_free_F90=
BLAS_LIBS=-L/public/software/intel/Compiler/11.1/059/mkl/lib/em64t -lmkl_intel_lp64 -lmkl_sequential -lmkl_lapack -lmkl_core -lguide -pthread
LAPACK_LIBS=-L/public/software/intel/Compiler/11.1/059/mkl/lib/em64t -lmkl_sequential -lmkl_core -pthread
BLACS_LIBS=-L/public/software/intel/Compiler/11.1/059/mkl/lib/em64t -lmkl_blacs_openmpi_lp64 -pthread
SCALAPACK_LIBS=-L/public/software/intel/Compiler/11.1/059/mkl/lib/em64t -lmkl_scalapack_lp64 -pthread
COMP_LIBS=
COMP_LIBS=dc_lapack.a liblapack.a libblas.a ######guohuazhong screened
NETCDF_LIBS=
NETCDF_INTERFACE=
LIBS=$(SCALAPACK_LIBS) $(BLACS_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(NETCDF_LIBS)
#SIESTA needs an F90 interface to MPI
#This will give you SIESTA's own implementation
#If your compiler vendor offers an alternative, you may change
#to it here.
MPI_INTERFACE=libmpi_f90.a
MPI_INCLUDE=/public/software/mpi/openmpi1.4.2-intel/include
#Dependency rules are created by autoconf according to whether
#discrete preprocessing is necessary or not.
.F.o:
$(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<
.F90.o:
$(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_free_F90) $<
.f.o:
$(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_fixed_f) $<
.f90.o:
$(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_free_f90) $<
编译成功,祝好运!
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-23 22:58
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社