SUSE Linux 10(kernel-2.6.16.21-0.8)平台下搭建Fortran并行编译环境

一.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/licenses3.安装程序,命令如下: #cd /home/hou/isoftware/intel_fc_91#./install.sh按照安装提示,逐步安装即可。一般情况下,可以顺利安装完毕,在此安装包中一共包含有以下编译器,可以全部安装,也可以选择安装其中之一。Intel Fortran Compiler for IA-32 Based Applications ? Intel Fortran Compiler for Linux for IA-32 applications, version 9.1 ? Intel Debugger for IA-32 applications, version 9.1 Intel Fortran Compiler for Intel EM64T-Based Applications? Intel Fortran Compiler for Linux for Intel EM64T-Based applications, version 9.1 ? Intel Debugger for Intel EM64T-based applications, version 9.1 Intel Fortran Compiler for Itanium-Based Applications ? Intel Fortran compiler for Itanium-based applications, version 9.1 ? Intel Debugger for Itanium-based applications, version 9.1 ? Intel 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_profileexport PATH=$PATH:/opt/intel/fce/9.1.032/binexport MANPATH=$MANPATH:/opt/intel/fce/9.1.032/manserver:~ # 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/x86_64-suse-linux/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/libinclude /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/houserver /home/hou> mkdir mpich回到解压缩得到的目录,设定环境变量,指定用ifort编译器进行安装。命令:server /home/hou> cd /home/hou/software/mpich-1.2.7p1/server software/mpich-1.2.7p1> setenv FC ifortserver software/mpich-1.2.7p1> setenv F90 ifortserver 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/basicserver software/mpich-1.2.7p1>make cpiserver software/mpich-1.2.7p1>../../bin/mpirun -np 4 cpi至此,MPI还没有开始正式的安装,只是预安装。若运行成功,即可进行最后的安装。最后,将mpich安装到指定的目录server software/mpich-1.2.7p1>make install2.安装后文件配置在所有的机器的/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.## hostnameserverbingxing70bingxing71bingxing72bingxing73bingxing74bingxing75… …或者在帐户目录下创建 .rhosts文件:在hou目录下创建脚本文件 .cshrc添加环境变量,并生效。server /home/hou> vi .cshrcsetenv MANPATH ${MANPATH}:/opt/intel/fce/9.1.032/mansetenv PATH ${PATH}:/home/hou/mpich/binsetenv MANPATH ${MANPATH}:/home/hou/mpich/mansource .cshrcserver /home/hou> source .cshrc最后还要到无盘机器上创建脚本文件 .cshrc至此,SLES建立了MPI消息传递形式的,Intel Fortran编译器下的并行Fortran编译和运行环境。

如果困难是堵砖墙,拍拍它说你还不够高。

SUSE Linux 10(kernel-2.6.16.21-0.8)平台下搭建Fortran并行编译环境

相关文章:

你感兴趣的文章:

标签云: