mardi 9 février 2010

install ifort

下载inter fortran compiler安装原文件:
安装原文件:
sudo install.sh

将安装路径添加到.bashrc中的PATH中

可能需要的包:
g++ntel Fortran Compiler Options



---------------------------------------------------------------------------------------------
SYNOPSIS

ifort [ options ] file1 [ file2 ]...

options
Are zero or more compiler options.

fileN Is a Fortran source file, assembly file, object file, object
library, or other linkable file.


Some important Intel Fortran Compiler Options are given below. The command to invoke the Intel Fortran compiler is ifort. For a full list of options enter man ifort.

The ifort command interprets input files by their filename suffix as follows:
Filenames with the suffix .f90 are interpreted as free-form Fortran 95/90 source files.
Filenames with the suffix .f, .for, or .ftn are interpreted as fixed-form Fortran source files.
-free
Specifies source files are in free format. By default, source file format is determined by the file suffix.
-fixed
Specifies source files are in fixed format. By default, source file format is determined by the file suffix.
-c
Prevents linking. It causes the compiler to compile to an object (.o) file only.
-C
Enables all checks on run-time conditions
-i2
Makes default integer and logical variables 2 bytes long (same as the -integer-size 16 option). The default is -integer-size 32.
-i4
Makes default integer and logical variables 4 bytes long (same as the -integer-size 32 option). This is the default.
-i8
Makes default integer and logical variables 8 bytes long (same as the -integer-size 64 option). The default is -integer-size 32.
-implicitnone
Sets the default type of a variable to undefined (IMPLICIT NONE). This is the same as specifying the -u option.
-O0
Disables all -O optimizations.
-O1
Enables optimizations for speed.
-O2 or -O
This option is the default for optimizations. However, if -g is specified, the default is -O0. The -O2 option enables optimizations for speed, including global code scheduling, software pipelining, predication, and speculation. It also enables:
Inlining of intrinsics
Intra-file interprocedural optimizations, which include: inlining, constant propagation, forward substitution, routine attribute propagation, variable address-taken analysis, dead static function elimination, and removal of unreferenced variables.
The following capabilities for performance gain: constant propagation, copy propagation, dead-code elimination, global register allocation, global instruction scheduling and control speculation, loop unrolling, optimized code selection, partial redundancy elimination, strength reduction/induction variable simplification, variable renaming, exception handling optimizations, tail recursions, peephole optimizations, structure assignment lowering and optimizations, and dead store elimination.
-O3
Enables -O2 optimizations plus more aggressive optimizations, such as prefetching, scalar replacement, and loop transformations. Enables optimizations for maximum speed, but does not guarantee higher performance unless loop and memory access transformations take place.
-openmp
Enables the parallelizer to generate multithreaded code based on OpenMP* directives. The code can be executed in parallel on both uniprocessor and multiprocessor systems. The -openmp option works with both -O0 (no optimization) and any optimization level of -O. Specifying -O0 with -openmp helps to debug OpenMP applications.
-openmp-stubs
Enables compilation of OpenMP programs in sequential mode. The OpenMP directives are ignored and a stub OpenMP library is linked.
-p
Compiles and links for function profiling with gprof.
-parallel
Tells the auto-parallelizer to generate multithreaded code for loops that can be safely executed in parallel. To use this option, you must also specify -O2 or -O3.
-r8
Makes default real and complex variables 8 bytes long. REAL declarations are treated as DOUBLE PRECISION (REAL(KIND=8)) and COMPLEX declarations are treated as DOUBLE COMPLEX (COMPLEX(KIND=8)). This option is the same as specifying -real-size 64 or -autodouble.
-r16
Makes default real and complex variables 16 bytes long. REAL declarations are treated as extended precision REAL (REAL(KIND=16); COMPLEX and DOUBLE COMPLEX declarations are treated as extended precision COMPLEX (COMPLEX(KIND=16)). This option is the same as specifying -real-size 128.
-save
Places variables, except those declared as AUTOMATIC, in static memory (same as -noauto or -noautomatic). The default is -autoscalar. However, if you specify -recursive or -openmp, the default is -automatic.
-stand
Causes the compiler to issue compile-time messages for nonstandard language elements.
--------------------------------------------------
Intel Fortran Compiler这个编译器性能极佳,它在 x86 和 Itanium 级 Linux 主机上会有光明的未来,因为 Intel 的编译器组整合了曾在 DEC、Compaq 和 HP 确立声誉的工程团队。它的发行版有Windows和Linux两种,这2种都分别提供Non-Commercial版免费下载,但不提供技术支持。而性能则与商业版相同。其中Windows版需要Visual Studio的支持才可以使用。

以下是整个的安装过程。

1、登陆intel网站下载Non-commercial版。
登陆 http://www.intel.com/software/products/global/eval.htm ,选择 Intel? Fortran Compiler for Linux* 下的第二项Non-Commercial Unsupported Version 点击进入。或者直接登陆http://www.intel.com/software/products/compilers/flin/noncom.htm,简单的看一下说明,整个下载过程需要好几步,可以慢慢来进行,首先点击“Continue”按钮进入下一页;第二页有个调查表,填好之后进入下一页;第二页有个调查表,填好之后进入下一页;第三页是软件协议页面,可以粗略看一下,选择“Accept”进入下一页;第四页是注册页面,其中Email栏一定要填好,填写之后选择“Submit”进入下一页;这是最后一页,说明已经注册成功,intel会给你发一封电子邮件,并且其中包含一个协议附件。
剩下的工作是收取邮件,然后根据邮件中提供的地址下载软件即可。我这里下载的软件是l_fc_p_8.0.034.tar.gz,大约84M,另外把邮件中的附件另存在刚才下载的软件的同一目录下,我这里的文件名是l_for_70909049.lic,每个人的文件名可能不同,它是一个协议文件。
下来以root用户进行以下的安装工作,假设前面的2个文件存放在/usr/src/intel目录下,这也是我们的工作目录:

2、解压安装文件
tar xzvf l_fc_p_8.0.034.tar.gz

3、安装并指定协议,我们这里编译器的是安装在/opt/intel_fc_80目录下,协议则在该目录下的*s 文件夹中。最后还要指定*s的位置。
mkdir ?p /opt/intel_fc_80/*s
cp /usr/src/intel/*.lic /opt/intel_fc_80/*s
export INTEL_LICENSE_FILE=opt/intel_fc_80/*s

4、装程序进行安装
cd /usr/src/intel/l_fc_p_8.0.034
./install.sh
正确的话,会看到下面的提示:
The following Intel(R) products and related products are
installed.

Intel(R) Fortran Compiler for 32-bit applications, Version 8.0
Linux Application Debugger for 32-bit applications, Version 7.3.1

Which of the following would you like to install?
1. Intel(R) Fortran Compiler for 32-bit applications, Version 8.0
2. Linux Application Debugger for 32-bit applications, Version 7.3.1
x. Exit
先选择 1 安装Intel Fortran Compiler ,默认安装即可,默认目录就是/opt/intel_fc_80。
安装编译器完成之后,继续可以安装Linux Application Debugger for 32-bit applications, Version 7.3.1,选择 2即可,它默认安装在/opt/intel_idb_73下。
最后选择x 退出安装程序。

5、现在安装完成,可以删掉安装文件l
cd /usr/src
rm ?rf intel

6、退出root用户的登陆,然后以一个个人用户登陆,登陆以后修改用户根目录下的.bash_profile文件,在最后一行加入这么一行:
. /opt/intel_fc_80/bin/ifortvars.sh
注:其中点号之后有空格。
然后重新登陆或者:
source .bash_profile
这样一切安装与配置就完成了,可以简单的测试一下。编辑一个简单的源文件first.f90。
program first
print *, “Hello World!
print *, sin(123.4)
end program first
下来编译,编译命令与以前版本的Intel Fortran Compiler不同,以前采用的是ifc命令,从这个版本开始将使用ifort命令
ifort first.f90 ?o first
运行
./first
将显示
Hello World!
-0.7693915
这说明一切OK,可以正常使用该编译器了。
ifort的具体使用可以用 ifort ?help 获得详细帮助,一般用法类似于g77和gcc。在/opt/intel_fc_80/doc下有详细的使用文档,有pdf格式文档也有htm格式网页文档ibstdc++5 (http://packages.debian.org/stable/base/libstdc++5)



Aucun commentaire:

Enregistrer un commentaire