SUSE Linux 10(kernel-2.6)平台下搭建Fortran并行环境

红薯 发布于 2010/04/11 10:19
阅读 1K+
收藏 0

一.Fortran编译器的安装

Linux安装盘一般都自带有Fortran编译器,在SUSE9.1 以前均带有g77,在Suse9.2以后为gfortran.但是, 相对来说,由于g77和gfortran的编译的程序运行效率不是很高,所以都会选择再安装专业的Fortran编译器.

主流的Fortran 90/95编译器有PGI Fortran、HP Fortran Compiler(由Fortran PowerStation进化过来的)和Intel Fortran Compiler等.因为Intel Fortran Compiler9.1是Intel提供的免费的Non-Commercial版本,且在Intel平台上,具有较高的编译效率.它的发行版有 Windows和Linux两种.在此,主要介绍在SLES10.0 上安装 Intel Fortran Compiler 9.1 的过程.

1.下载安装包
本次安装包从ftp上下载,ifcliv91.bin,为光盘文件,可以直接拷贝到目录/home/hou/software/intel_fc_91下.
2.解压安装文件,命令如下:
编译器是安装在/opt /intel目录下,协议则在该目录下的licenses文件夹中.最后还要指定licenses的位置.具体命令如下:
#mkdir -p /opt/intel/licenses
#cp /home/hou/isoftware/intel_fc_91/Crack/i*.lic /opt/intel/licenses
# export INTEL_LICENSE_FILE=opt/intel/licenses
3. 安装程序,命令如下:
#cd /home/hou/isoftware/intel_fc_91
#./install.sh
按照安装提示,逐步安装即可.一般情况下,可以顺利安装完毕,在此安装包中一共包含有以下编译器,可以全部安装,也可以选择安装其中之一.
IntelR Fortran Compiler for IA-32 Based Applications
? IntelR Fortran Compiler for Linux for IA-32 applications, version 9.1
? IntelR Debugger for IA-32 applications, version 9.1
IntelR Fortran Compiler for Intel EM64T-Based Applications
? IntelR Fortran Compiler for Linux for Intel EM64T-Based applications, version 9.1
? IntelR Debugger for Intel EM64T-based applications, version 9.1
IntelR Fortran Compiler for Itanium-Based Applications
? IntelR Fortran compiler for Itanium-based applications, version 9.1
? IntelR Debugger for Itanium-based applications, version 9.1
? IntelR Itanium Assembler to produce Itanium-based applications, version 9.0
安装Intel Fortran Compiler for Intel EM64T-Base,默认目录就是/opt/intel/fce/9.1.032/.安装编译器完成之后,继续可以安装Linux Application Debugger for Intel EM64T-base applications,它默认安装在/opt/intel/idbe/9.1.023/下.最后选择"x"退出安装程序.
4.安装完成,将编译器路径加入到环境变量中.命令如下:
server:~ # vi .bash_profile
export PATH=$PATH:/opt/intel/fce/9.1.032/bin
export MANPATH=$MANPATH:/opt/intel/fce/9.1.032/man
server:~ # source .bash_profile
在运行编译以后运行中,会出现找不到链接库文件的问题,这是由于没有将Intel编译器的库文件添加到链接库搜索中, 编辑/etc/ ld.so.conf,添加intel库文件的路径.具体如下:
server:~ # vi /etc/ld.so.conf
/usr/X11R6/lib64
/usr/X11R6/lib/Xaw3d
/usr/X11R6/lib
/usr/local/lib
/opt/kde3/lib
/opt/gnome/lib
/lib64
/lib
/usr/lib64
/usr/lib
/usr/local/lib64
/opt/kde3/lib64
/opt/gnome/lib64
/opt/intel/fce/9.1.032/lib
include /etc/ld.so.conf.d/*.conf
然后运行命令生效.
server:/etc # ldconfig -v
安装完毕,可以编写小程序进行测试.

2. PICH的安装

1.下载并安装 mpich包(用hou用户)
下载mpi的linux安装包:mpich-1.2.7p1.tar.放到/home /hou/software 目录下.解压文件: tar xvf mpich-1.2.7p1.tar.然后在/home/hou目录下创建安装目录.
server /etc> cd /home/hou
server /home/hou> mkdir mpich
回到解压缩得到的目录,设定环境变量,指定用ifort编译器进行安装.命令:
server /home/hou> cd /home/hou/software/mpich-1.2.7p1/
server software/mpich-1.2.7p1> setenv FC ifort
server software/mpich-1.2.7p1> setenv F90 ifort
server software/mpich-1.2.7p1> ./configure -with-flibname=mpich-ifort -prefix=/home/hou/mpich
其中/home/hou/mpich为所指定安装的目录.然后make对MPI进行编译.
server software/mpich-1.2.7p1>make
测试安装是否正确,到example/basic目录下进行测试.
server software/mpich-1.2.7p1>cd example/basic
server software/mpich-1.2.7p1>make cpi
server software/mpich-1.2.7p1>../../bin/mpirun -np 4 cpi
至此,MPI还没有开始正式的安装,只是预安装.若运行成功,即可进行最后的安装.最后,将mpich安装到指定的目录
server software/mpich-1.2.7p1>make install

2.安装后文件配置
在所有的机器的/etc/hosts.equiv文件内添加启动MPI程序的机器名.如:
# hosts.equiv This file describes the names of the hosts which are
# to be considered "equivalent", i.e. which are to be
# trusted enough for allowing rsh(1) commands.
# hostname
server
bingxing70
bingxing71
bingxing72
bingxing73
bingxing74
bingxing75
或者在帐户目录下创建 .rhosts文件:
在hou目录下创建脚本文件 .cshrc添加环境变量,并生效.
server /home/hou> vi .cshrc
setenv MANPATH ${MANPATH}:/opt/intel/fce/9.1.032/man
setenv PATH ${PATH}:/home/hou/mpich/bin
setenv MANPATH ${MANPATH}:/home/hou/mpich/mansource .cshrc
server /home/hou> source .cshrc
最后还要到无盘机器上创建脚本文件 .cshrc
至此,SLES建立了MPI消息传递形式的,Intel Fortran编译器下的并行Fortran编译和运行环境.

加载中
返回顶部
顶部