How to Install MUMPS on MAC: A step by step instruction

简介: 关注九天学者微信公众号(扫码关注)第一时间获取技术贴更新!FIHSES是基于MUMPS开发的用于热液流体模拟的,开发者将MUMPS源代码直接放在了FISHES里面,所以在进行编译FISHES之前必须先编译MUMPS。

关注九天学者微信公众号(扫码关注)第一时间获取技术贴更新!


FIHSES是基于MUMPS开发的用于热液流体模拟的,开发者将MUMPS源代码直接放在了FISHES里面,所以在进行编译FISHES
之前必须先编译MUMPS。这里用到的是MUMPS_5.0.1。而MUMPS又依赖于OpenMPI,BLAS,LAPACK,SCALLAPACK,SCOTCH,METIS.编译器是基于gfortran的mpif90.

程序包清单

安装过程

为了不让brew等安装的杂乱版本所影响,在用户主目录下新建一个opt目录
mkdir ~/opt,在opt目录下新建一个lib目录作为安装这些库的目录.

mkdir ~/opt
mkdir ~/opt/lib

安装前准备

在 ~/.bashrc 中定义几个变量,并且 source ~/.bashrc 使其生效,标量如下

# add path of gcc: no root account install gcc
export LOCAL_OPT=/home/zhikui/opt
export LD_LIBRARY_PATH=$LOCAL_OPT/gcc/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LOCAL_OPT/gcc/lib:$LD_LIBRARY_PATH

export CPLUS_INCLUDE_PATH=$LOCAL_OPT/gcc/include:$CPLUS_INCLUDE_PATH

export PATH=$LOCAL_OPT/gcc/bin:$PATH

m4

版本: 1.4.18

tar xvf m4-1.4.18.tar.xz
cd m4-1.4.18
./configure --prefix=$LOCAL_OPT/gcc
make
make check
make install

下面的几个都是一个讨论,先 configure 然后 make check ,最后
make install

gmp

版本:
gmp-6.1.2.tar.xz

tar xvf gmp-6.1.2.tar.xz
cd gmp-6.1.2
./configure --prefix=$LOCAL_OPT/gcc --with-m4-lib=$LOCAL_OPT/gcc/lib --with-m4-include=$LOCAL_OPT/gcc/include

mpfr

版本:
mpfr-3.1.6.tar.xz

tar xvf mpfr-3.1.6.tar.xz
cd mpfr-3.1.6
./configure --prefix=$LOCAL_OPT/gcc --with-m4-lib=$LOCAL_OPT/gcc/lib --with-m4-include=$LOCAL_OPT/gcc/include --with-gmp-lib=$LOCAL_OPT/gcc/lib --with-gmp-include=$LOCAL_OPT/gcc/include

mpc

版本: mpc-1.0.2.tar.gz

tar xvf mpc-1.0.2.tar
cd mpc-1.0.2
./configure --prefix=$LOCAL_OPT/gcc --with-m4-lib=$LOCAL_OPT/gcc/lib --with-m4-include=$LOCAL_OPT/gcc/include --with-gmp-lib=$LOCAL_OPT/gcc/lib --with-gmp-include=$LOCAL_OPT/gcc/include --with-mpfr-lib=$LOCAL_OPT/gcc/lib --with-mpfr-include=$LOCAL_OPT/gcc/include

gcc

版本:
gcc-4.6.0.tar.bz2

tar xvf gcc-4.6.0.tar.bz2
cd gcc-4.6.0
./configure --prefix=$LOCAL_OPT/gcc --with-mpfr-lib=$LOCAL_OPT/gcc/lib --with-mpfr-include=$LOCAL_OPT/gcc/include --with-mpc-lib=$LOCAL_OPT/gcc/lib --with-gmp-lib=$LOCAL_OPT/gcc/lib --disable-multilib

安装MUMPS依赖库

MPICH

安装完成添加环境变量

# MPICH
export PATH="/home/zhikui/opt/lib/mpich/bin:$PATH"
export LIBPATH="/home/zhikui/opt/lib/mpich/lib:$LIBPATH"

BLAS

tar xvf blas-3.8.0.tgz
mv  BLAS-3.8.0 ~/opt/lib/
cd ~/opt/lib/BLAS-3.8.0
gfortran -shared -O2 *.f -o libblas.so -fPIC

LAPACK

