24小时热门版块排行榜    

CyRhmU.jpeg
南方科技大学公共卫生及应急管理学院2026级博士研究生招生报考通知(长期有效)
查看: 1978  |  回复: 6
【奖励】 本帖被评价5次,作者ggdh增加金币 3.6

[资源] Dalton2011 编译心得

小结:安装Dalton2011的关键点:1,一个较高版本的编译器。2,如果是装64位的dalton,那么就需要64位的数学库以及64位的openmpi。32的亦然。本文中没有包括数学库的安装。3,编译openmpi的编译器和编译dalton的编译器要保持一致。

编译Dalton失败,在网上一查。还没有完整的Dalton2011的编译过程
于是打算写一篇方便后来人:

编译Dalton时出错:
cc1: error: unrecognized command line option "-fbacktrace"*
上dalton官网的用户邮件列表看到回答说可能是gcc版本过低

Dear Ivan,

since it does not seem very likely that you changed the F90 compiler between
the initial compilation (until you hit the cc1 error) and the continuation,
which would render any first round-compiled module file unreadable, my best
guess is that your gfortran compiler is too old (your gcc line in the
previous mail said 4.1.2).
you need at least version 4.3 to work properly with module files.

the latest stable version of gfortran is 4.7 if I am not mistaken.
hope this helps.

with best regards,

stefan

sent from my iPad

用gcc -v 命令查看本机gcc版本
gcc version 3.4.6 20060404
于是开始安装gcc
安装gcc之前先得安装三个依赖包

gmp 安装
GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers.
http://gmplib.org/下载gmp-5.0.2.tar.bz2
拷贝到服务器上
解压
tar -jxvf gmp-5.0.2.tar.bz2
cd ./gmp-5.0.2
创建安装目录
mkdir ../../local/gmp-5.0.2
./configure --prefix=/home/qin/local/gmp-5.0.2
开始编译
make
make install
make check
编译成功后在~/.bashrc里面写入环境变量
export LD_LIBRARY_PATH=/home/qin/local/gmp-5.0.2/lib:$LD_LIBRARY_PATH

mpfr 安装
The MPFR library is a C library for multiple-precision floating-point computations with correct rounding
http://www.mpfr.org/下载mpfr-3.1.0.tar.bz2
拷贝到服务器上
解压
tar -jxvf mpfr-3.1.0
cd mpfr-3.1.0
创建安装目录
mkdir ../../local/mpfr-3.1.0
./configure --prefix=/home/qin/local/mpfr-3.1.0
开始编译
make
make check
make install
编译成功后在~/.bashrc里面写入环境变量
export LD_LIBRARY_PATH=/home/qin/local/mpfr-3.1.0/lib:$LD_LIBRARY_PATH

mpc安装
Mpc is a C library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding of the result.
http://www.multiprecision.org/下载mpc-0.9.tar.gz
拷贝到服务器上
解压
tar -xzvf mpc-0.9.tar.gz
cd mpc-0.9
mkdir ../../local/mpc-0.9
./configure --prefix=/home/qin/local/mpc-0.9 --with-gmp=/home/qin/local/gmp-5.0.2 --with-mpfr=/home/qin/local/mpfr-3.1.0
make
make install
编译成功后在~/.bashrc里面写入环境变量
export LD_LIBRARY_PATH=/home/qin/local/mpc-0.9/lib:$LD_LIBRARY_PATH

gcc安装
从gcc官网下载最新gcc-4.6.2.tar.gz
解压后新建两个目录,一个用来编译,一个用来放编好的gcc
mkdir ~/local/gcc-4.6.2
mkdir ~/local/gcc-temp
cd  ~/local/gcc-temp
./configure --prefix=/home/qin/local/gcc-4.6.2 --with-gmp=/home/qin/local/gmp-5.0.2 --with-mpfr=/home/qin/local/mpfr-3.1.0 --with-mpc=/home/qin/local/mpc-0.9
make
make install
漫长等待2小时
安装好之后
在~/.bashrc中改环境变量
export LD_LIBRARY_PATH=/home/qin/local/gcc-4.6.2/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/home/qin/local/gcc-4.6.2/lib64:$LD_LIBRARY_PATH
export PATH=/home/qin/local/gcc-4.6.2/bin:$PATH
然后
source ~/.bashrc
然后
which gcc
显示
~/local/gcc-4.6.2/bin/gcc
大功告成了。
接下来安装dalton

