24小时热门版块排行榜    

查看: 2170  |  回复: 2
【奖励】 本帖被评价1次,作者Birdofwander增加金币 0.6

Birdofwander

禁虫 (小有名气)


[资源] 使用gfortran和openmpi并行编译SIESTA(原创)

使用gfortran和openmpi并行编译SIESTA

Openmpi安装
1.  ./configure --prefix=/home/chengxl/sourcecode/openmpi-gnu CC=gcc CXX=g++ F77=gfortran FC=gfortran
2.  make all 3.  make install4. 打开 ~/.bashrc 添加环境变量      export PATH=/usr/local/openmpi-1.4.3/bin:$PATH   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/openmpi-1.4.3/lib5. source ~/.bashrc(重新打开终) 并验证    which mpicc                            which  mpic++                            which mpif77                            which mpif90
安装 lapack
下载:http://www.netlib.org/lapack

cp make.example.inc make.inc
并修改以下几行:
BLASLIB      =  /your/path/to/lapack-3.4.2/librefblas.a   # 将要创建一个librefblas.a
LAPACKLIB    =  liblapack.a
TMGLIB       =  libtmglib.a
LAPACKELIB   =  liblapacke.a

Make
安装 BLACS
http://www.netlib.org/blacs下载MPIBLACS
在BMAKES文件夹中拷出Bmake.MPI-LINUX Bmake.inc

参见:How do I build BLACS with Open MPI http://www.open-mpi.org/faq/?category=mpi-apps
修改Bmake.inc
# Section 1:
# Ensure to use MPI for the communication layer
   COMMLIB = MPI
# The MPIINCdir macro is used to link in mpif.h and
# must contain the location of Open MPI's mpif.h.  
# The MPILIBdir and MPILIB macros are irrelevant
# and should be left empty.
   MPIdir = /path/to/openmpi-1.6.5
   MPILIBdir =
   MPIINCdir = $(MPIdir)/include
   MPILIB =

# Section 2:
# Set these values:
   SYSINC =
   INTFACE = -Df77IsF2C
   SENDIS =
   BUFF =
   TRANSCOMM = -DUseMpi2
   WHATMPI =
   SYSERRORS =
# Section 3:
# You may need to specify the full path to
# mpif77 / mpicc if they aren't already in
# your path.
   F77            = mpif77
   F77LOADFLAGS   =
   CC             = mpicc
   CCLOADFLAGS    =
Make mpi
安装 scalapack
参见:http://www.open-mpi.org/faq/?category=mpi-apps

# Make sure you follow the instructions to build BLACS with Open MPI,
# and put its location in the following.

   BLACSdir      = <path where you installed BLACS>

# The MPI section is commented out.  Uncomment it. The wrapper
# compiler will handle SMPLIB, so make it blank. The rest are correct
# as is.

   USEMPI        = -DUsingMpiBlacs
   SMPLIB        =
   BLACSFINIT    = $(BLACSdir)/blacsF77init_MPI-$(PLAT)-$(BLACSDBGLVL).a
   BLACSCINIT    = $(BLACSdir)/blacsCinit_MPI-$(PLAT)-$(BLACSDBGLVL).a
   BLACSLIB      = $(BLACSdir)/blacs_MPI-$(PLAT)-$(BLACSDBGLVL).a
   TESTINGdir    = $(home)/TESTING

# The PVMBLACS setup needs to be commented out.

   #USEMPI        =
   #SMPLIB        = $(PVM_ROOT)/lib/$(PLAT)/libpvm3.a -lnsl -lsocket
   #BLACSFINIT    =
   #BLACSCINIT    =
   #BLACSLIB      = $(BLACSdir)/blacs_PVM-$(PLAT)-$(BLACSDBGLVL).a
   #TESTINGdir    = $(HOME)/pvm3/bin/$(PLAT)

# Make sure that the BLASLIB points to the right place.  We built this
# example on Solaris, hence the name below.  The Linux version of the
# library (as of this writing) is blas_LINUX.a.

   BLASLIB       = $(LAPACKdir)/blas_solaris.a

# You may need to specify the full path to mpif77 / mpicc if they
# aren't already in your path.
我改的:
BLACSdir      = /path to/BLACS/LIB
BLASLIB       = -L/path to/lapack-3.4.2 -lrefblas
LAPACKLIB     = -L/path to/lapack-3.4.2 -llapack
LIBS          = $(LAPACKLIB) $(BLASLIB)

