mpich2+gfortran+siesta3.1安装过程

来源:互联网 发布:linux命令启动db2服务 编辑:程序博客网 时间:2024/05/20 05:10
mpich2+gfortran+siesta3.1安装过程
   最近有用户需要siesta软件,于是安装了一遍,还真是费了不少事,不知道是siesta还是netlib的数学库和intel的编译器不兼容,用intel的编译器试了好几遍都不成功,用gfortran一遍就顺利的通过了。下面是具体的过程。
        一、gfortran
        这个一般linux系统都自带的
        二、mpich2
        这个可以在官网上下载,其中的fortran模块需要用gfortran编译在~/.bashrc中 export  FC=gfortran  F90=gfortran 然后  ./configure --prefix=/data3/home/xhx/opt/mpich2-gfortran --enable-fc --enable-f77 --with-pm=mpd:hydra。安装完之后在~/.bashrc中设置MPI环境变量。
        三、安装netlib数学库
        1、BLAS
         到官网下载,直接进人文件夹直接make就行,会生成blas_LINUX.a文件。
        2、lapack 3.4.2
         到官网下载。
         首先要进入BLACS目录,把librefblas.a   make出来
         cp  make.inc.example  make.inc
         vim make.inc
SHELL = /bin/sh
#
#  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  = gfortran
OPTS     = -O2
DRVOPTS  = $(OPTS)
NOOPT    = -O0
LOADER   = gfortran
LOADOPTS =
#
# Timer for the SECOND and DSECND routines
#
# Default : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME
#TIMER    = EXT_ETIME
# For RS6K : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME_
# TIMER    = EXT_ETIME_
# For gfortran compiler: SECOND and DSECND will use a call to the INTERNAL FUNCTION ETIME
TIMER    = INT_ETIME
# If your Fortran compiler does not provide etime (like Nag Fortran Compiler, etc...)
# SECOND and DSECND will use a call to the INTERNAL FUNCTION CPU_TIME
# TIMER    = INT_CPU_TIME
# If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0
# TIMER     = NONE
#
#  Configuration LAPACKE: Native C interface to LAPACK
#  To generate LAPACKE library: type 'make lapackelib'
#  Configuration file: turned off (default)
#  Complex types: C99 (default)
#  Name pattern: mixed case (default)
#  (64-bit) Data model: LP64 (default)
#
# CC is the C compiler, normally invoked with options CFLAGS.
#
CC = gcc
CFLAGS = -O3
#  The archiver and the flag(s) to use when building archive (library)
#  If you system has no ranlib, set RANLIB = echo.
#
ARCH     = ar
ARCHFLAGS= cr
RANLIB   = ranlib
#
#  Location of the extended-precision BLAS (XBLAS) Fortran library
#  used for building and testing extended-precision routines.  The
#  relevant routines will be compiled and XBLAS will be linked only if
#  USEXBLAS is defined.
#
# USEXBLAS    = Yes
XBLASLIB     =
# XBLASLIB    = -lxblas
#
#  The location of the libraries to which you will link.  (The
#  machine-specific, optimized BLAS library should be used whenever
#  possible.)
#
BLASLIB      = ../../librefblas.a
LAPACKLIB    = liblapack.a
TMGLIB       = libtmglib.a
LAPACKELIB   = liblapacke.a

         3、BLACS
     从官网下载mpiblacs,从BMAKS文件夹中寻找合适的Bmake文件,直接make就行。
        4、scalapack2.0.2
     从官网下载scalapack,进入目录。
     cp  SLmake.inc.example  SLmake.inc
      make
     四、安装siesta 3.1
     到Obj目录下,
     sh ../Src/obj_setup.sh
     sh ../Src/configure  --enable-mpi --with-blas=/data3/blas_LINUX.a --with-lapack=/data3/liblapack.a --with-blacs=/data3/blacs_MPI-LINUX-0.a --with-scalapack=/data3/libscalapack.a
      make
      如果顺利就会编译出siesta,如果出现错误,可以先到把Src/MPI 目录下的所有东西都拷贝到 Obj/MPI/目录下make之后再到Obj目录下make。
      至此全部安装完毕。