Dalton2011安装
先解压
tar -jxvf Dalton2011_release_v0.tbz
cd Dalton2011_release/DALTON
./configure
出现一堆是非问答题。一般选默认即可
但是数学库的选择要注意一下
~/local/gcc-4.6.2/bin/gccFound /opt/intel/mkl/10.0.2.018/lib/32/libmkl.so, use it? [Y/n] n
Found /opt/intel/mkl/10.0.2.018/lib/64/libmkl.so, use it? [Y/n] n
Found /opt/intel/mkl/10.0.2.018/lib/em64t/libmkl.so, use it? [Y/n] n
Found /opt/intel/mkl/10.1.1.019/lib/32/libmkl.so, use it? [Y/n] n
Found /opt/intel/mkl/10.1.1.019/lib/64/libmkl.so, use it? [Y/n] y
显然服务器上装了不少数学库,我选了一个版本较高的64位的。
然后开始编译
make
不幸又出错了

make[1]: Entering directory `/home/qin/Dalton2011_release/DALTON/lucita'
make --no-print-directory dalton_mpi.o lucita_mcscf_ci_cfg.o lucita_cfg.o lucita_orbitalspaces.o par_sync_cw.o par_io.o par_communication_model.o par_io_fh.o
mpif90 -I../include  -J../modules -DVAR_GFORTRAN -DSYS_LINUX -DVAR_MFDS -D'INSTALL_WRKMEM=1048000000' -D'INSTALL_MMWORK=1' -D_FILE_OFFSET_BITS=64 -DVAR_MPI -DGFORTRAN=462 -DVAR_INT64 -DIMPLICIT_NONE -march=x86-64 -O3 -ffast-math -funroll-loops -ftree-vectorize -fbacktrace -fdefault-integer-8 -c dalton_mpi.F90
dalton_mpi.F90:16.9:

  use mpi
         1
Fatal Error: Parse error when checking module version for file 'mpi.mod' opened at (1)

查原因,可能是openmpi编译用的gcc和现在gcc版本不同造成的。
于是去下openmpi

openmpi的安装
http://www.open-mpi.org/下载openmpi-1.4.4.tar.bz2
tar -jxvf openmpi-1.4.4.tar.bz2
建立目标目录
mkdir ./local/openmpi-1.4.4
cd ./openmpi-1.4.4
配置
./configure --prefix=/home/qin/local/openmpi-1.4.4
开始编译
make
make install
写入环境变量
export MPI_ROOT=/home/qin/local/openmpi-1.4.4
export LD_LIBRARY_PATH=$MPI_ROOT/lib:$LD_LIBRARY_PATH
export PATH=$MPI_ROOT/bin:$PATH
source ~/.bashrc

重新安装Dalton2011
。。。。
又出错了:
mpif90 -I../include  -J../modules -DVAR_GFORTRAN -DSYS_LINUX -DVAR_MFDS -D'INSTALL_WRKMEM=1048000000' -D'INSTALL_MMWORK=1' -D_FILE_OFFSET_BITS=64 -DVAR_MPI -DGFORTRAN=462 -DVAR_INT64 -DIMPLICIT_NONE -march=x86-64 -O3 -ffast-math -funroll-loops -ftree-vectorize -fbacktrace -fdefault-integer-8 -c par_sync_cw.F90
par_sync_cw.F90:244.68:

      call dalton_mpi_bcast(set_sync_default_val, 0, mpi_comm_world)
                                                                    1
Error: There is no specific subroutine for the generic 'dalton_mpi_bcast' at (1)
par_sync_cw.F90:223.64:
.........
Error: There is no specific subroutine for the generic 'dalton_mpi_bcast' at (1)
par_sync_cw.F90:142.78:

   call dalton_mpi_bcast(lucita_cfg_max_batch_size,      0, mpi_comm_world)
                                                                           1   
Error: There is no specific subroutine for the generic 'dalton_mpi_bcast' at (1)
Fatal Error: Error count reached limit of 25.

这次又在Dalton邮件列表上找到了类似错误

Hi Nikolai,

this is indeed a bit puzzling. Your Makefile.config seems OK at first glance wrt the MPI settings.
You are using OpenMPI, right? If so, could you please send me the output of

ompi_info -a
?

Wrt your MKL problem i note that you compile with 64-bit integers, i.e. the -i8 flag for ifort.
In this case you have to use the 64-bit version of the MKL libs as well!
The following line should do it:
LIBS = -L/site/VERSIONS/intel-11.1/mkl/lib/em64t -Wl,--rpath=/site/VERSIONS/intel-11.1/mkl/lib/em64t -lmkl_lapack -lmkl_intel_ilp64 -lmkl_solver_ilp64 -lmkl_intel_thread -lmkl_core -lguide -lpthread

Your MPI problem could also be related to a 64-bit/32-bit issue. Note that OpenMPI has to be configured with 64-bit integers if you want to use it with
a 64-bit Dalton. You can check this in the
ompi_info -a output by grepping for the line 'Fort integer size', i.e.:

ompi_info -a | grep 'Fort integer size'

should yield

Fort integer size: 8

with best regards,

stefan


openmpi 64位安装
意思就是不能用32为的openmpi去编译64位的Dalton
运行这个命令
ompi_info -a | grep 'Fort integer size'
得到
Fort integer size: 4
说明我的openmpi是32位的
于是要重新编译openmpi
回到openmpi 安装哪一步
在配置的地方写上
./configure --prefix=/home/qin/local/openmpi-1.4.4 CXX=g++ CC=gcc F77=gfortran FC=gfortran FFLAGS="-m64 -fdefault-integer-8" FCFLAGS="-m64 -fdefault-integer-8" CFLAGS=-m64  CXXFLAGS=-m64
删掉之前的安装
rm -r ~/local/openmpi-1.4.4/*
make
make install
ompi_info -a | grep 'Fort integer size'
得到
Fort integer size: 8
说明64位openmpi编译成功(在此感谢大漠孤狼,天外来客热心帮助)

Dalton TEST
在回到前面Dalton的安装,这次make成功了。
开始测试
cd /home/qin/Dalton2011_release/DALTON/test
./TEST -keep -benchmark all > TEST_all.log 2>&1 &
回复此楼

» 猜你喜欢

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

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

lonewolf659

铜虫 (小有名气)


★★★★★ 五星级,优秀推荐

兄台好有责任心啊,感谢分享经验。
2楼2011-11-10 14:35:18
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xuhu_11

金虫 (职业作家)


★★★★★ 五星级,优秀推荐

没天理,版主也不给点打发!
3楼2012-02-25 19:14:44
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dumbgirl

金虫 (小有名气)


点错星了。对不起了楼主
5楼2012-03-10 16:21:35
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

迷茫的小飞侠

金虫 (正式写手)


★★★★★ 五星级,优秀推荐

学习
6楼2012-06-27 20:35:32
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

小范范1989

木虫 (著名写手)


★★★★★ 五星级,优秀推荐

学习,关注楼主。楼主也用dalton
7楼2014-10-11 09:07:10
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
简单回复
dumbgirl4楼
2012-03-10 16:20   回复  
一般  
相关版块跳转 我要订阅楼主 ggdh 的主题更新
☆ 无星级 ★ 一星级 ★★★ 三星级 ★★★★★ 五星级
普通表情 高级回复(可上传附件)
信息提示
请填处理意见