USEMPI        = -DUsingMpiBlacs
SMPLIB        =
BLACSFINIT    = $(BLACSdir)/blacsF77init_MPI-LINUX-0.a
BLACSCINIT    = $(BLACSdir)/blacsCinit_MPI-LINUX-0.a
BLACSLIB      = $(BLACSdir)/blacs_MPI-LINUX-0.a
#TESTINGdir    = $(home)/TESTING
编译siesta
将Src/MPI中全部拷到 Obj/MPI中,make
在Obj文件夹中执行:
sh ../Src/obj_setup.sh
../Src/configure --enable-mpi(详见--help)
修改 arch.make, 我的:
FC=mpif90
FPPFLAGS= -DFC_HAVE_FLUSH -DFC_HAVE_ABORT -DMPI

BLAS_LIBS=       -L/path/lapack-3.4.2/ -lrefblas
LAPACK_LIBS=     -L/path/lapack-3.4.2/ -llapack -ltmglib
BLACS_LIBS=     -L/path/BLACS/LIB/blacs_MPI-LINUX-0.a
SCALAPACK_LIBS= -L/path/scalapack-2.0.2/ -lscalapack

COMP_LIBS= dc_lapack.a linalg.a

MPI_INTERFACE=libmpi_f90.a
MPI_INCLUDE=/home/feng/scisoft/openmpi-gnu/include
测试:
mpirun -np <nproc> siesta < input.fdf > output
回复此楼

» 收录本帖的淘帖专辑推荐

科研小木虫

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

花无刺

木虫 (著名写手)


★★★ 三星级,支持鼓励

楼主有没有测试过gfortran和ifort编译,速度比较如何?
2楼2013-07-11 10:10:45
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

Birdofwander

禁虫 (小有名气)

本帖内容被屏蔽

3楼2013-07-11 13:35:31
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 Birdofwander 的主题更新
☆ 无星级 ★ 一星级 ★★★ 三星级 ★★★★★ 五星级
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[教师之家] 焦虑 +7 水冰月月野兔 2026-03-13 9/450 2026-03-16 10:00 by Quakerbird
[考研] 326求调剂 +3 mlpqaz03 2026-03-15 3/150 2026-03-16 07:33 by Iveryant
[考研] 本科南京大学一志愿川大药学327 +3 麦田耕者 2026-03-14 3/150 2026-03-14 20:04 by 外星文明
[考研] 265求调剂 +4 威化饼07 2026-03-12 4/200 2026-03-14 17:23 by userper
[基金申请] 面上和青基一样限30页不合理 +5 wowsunflower 2026-03-10 7/350 2026-03-14 17:21 by kingkocxr
[考研] 考研材料与化工,求调剂 +8 戏精丹丹丹 2026-03-09 8/400 2026-03-14 01:14 by JourneyLucky
[考研] 307求调剂 +7 超级伊昂大王 2026-03-10 7/350 2026-03-14 00:49 by JourneyLucky
[考研] 318求调剂 +3 李新光 2026-03-10 3/150 2026-03-14 00:21 by JourneyLucky
[考研] 2026考研调剂+本科延边大学+山东大学+生物化学与分子生物学+有项目经验 +3 ccdsscjy 2026-03-10 3/150 2026-03-14 00:12 by JourneyLucky
[考研] 308求调剂 +5 是Lupa啊 2026-03-11 5/250 2026-03-13 22:13 by JourneyLucky
[考研] 0703化学一志愿211 总分320求调剂 +5 玛卡巴卡啊哈 2026-03-11 5/250 2026-03-13 21:40 by JourneyLucky
[考研] 285化工学硕求调剂(081700) +6 柴郡猫_ 2026-03-12 6/300 2026-03-13 20:46 by hmn_wj
[考研] 26调剂/材料科学与工程/总分295/求收留 +9 2026调剂侠 2026-03-12 9/450 2026-03-13 20:46 by 18595523086
[考研] 考研调剂 +4 芬达46 2026-03-12 4/200 2026-03-13 16:04 by ruiyingmiao
[考研] 295求调剂 +3 小匕仔汁 2026-03-12 3/150 2026-03-13 15:17 by vgtyfty
[考研] 304求调剂(085602一志愿985) +12 化工人999 2026-03-09 12/600 2026-03-13 12:02 by JourneyLucky
[考研] 材料专硕274一志愿陕西师范大学求调剂 +4 薛云鹏 2026-03-13 4/200 2026-03-13 10:40 by 学员8dgXkO
[考研] 纺织、生物、化学、材料相关专业招生了 +4 耶耶业 2026-03-09 7/350 2026-03-12 19:05 by Equinoxhua
[考研] 085600 材料与化工 295 求调剂 +10 dream…… 2026-03-10 12/600 2026-03-12 13:46 by dream……
[考研] 求调剂材料专硕293 +6 段_(:з」∠)_ 2026-03-10 6/300 2026-03-10 18:22 by ms629
信息提示
请填处理意见