tar xvf lapack-3.8.0.tar.gz
mv lapack-3.8.0 ~/opt/lib/
cd ~/opt/lib/lapack-3.8.0
cp make.inc.example make.inc
  • 修改make.inc文件中的 选项,后面添加 -fPIC
    ,并且修改lib的后缀名为 so ,然后保存
OPTS    = -O2 -frecursive -fPIC
DRVOPTS = $(OPTS)
NOOPT   = -O0 -frecursive -fPIC

BLASLIB      = ../../librefblas.so
LAPACKLIB    = liblapack.so
  • 修改./SRC/Makefile

修改第517行的内容

../$(LAPACKLIB): $(ALLOBJ) $(ALLXOBJ) $(DEPRECATED)
$(ARCH) $(ARCHFLAGS) $@ $^
$(RANLIB) $@

改为:

../$(LAPACKLIB): $(ALLOBJ)
$(LOADER) $(LOADOPTS) -shared -Wl,-soname,liblapack.so -o $@ $(ALLOBJ) ../librefblas.so
  • 修改./BLAS/SRC/Makefile

将140行内容

$(BLASLIB): $(ALLOBJ)
$(ARCH) $(ARCHFLAGS) $@ $^
$(RANLIB) $@

改为:

$(BLASLIB): $(ALLOBJ)
$(LOADER) $(LOADOPTS) -z muldefs -shared -Wl,-soname,librefblas.so -o $@ $(ALLOBJ)

继续运行编译命令

make blaslib
make lapacklib

最后生成两个lib文件: librefblas.so 和 liblapack.so

  • 修改环境变量:
    export LIBPATH="/home/zhikui/opt/lib/lapack-3.8.0:$LIBPATH"

Scotch

  • 解压: tar xvf scotch_5.1.12_esmumps.tar.gz
  • 进入: cd scotch_5.1.12_esmumps/src
  • 修改Makefile: 在36行中加入
    prefix=/home/zhikui/opt/lib/scotch_5.1.12_esmumps
    作为安装目录的指示。
  • 设置Makefile.inc: 参考 网络帖子
    设置如下:
EXE             =
LIB             = .a
OBJ             = .o

MAKE            = make
AR              = ar
ARFLAGS         = -ruv
CAT             = cat
CCS             = gcc
CCP             = mpicc
CCD             = mpicc
CFLAGS          = -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER -DSCOTCH_PTHREAD -Drestrict=__restrict -DIDXSIZE64
CLIBFLAGS       =
LDFLAGS         = -lz -lm -lrt
CP              = cp
LEX             = flex -Pscotchyy -olex.yy.c
LN              = ln
MKDIR           = mkdir
MV              = mv
RANLIB          = ranlib
YACC            = bison -pscotchyy -y -b y

关注九天学者微信公众号(扫码关注)第一时间获取技术贴更新!


相关文章
|
3月前
Mac Brew install慢的问题
Mac Brew install慢的问题
52 1
|
开发工具 git iOS开发
Mac使用brew install 安装wget工具报错 fatal: not in a git directory Error: Command failed with exit 128: git
Mac使用brew install 安装wget工具报错 fatal: not in a git directory Error: Command failed with exit 128: git
1717 0
Mac使用brew install 安装wget工具报错 fatal: not in a git directory Error: Command failed with exit 128: git
|
应用服务中间件 nginx
mac install nginx
下载 Nginx 源码包 下载页: http://nginx.org/en/download.html 当前稳定版本: http://nginx.org/download/nginx-1.8.0.tar.
2182 1
Mac电脑 - 解决 brew install 报错Error: /usr/local/Homebrew is not writable. 的问题
Mac电脑 - 解决 brew install 报错Error: /usr/local/Homebrew is not writable. 的问题
1224 0
|
分布式计算 Hadoop 数据格式
|
SQL 关系型数据库 Java
|
Shell
Mac环境pip install
Mac环境pip install问题
1910 0
|
关系型数据库 MySQL 数据安全/隐私保护
INSTALL MYSQL IN MAC
安装好MYSQL后,在System References中找到MYSQL,启动它。   启动之后在终端中输入添加MySQL路径的命令,把MYSQL路径添加到PATH中: PATH="$PATH":/usr/local/mysql/bin   在终端登录到MySQL的命令如下:mysql -u root -p 当你执行任何语句的时候如show databases是会出现类似以下的错误,请用SET PASSWORD修改密码。
862 0