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)



dimanche 7 février 2010

linux 命令 du

du -sh dir
查看一个文件夹的大小

du -m --max-depth=1 dir | sort -rn | head/tail
sort 的参数 -nr 表示要以数字排序法进行反向排序,因为我们要对目录大小做排序,所以不可以使用 human-readable 的大小输出,不然目录大小中会有 K、M 等字样,会造成排序不正确。

samedi 6 février 2010

telephone

0-0811310310

kill 进程

使用
ps aux | grep 进程名称
查找进程PID

kill PID

jeudi 4 février 2010

emacs 常用命令整理

这儿列出的只是常用命令,详细的可以看这个中文Tutorial。

基本命令
C-x C-c : 退出Emacs

C-x C-f : 打开一个文件,如果文件不存在,则创建一个文件

C-g : 取消未完成的命令

编辑
C-z (redefined): Undo;原来C-z是挂起Emacs(然后用fg命令调出);C-x u 是默认的命令; 移动一下光标,再C-z就可以redo

M-d : 删除光标后的词语

移动光标
C-v : 向前翻页

M-v : 向后翻页

M-r : 将光标移动到屏幕中间那行

C-a : 移到行首

M-a : 移到句首,从行首到句首之间可能有空格

C-e : 移到行尾

M-e : 移到句尾

M-{ : 向上移动一段

M-} : 向下移动一段

C-right : 向前移动一个单词

C-left : 向后移动一个单词

C-up : 向前移动一段

C-down : 向后移动一段

M-< : 移到整个文本开头

M-> : 移到整个文本末尾

C-u 数字 命令 : 执行多次(数字表示次数)该命令;“M-数字 命令” 也可以

M-x goto-line : 移动到某一行

C-l : 重绘屏幕,效果就是当前编辑行移动窗口中央

Buffer 相关
C-x k : 关闭当前buffer

C-x b : 切换到前一个编辑的buffer

C-x C-b : 列出当前所有buffer

C-x C-s : 保存当前buffer

C-x s : 保存所有未保存的buffer,会提示你是否需要保存

C-x C-w : 文件另存为

拷贝与粘贴
M-space (redefined): 设置mark; C-@ 是默认命令

C-w (redefined) : 剪切一块区域;如果没有设置mark,则是剪切一行

M-w (redefined) : 拷贝一块区域;如果没有设置mark, 则是拷贝一行

C-k : 从当前位置剪切到行尾

C-y : 粘贴

M-y : 用C-y拉回最近被除去的文本后,换成 M-y可以拉回以前被除去的文本。键入多次的M-y可以拉回更早以前被除去的文本。

C-x r k : 执行矩形区域的剪切

C-x r y : 执行矩形区域的粘贴

窗口操作
C-x 0 : 关闭当前窗口

C-x 1 : 将当前窗口最大化

C-x 2 : 垂直分割窗口

C-x 3 : 水平分割窗口

M-o (redefined) : 在窗口之间切换; C-x o 是默认命令

C-x 5 1/2/3/0 : 对frame类似的操作

C-x < : 窗口内容右卷

C-x > : 窗口内容左卷(这两个命令在垂直分割窗口后比较有用)

(C-u) C-x ^ : 加高当前窗口,如果有C-u,则每次加高4行

(C-u) C-x } : 加宽当前窗口

(C-u) C-x { : 压窄当前窗口

ESC C-v : 在其它窗口进行卷屏操作

搜索和替换
C-s : 向前搜索(增量式搜索);连续C-s,跳到下一个搜索到的目标

C-s RET : 普通搜索

C-r : 向前搜索

C-s RET C-w : 按单词查询

M-% : 查询替换,也就是替换前会询问一下

M-x replace-string : 普通替换

Tags
M-! etags .c .h : 创建TAGS文件

M-. : 跳到tag所在位置

M-x list-tags : 列出tags

Bookmark
C-x r m : 设置书签bookmark

C-x r b : 跳到bookmark处

帮助
C-h ? : 查看帮助信息

C-h f : 查看一个函数

C-h v : 查看一个变量

C-h k : 查看一个键绑定 (C-h c 也是查看键绑定,但是信息较简略)

C-h C-f : 查看一个函数的Info,非常有用

C-h i : 看Info

其它
C-M-\ : 对选中区域,按照某种格式(比如C程序)进行格式化

C-x h : 全部选中

M-! : 执行外部shell命令

M-x shell : 模拟shell的buffer

M-x term : 模拟terminal, C-c k 关闭terminal

C-x C-q : 修改buffer的只读属性

emacs 替换

Emacs 的很多命令都是针对区域(region)的,查找替换的命令基本都是针 对当前光标开始到缓冲区的结束进行操作。如果当前有区域被选择,那么优 先对选择的区域操作。

简单查找

C-s 向后查找
C-r 向前查找
使用简单的增量查找,再次使用 C-s 或 C-r 时候是向后或向前查找下一个

简单替换

replace-rectangle

针对区域(region)的每行开始插入一串字符,精确的讲应该是矩形区域左边 的最短部分以前的字符都被替换。

replace-string

全局替换 replace-string ,如果没有选择的区域,同样针对当前光标到缓冲 区结束的区域操作。这个函数仅仅执行简单的字符串匹配,不能使用正则。

query-replace

通常绑定在 M-% (% 用 shift+5 输入)

其操作步骤如下:

M-% (然后会出现Query replace的字样)
Query replace:<被替换字符串>
Query replace <被替换字符串> with:<替换字符串>
Query replacing <被替换字符串> with <替换字符串>:(? for help)
查询替换命令的选项如下:

y 或者 空格 键 替换搜索到的字符串
n 或者 Del 键 取消替换搜索到的字符串
^ 回到前一个搜索到的字符串
! 替换所有没有替换的与模式匹配的字符串
ESC 键 退出本次查询搜索

功能更强的查找替换

preplace-regexp

正则查找替换,可以使用正则表达式。

query-replace-regexp

lundi 1 février 2010

安装ubunt

------------------------------
1, 选择手动分区
2, 先删除最后一个分区,
3,添加/boot,格式为ext3,大小为1000M,
4,添加/swap,大小为4000M
5,添加/,格式为ext3,大小为剩下的所有空间
------------------------------
System/Administration/Synaptic Package Manager, Settings/Repositories/
change:Download from: Main server
------------------------------
安装scim, scim-tables-additional, scim-tables-zh, scim-m17n,scim-pinyin
------------------------------
System/Administration/Language Support,
Keyboard input method system: scim
添加中文和法文