<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>joolix.com &#187; essay</title>
	<atom:link href="http://joolix.com/tag/essay/feed/" rel="self" type="application/rss+xml" />
	<link>http://joolix.com</link>
	<description>Joolix, linux everywhere!</description>
	<lastBuildDate>Thu, 22 Jul 2010 03:33:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>铁木真论汲福威 [ bones7456 所遭宫文文译 ]</title>
		<link>http://joolix.com/2010/07/dick-cut-essay-of-bones7456/</link>
		<comments>http://joolix.com/2010/07/dick-cut-essay-of-bones7456/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 03:32:57 +0000</pubDate>
		<dc:creator>xiooli</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[essay]]></category>

		<guid isPermaLink="false">http://joolix.com/?p=417</guid>
		<description><![CDATA[bones7456 童鞋的一篇被宫文字，我将其翻译成文言了，希望 spy 们看不懂。大家随意转载
今幸能得见铁氏，与面谈，且洽且欢。当是时，吾就一朝庭G点所涉问题征之，铁氏不讳，与吾相谈甚详。事过少久，未曾详录，今但略述其意：
予问曰：君为淘宝首脑，所司皆关万维网，吾朝G点屡触者可料也，关乎此，君有何见？
铁氏略思，而白予言：尔所言者，无乃汲福威乎？
<span class="readmore"><a href="http://joolix.com/2010/07/dick-cut-essay-of-bones7456/" title="铁木真论汲福威 [ bones7456 所遭宫文文译 ]" target="_blank">阅读全文——共507字</a></span>]]></description>
			<content:encoded><![CDATA[<p>bones7456 童鞋的一篇被宫文字，我将其翻译成文言了，希望 spy 们看不懂。大家随意转载</p>
<blockquote><p>今幸能得见铁氏，与面谈，且洽且欢。当是时，吾就一朝庭G点所涉问题征之，铁氏不讳，与吾相谈甚详。事过少久，未曾详录，今但略述其意：<br />
予问曰：君为淘宝首脑，所司皆关万维网，吾朝G点屡触者可料也，关乎此，君有何见？<br />
铁氏略思，而白予言：尔所言者，无乃汲福威乎？<br />
吾然之。<br />
铁氏白言：夫人相沟通，理当自由，此无疑也。是故，朝廷之所行周厉事，非惟下劣，抑亦差强。思吾国屁民皆具小强之资，行区区张生之事可有难乎？然则，亦当思朝廷之不易也，内舆煽风者常有之，庙堂不思引导愚民，反相强制，犯言坑焚，斯非智也。近多闻民曝贪腐，下马者众，可见上恤草民，境况益良。故而不可但见其暗。世益明矣，吾预汲福威将日羸且亡。<br />
吾又问曰：君将供役者暴汲氏械乎？（吾闻深圳某公司私供其役者VPN，甚羡之）<br />
铁氏言：否也，须与朝廷相协处众，不可轻逆之，惧损根本也。<br />
予思铁氏言，知其对汲福威事感同役者，期汲亡心亦同吾曹。惟然，朝廷所为予甚鄙之，然则对困境时亦当隐忍也。</p>
<p>注：<br />
铁木真，即“陆兆禧”是也，前支付宝首脑，2008年3月始统领淘宝网<br />
予，bones7456，花名“刘顺”。</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://joolix.com/2010/07/dick-cut-essay-of-bones7456/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>[幽默]夏季驱蚊脚本</title>
		<link>http://joolix.com/2010/06/mosquito-repellent-script/</link>
		<comments>http://joolix.com/2010/06/mosquito-repellent-script/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 01:28:45 +0000</pubDate>
		<dc:creator>xiooli</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[essay]]></category>

		<guid isPermaLink="false">http://joolix.com/?p=415</guid>
		<description><![CDATA[RT
夏天来了，蚊虫出没，甚是烦扰，为避免被咬得满身是包，xiooli 决定写一个驱蚊脚本，呃呃。
本脚本采用蚊虫的天敌产生的声音驱赶蚊虫，非电磁波，对人畜无不良影响，请放心使用。
ps：建议推荐世界杯赛场采用。
<span class="readmore"><a href="http://joolix.com/2010/06/mosquito-repellent-script/" title="[幽默]夏季驱蚊脚本" target="_blank">阅读全文——共222字</a></span>]]></description>
			<content:encoded><![CDATA[<p>RT<br />
夏天来了，蚊虫出没，甚是烦扰，为避免被咬得满身是包，xiooli 决定写一个驱蚊脚本，呃呃。</p>
<p>本脚本采用蚊虫的天敌产生的声音驱赶蚊虫，非电磁波，对人畜无不良影响，请放心使用。</p>
<p>ps：建议推荐世界杯赛场采用。</p>
<p>放出源代码：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">myspace</span>=<span style="color: #000000; font-weight: bold;">*</span>
<span style="color: #000000; font-weight: bold;">while</span> :; <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;`find $myspace -type insects -name mosquito`&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        batman <span style="color: #660033;">--voice</span> <span style="color: #ff0000;">&quot;呔，孽畜哪里走！&quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://joolix.com/2010/06/mosquito-repellent-script/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MCSE问道于傅师（Master Foo）文译</title>
		<link>http://joolix.com/2010/06/mcse_asks_master_foo/</link>
		<comments>http://joolix.com/2010/06/mcse_asks_master_foo/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 14:49:01 +0000</pubDate>
		<dc:creator>xiooli</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[essay]]></category>

		<guid isPermaLink="false">http://joolix.com/?p=411</guid>
		<description><![CDATA[RT
在这里看到一篇译文，感觉文章很有意思，于是自不量力参考该译文又重新翻译了一下。望大家砖头轻扔^^
一时，有擅瘟到死管理者诣傅师所，问道于师言：“闻师深精油里刻石(UNIX)之道，今以珍密相通，互受法益，师以可乎？”
师答曰：“善哉，尔今能作此觅智之举，然则实无珍密存乎油里刻石之道也。”
<span class="readmore"><a href="http://joolix.com/2010/06/mcse_asks_master_foo/" title="MCSE问道于傅师（Master Foo）文译" target="_blank">阅读全文——共1439字</a></span>]]></description>
			<content:encoded><![CDATA[<p>RT<br />
在<a href="http://apt-blog.net/master-foo-and-the-mcse">这里</a>看到一篇译文，感觉文章很有意思，于是自不量力参考该译文又重新翻译了一下。望大家砖头轻扔^^</p>
<blockquote><p>一时，有擅瘟到死管理者诣傅师所，问道于师言：“闻师深精油里刻石(UNIX)之道，今以珍密相通，互受法益，师以可乎？”<br />
师答曰：“善哉，尔今能作此觅智之举，然则实无珍密存乎油里刻石之道也。”<br />
问道者大惑，而白师言：“然人皆曰师乃大贤于油里刻石之道者，能知过去现在一切最深奥密。师之于油里刻石，尤吾之于瘟到死(Windows)也。吾乃MCSE，且乎学贯世所鲜知之秘术，善能记忆诡秘之注册表项，更能详知任意之瘟到死API，乃至微软几忘者亦如是。是何密径吾师得缘以证如斯境界，弟子深欲知之！”<br />
师答曰：“吾实无法可得。无一法可得者即是吾法，吾于大道实无所得！”<br />
问者意甚嗔，谓师曰：“师自珍耳，若无秘法，何径师由而至此乎？”<br />
师谓之曰：“人之误珍秘法，尤希光明者，珍其烛火，以手笼之，终被所灼。<span style="color: #ff0000;">以是知之，无一秘法而吾自珍也。</span>”<br />
问者闻之，豁然有悟。</p></blockquote>
<p>ps：红色的是我自己的理解，不知道对不对，大家给点意见，呵呵</p>
<p>原文：</p>
<blockquote><p>Master Foo and the MCSE<br />
Once, a famous Windows system administrator came to Master Foo and asked him for instruction: “I have heard that you are a powerful Unix wizard. Let us trade secrets, that we may both gain thereby.”<br />
Master Foo said: “It is good that you seek wisdom. But in the Way of Unix, there are no secrets.”<br />
The administrator looked puzzled at this. “But it is said that you are a great Unix guru who knows all the innermost mysteries. As do I in Windows; I am an MCSE, and I have many other certifications of knowledge not common in the world. I know even the most obscure registry entries by heart. I can tell you everything about the Windows API, yes, even secrets those of Redmond have half-forgotten. What is the arcane lore that gives you your power?”<br />
Master Foo said: “I have none. Nothing is hidden, nothing is revealed.”<br />
Growing angry, the administrator said “Very well, if you hold no secrets, then tell me: what do I have to know to become as powerful in the Unix way as you?”<br />
Master Foo said: “A man who mistakes secrets for knowledge is like a man who, seeking light, hugs a candle so closely that he smothers it and burns his hand.”<br />
Upon hearing this, the administrator was enlightened.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://joolix.com/2010/06/mcse_asks_master_foo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Boot logo for samsung spica i5700</title>
		<link>http://joolix.com/2010/06/boot-logo-for-samsung-spica-i5700/</link>
		<comments>http://joolix.com/2010/06/boot-logo-for-samsung-spica-i5700/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 11:09:25 +0000</pubDate>
		<dc:creator>xiooli</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[essay]]></category>

		<guid isPermaLink="false">http://joolix.com/?p=396</guid>
		<description><![CDATA[RT
最近买了个三星的安卓手机，这几天都在折腾，呵呵。
鉴于折腾主义初级阶段的必经步骤，更换开机画面，这个是可以有滴，趁着 inkscape 还未生疏之际，鼓捣出了一个 boot logo，如下，板砖请省着点用，呵呵：

<span class="readmore"><a href="http://joolix.com/2010/06/boot-logo-for-samsung-spica-i5700/" title="Boot logo for samsung spica i5700" target="_blank">阅读全文——共307字</a></span>]]></description>
			<content:encoded><![CDATA[<p>RT<br />
最近买了个三星的安卓手机，这几天都在折腾，呵呵。<br />
鉴于折腾主义初级阶段的必经步骤，更换开机画面，这个是可以有滴，趁着 inkscape 还未生疏之际，鼓捣出了一个 boot logo，如下，板砖请省着点用，呵呵：</p>
<p><img src="http://farm2.static.flickr.com/1265/4659062305_7affb022d0.jpg" width="320" height="480" alt="mylogo" /></p>
<p>怎么刷到机器里面去（samsung spica i5700 适用）：<br />
必要条件，有 root 权限，且有 /xbin/bml_flash（刷了 LK2-02-1_update.zip 这个的就有了）。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash bash" style="font-family:monospace;">adb push .<span style="color: #000000; font-weight: bold;">/</span>mylogo.png logo.png
adb shell</pre></td></tr></table></div>

<p>然后在 adb 的 shell 里面执行</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>xbin<span style="color: #000000; font-weight: bold;">/</span>bml_flash boot3 logo.png
<span style="color: #666666; font-style: italic;"># 重启看效果</span>
reboot</pre></td></tr></table></div>

<p>搞定，启动画面是不是变了呢？</p>
<p>赫赫，折腾万岁！</p>
]]></content:encoded>
			<wfw:commentRss>http://joolix.com/2010/06/boot-logo-for-samsung-spica-i5700/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>施氏暴汲福威记</title>
		<link>http://joolix.com/2010/04/ssh-phucks-g-f-w/</link>
		<comments>http://joolix.com/2010/04/ssh-phucks-g-f-w/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 11:33:31 +0000</pubDate>
		<dc:creator>xiooli</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[essay]]></category>

		<guid isPermaLink="false">http://joolix.com/?p=370</guid>
		<description><![CDATA[或曰我朝网络，实属开放，然为童稚计，上诏不河蟹者悉当屏蔽，言斯事体大，关乎江山社稷，不可不察也。宰曰，逮今千古未见之奇变，行不可泥古，而法可效周厉也，上然之，征才于宰，宰曰：有汲福威（G.F.W）者，其先祖汲黯，有宠于汉武，福威行事苛辣，颇有其先祖遗风，当堪此任。上即招福威入见，视之，其人肤黝如漆，面圆耳大，腮布貉须，目若牛铃，口似血盆，身长八尺，腰阔十围，穷凶极恶，上喜之，即擢为河蟹中郎将，着即处理海内一干有碍河蟹之事。
及退朝，福威密征于宰，询以不河蟹之准绳，曰：无他，但唯上意也。福威诺诺而退。及二日，忽闻数数网站 loli 被一一推倒，梯子、板凳哗啦啦掀翻。宅人乍逢其变，隳突呼号，如失耳目，久乃得定，聚而议曰：今上逆民而行，任用恶吏，推我 loli，掀我梯子，欲使我曹蔽目塞兑，驯如羊豕，餍于井天，溯古而视，唯周厉可堪，周天之下，宁有甚于此者乎？！ 柿可忍黍不可忍，但有愤而暴之菊是为唯一出路。或曰：怎奈我等之力仅可掀 loli，欲胜汲竖则妄矣。且为之奈何？众皆蹙目，忽有信某哥者语于众曰：公等无忧也，吾尝识一人，武艺精深，穿墙百面如入无人之境，其好不多，尤喜菊花，公等可延是人，谓有菊花待之，料当欣来，立暴汲竖无疑也！予乃再拜，问其名姓，曰：此人名唤施氏（即 ssh 也），有通天彻底之能，擅能凿洞，当胜此任，然其人作此事时须有外应之所，以做上下挪移之用，可去此处购置，其价颇公
<span class="readmore"><a href="http://joolix.com/2010/04/ssh-phucks-g-f-w/" title="施氏暴汲福威记" target="_blank">阅读全文——共1432字</a></span>]]></description>
			<content:encoded><![CDATA[<p>或曰我朝网络，实属开放，然为童稚计，上诏不河蟹者悉当屏蔽，言斯事体大，关乎江山社稷，不可不察也。宰曰，逮今千古未见之奇变，行不可泥古，而法可效周厉也，上然之，征才于宰，宰曰：有汲福威（G.F.W）者，其先祖汲黯，有宠于汉武，福威行事苛辣，颇有其先祖遗风，当堪此任。上即招福威入见，视之，其人肤黝如漆，面圆耳大，腮布貉须，目若牛铃，口似血盆，身长八尺，腰阔十围，穷凶极恶，上喜之，即擢为河蟹中郎将，着即处理海内一干有碍河蟹之事。<br />
及退朝，福威密征于宰，询以不河蟹之准绳，曰：无他，但唯上意也。福威诺诺而退。及二日，忽闻数数网站 loli 被一一推倒，梯子、板凳哗啦啦掀翻。宅人乍逢其变，隳突呼号，如失耳目，久乃得定，聚而议曰：今上逆民而行，任用恶吏，推我 loli，掀我梯子，欲使我曹蔽目塞兑，驯如羊豕，餍于井天，溯古而视，唯周厉可堪，周天之下，宁有甚于此者乎？！ 柿可忍黍不可忍，但有愤而暴之菊是为唯一出路。或曰：怎奈我等之力仅可掀 loli，欲胜汲竖则妄矣。且为之奈何？众皆蹙目，忽有信某哥者语于众曰：公等无忧也，吾尝识一人，武艺精深，穿墙百面如入无人之境，其好不多，尤喜菊花，公等可延是人，谓有菊花待之，料当欣来，立暴汲竖无疑也！予乃再拜，问其名姓，曰：此人名唤施氏（即 ssh 也），有通天彻底之能，擅能凿洞，当胜此任，然其人作此事时须有外应之所，以做上下挪移之用，可去此处购置，其价颇公<br />
（<a href="http://sshchina.com/">http://sshchina.com/</a> 此我账户: xioolieissh，若你买的话将我做推荐人，我将不胜感激^^ ）<br />
予乃辞谢信某哥者，延施氏归<br />
（arch 下 sudo pacman -S openssh）<br />
又至 sshchina.com 所，购外应一，即付施氏<br />
（ ssh -D 6666 -l xioolieissh soft.sshchina.com 挖一个隧道，从 sshchina.com 连到你的 6666 端口，登录后就可以用 localhost:6666 做代理鸟）<br />
施氏视之良久，曰：甚善，君其远遁，吾将掘矣，今夜必暴之，待吾成也，君便可幽会佳人于墙外，若 loli，若御姐，悉随尊意。予久未睹佳人玉面，思之垂涎，乃搓手以待施氏，俄而，有声如豕自施氏身下出，断而且续，予大惊，以为怪，询之，良久，喘然曰，无惊，此汲氏之声也，因遭吾暴故出此音，君今会佳人可也<br />
（设 localhost:6666 做代理，firefox 建议使用 autoproxy 插件，该插件会自动获取被墙网站列表，在访问被墙网站时才使用代理）。<br />
予且喜且惊，施氏真强将也，当旦暮招之，以利吾张生之美也，遂做神符两张，以备随时招施氏也<br />
（使用时可以直接运行 ssh.sh/ssh.exp, 也可以加入到 gnome/kde 的启动项里面，登录桌面即可使用，无须手动开启，需将 ssh.exp 里面的账户和密码改成你自己的）</p>
<p>ssh.sh:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>ssh.exp</pre></div></div>

<p>ssh.exp:</p>

<div class="wp_syntax"><div class="code"><pre class="except" style="font-family:monospace;">#!/usr/bin/expect -f
# ssh连接的expect脚本
&nbsp;
spawn ssh -D 6666 -l your_account ssh_host_addr
expect {
    &quot;*(yes/no)*&quot; { send &quot;yes\r&quot; }
    &quot;*password*&quot; { send &quot;your_password\r&quot; }
}
expect &quot;*Last login*&quot; { interact }</pre></div></div>

<p>至施氏来后，予常享与众佳人相戏之乐，而施氏亦乐与汲氏大叔做龙阳之会。吾思先人尝曰独乐乐与众乐之理，信然，乃做此文，愿与众共乐也。</p>
]]></content:encoded>
			<wfw:commentRss>http://joolix.com/2010/04/ssh-phucks-g-f-w/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>okular 阅读中文 pdf 无法显示汉字的解决</title>
		<link>http://joolix.com/2010/04/okular-display-chinese/</link>
		<comments>http://joolix.com/2010/04/okular-display-chinese/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 14:02:24 +0000</pubDate>
		<dc:creator>xiooli</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[essay]]></category>

		<guid isPermaLink="false">http://joolix.com/?p=365</guid>
		<description><![CDATA[okular 是 kde 下的一个极好用的 pdf 阅读器，不过在读有些中文 pdf 的时候会出现不能显示汉字的情况（大概是没有嵌入字体的缘故），一直以来都不大看中文的文献/章，偶尔看看都用  acroread 解决，直到今天，实在无法忍受鸟，google 一下发现自己居然 out 了，okular 是用 poppler 做后端的，只需要安装一个 poppler-data 包就解决问题。按此解决，居然真的就搞定鸟，哈哈，腥粪，抄录在此以做备忘。
]]></description>
			<content:encoded><![CDATA[<p>okular 是 kde 下的一个极好用的 pdf 阅读器，不过在读有些中文 pdf 的时候会出现不能显示汉字的情况（大概是没有嵌入字体的缘故），一直以来都不大看中文的文献/章，偶尔看看都用  acroread 解决，直到今天，实在无法忍受鸟，google 一下发现自己居然 out 了，okular 是用 poppler 做后端的，只需要安装一个 poppler-data 包就解决问题。按此解决，居然真的就搞定鸟，哈哈，腥粪，抄录在此以做备忘。</p>
]]></content:encoded>
			<wfw:commentRss>http://joolix.com/2010/04/okular-display-chinese/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Archlinux 下 ICC+MKL 方案编译 GAMESS</title>
		<link>http://joolix.com/2010/01/compile-gamess-with-icc-and-mkl-under-archlinux/</link>
		<comments>http://joolix.com/2010/01/compile-gamess-with-icc-and-mkl-under-archlinux/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 18:05:53 +0000</pubDate>
		<dc:creator>xiooli</dc:creator>
				<category><![CDATA[Chemistry]]></category>
		<category><![CDATA[essay]]></category>

		<guid isPermaLink="false">http://joolix.com/?p=346</guid>
		<description><![CDATA[点此下载效果更好的 pdf 版本
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Archlinux 下 ICC+MKL 方案编译安装 GAMESS
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;作者: xiooli
<span class="readmore"><a href="http://joolix.com/2010/01/compile-gamess-with-icc-and-mkl-under-archlinux/" title="Archlinux 下 ICC+MKL 方案编译 GAMESS" target="_blank">阅读全文——共9444字</a></span>]]></description>
			<content:encoded><![CDATA[<p><a href="http://joolix.com/wp-content/uploads/2010/01/compile_gamess_in_arch.pdf">点此</a>下载效果更好的 pdf 版本</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Archlinux 下 ICC+MKL 方案编译安装 GAMESS<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;作者: xiooli<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;邮箱: <font color="#0000ff"><b>&lt;</b></font>xioooli<font color="#0000ff"><b>[</b></font>at<font color="#0000ff"><b>]</b></font>yahoo.com.cn<font color="#0000ff"><b>&gt;</b></font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;网站: <a href="http://joolix.com">http://joolix.com</a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;此文系根据自己实际操作写就，其中查考了 Sobereva 和王涛的文章 <font color="#cd00cd">(</font><font color="#ff1493">见参考文献</font><font color="#cd00cd">)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;在此表示感谢。<br />
&nbsp;&nbsp;&nbsp;&nbsp;本文依据 CC 协议发布，在保留原作品的署名的情况下你可以自由转载或修改再发布<br />
&nbsp;&nbsp;&nbsp;&nbsp;（仅限非商业用途）</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;正文&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
一，机器配置<br />
&nbsp;&nbsp;&nbsp;&nbsp;型号: lenove ThinkCenter M8000t<br />
&nbsp;&nbsp;&nbsp;&nbsp;主板: Intel Q45<br />
&nbsp;&nbsp;&nbsp;&nbsp;CPU:&nbsp;&nbsp;&nbsp;&nbsp;Intel<font color="#cd00cd">(</font><font color="#ff1493">R</font><font color="#cd00cd">)</font>&nbsp;Core<font color="#cd00cd">(</font><font color="#ff1493">TM</font><font color="#cd00cd">)</font><font color="#00cd00">2</font>&nbsp;Quad CPU Q9550 @ <font color="#00cd00">2</font>.83GHz <font color="#cd00cd">(</font><font color="#ff1493">四核</font><font color="#cd00cd">)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;内存: DDR3 1066MHz 2G X <font color="#00cd00">2</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;硬盘：&nbsp;&nbsp; SATA 500G 7200RPM</p>
<p>二，系统及编译环境<br />
&nbsp;&nbsp;&nbsp;&nbsp;系统: Archlinux x86_64<br />
&nbsp;&nbsp;&nbsp;&nbsp;内核: <font color="#00cd00">2</font>.<font color="#00cd00">6</font>.<font color="#00cd00">32</font>-ARCH<br />
&nbsp;&nbsp;&nbsp;&nbsp;SHELL:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bash:&nbsp;&nbsp; version <font color="#00cd00">4</font>.<font color="#00cd00">0</font>.<font color="#00cd00">35</font><font color="#cd00cd">(</font><font color="#00cd00">2</font><font color="#cd00cd">)</font>-release<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这是用户的默认登录 shell，编译操作基本上都是在 bash 里面完成的<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;csh:&nbsp;&nbsp;&nbsp;&nbsp;tcsh <font color="#00cd00">6</font>.<font color="#00cd00">17</font>.<font color="#00cd00">00</font>&nbsp;<font color="#cd00cd">(</font><font color="#ff1493">Astron</font><font color="#cd00cd">)</font>&nbsp;<font color="#00cd00">2009-07-10</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;因 gamess 的很多脚本是用 csh 写成，故而需要安装 csh <font color="#cd00cd">(</font><font color="#ff1493">包名是 tcsh</font><font color="#cd00cd">)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;C 编译器:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GCC:&nbsp;&nbsp;&nbsp;&nbsp;<font color="#00cd00">4</font>.<font color="#00cd00">4</font>.<font color="#00cd00">2</font>&nbsp;<font color="#00cd00">20091208</font>&nbsp;<font color="#cd00cd">(</font><font color="#ff1493">prerelease</font><font color="#cd00cd">)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GCC 是默认的编译器，可以从你发行版的软件源里面安装<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ICC:&nbsp;&nbsp;&nbsp;&nbsp;Version <font color="#00cd00">11</font>.<font color="#00cd00">1</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;intel 的 CPU 用 ICC 可以优化执行性能，其他 CPU 的同学可以不必使用 ICC<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;需要去 intel 的官网下载安装，个人和非商业使用只需注册一下，免费使用<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-设置开始&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ICC 一般是安装到 /opt 里面去的，系统并不能直接找到其可执行文件<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;所以需要将其 bin 目录加到 PATH 环境变量里面去<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;以我为例:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在 /opt/intel/Compiler/<font color="#00cd00">11</font>.<font color="#00cd00">1</font>/<font color="#00cd00">056</font>/bin/ 下面有两个文件一个目录（依系统位数<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;的不同，目录的名字可能不一样）: intel64/, iccvars.csh 和 iccvars.sh，你<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;需要在 /etc/profile.d/ 下面建立一个脚本，比如 iccvars.sh 其内容如下:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-不含此线&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000">#!/bin/bash</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;source /opt/intel/Compiler/<font color="#00cd00">11</font>.<font color="#00cd00">1</font>/<font color="#00cd00">056</font>/bin/iccvars.sh intel64<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-不含此线&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;最后的那个参数 intel64 依你的系统不同而不同，应该和你在<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/opt/intel/Compiler/<font color="#00cd00">11</font>.<font color="#00cd00">1</font>/<font color="#00cd00">056</font>/bin/ 中看的的目录名字相同，然后赋可执行权限:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sudo chmod a+x /etc/profile.d/iccvars.sh</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注意，这样只会在重启后生效，若要当时生效，须执行一下：</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff"><b>&nbsp;&nbsp;. </b></font>/etc/profile.d/iccvars.sh 或 source /etc/profile.d/iccvars.sh</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;此外，为了让程序（这里是 icc 等）找到它们所依赖的库，须得将 icc 的 lib<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;路径加入到 /etc/ld.so.conf 里面<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;以我为例:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在 /etc/ld.so.conf 里面加上一行：</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-不含此线&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/opt/intel/Compiler/<font color="#00cd00">11</font>.<font color="#00cd00">1</font>/<font color="#00cd00">056</font>/lib/<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-不含此线&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;然后以 root 权限运行 ldconfig<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ICC 的设置到此结束<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-设置结束&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;FORTRAN 编译器:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IFORT:&nbsp;&nbsp;Version <font color="#00cd00">11</font>.<font color="#00cd00">0</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这个也是 intel 的编译器，同样需要去其官方注册下载，个人版也是免费的<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;当然你也可以使用 g95 等开源的 FORTRAN 编译器<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-设置开始&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IFORT 同样也是安装到 /opt 里面去的，所以也需要将其 bin 目录加到 PATH<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;环境变量里面去<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;以我为例:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在 /opt/intel/Compiler/<font color="#00cd00">11</font>.<font color="#00cd00">0</font>/<font color="#00cd00">074</font>/bin/ 下面有两个文件一个目录（依系统位数<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;的不同，目录的名字可能不一样）: intel64/, ifortvars.csh 和 ifortvars.sh<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;你亦需要在 /etc/profile.d/ 下面建立一个脚本，比如 ifortvars.sh 其内容如下:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-不含此线&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000">#!/bin/bash</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;source /opt/intel/Compiler/<font color="#00cd00">11</font>.<font color="#00cd00">0</font>/<font color="#00cd00">074</font>/bin/ifortvars.sh intel64<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-不含此线&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;最后的那个参数 intel64 依你的系统不同而不同，应该和你在<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/opt/intel/Compiler/<font color="#00cd00">11</font>.<font color="#00cd00">0</font>/<font color="#00cd00">074</font>/bin/ 中看的的目录名字相同，然后赋可执行权限:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sudo chmod a+x /etc/profile.d/ifortvars.sh</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注意，这样只会在重启后生效，若要当时生效，须执行一下：</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff"><b>&nbsp;&nbsp;. </b></font>/etc/profile.d/ifortvars.sh 或 source /etc/profile.d/ifortvars.sh</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;此外，为了让程序（这里是 icc 等）找到它们所依赖的库，须得将 ifort 的 lib<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;路径加入到 /etc/ld.so.conf 里面<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;以我为例:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在 /etc/ld.so.conf 里面加上一行：</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-不含此线&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/opt/intel/Compiler/<font color="#00cd00">11</font>.<font color="#00cd00">0</font>/<font color="#00cd00">074</font>/lib/<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-不含此线&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;然后以 root 权限运行 ldconfig<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IFORT 的设置到此结束<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-设置结束&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;数学库:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MKL: Version <font color="#00cd00">10</font>.<font color="#00cd00">2</font>.<font color="#00cd00">3</font>.<font color="#00cd00">029</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这个是 intel 的数学核心函数库，据说使用ifort编译器结合MKL数学库可以使<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;代码执行速度大大提升。当然你如果不使用 MKL 的话会默认使用 BLAS 这个库<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AMD CPU 的同学可以考虑使用 ACML 这个数学库。同样，MKL 也可以到 intel 的<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;官网上面申请免费版本<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-设置开始&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MKL 的设置相对简单，因为其只是一些库，没有可执行文件，所以只需要将 MKL<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;库的位置加到 ld.so.conf 里面即可<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在 /etc/ld.so.conf 里面加上一行：</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-不含此线&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/opt/intel/mkl/<font color="#00cd00">10</font>.<font color="#00cd00">2</font>.<font color="#00cd00">3</font>.<font color="#00cd00">029</font>/lib/em64t/<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-不含此线&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;然后以 root 权限运行 ldconfig<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IFORT 的设置到此结束<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff1493">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-设置结束&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</font></p>
<p>三，具体操作过程<br />
&nbsp;&nbsp;&nbsp;&nbsp;在配置好了上面的编译环境以后便可以进行后续的编译过程了。<br />
&nbsp;&nbsp;&nbsp;&nbsp;首先，当然是准备 gamess 的源码咯，去 gamess 的网站上面填写申请，一般一到两天后会<br />
&nbsp;&nbsp;&nbsp;&nbsp;批下来，然后会邮件通知你下载地址，用户名和密码，然后就去拖下来咯，压缩包的大小约<br />
&nbsp;&nbsp;&nbsp;&nbsp;10M 左右，我下载的版本是: GAMESS version January <font color="#00cd00">12</font>, <font color="#00cd00">2009</font>&nbsp;R3 <font color="#0000ff"><b>for </b></font><font color="#00cd00">64</font>&nbsp;bit<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff"><b>(</b></font>x86_64 compatible<font color="#0000ff"><b>)</b></font>&nbsp;under Linux with gnu compilers<br />
&nbsp;&nbsp;&nbsp;&nbsp;然后准备一个安装目录（我将其安放在 /home/gamess 里面），将压缩包解压到安装目录下面<br />
&nbsp;&nbsp;&nbsp;&nbsp;好了，可以看到几个可执行文件:<br />
&nbsp;&nbsp;&nbsp;&nbsp;compall, comp, lked, runall 和 rungms</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;修改脚本&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
&nbsp;&nbsp;&nbsp;&nbsp;我们接下来将编辑这几个文件以使其符合我们自己的实际情况<br />
&nbsp;&nbsp;&nbsp;&nbsp;以我为例:<br />
&nbsp;&nbsp;&nbsp;&nbsp;compall:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">16</font>:&nbsp;&nbsp;<font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;TARGET</font><font color="#0000ff"><b>=</b></font><font color="#00cd00">linux</font>-ia64<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">17</font>:&nbsp;&nbsp;<font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;/home/gamess</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">70</font>:&nbsp;&nbsp;<font color="#0000ff"><b>if </b></font>&nbsp;<font color="#0000ff"><b>(</b></font><font color="#cd00cd">$TARGET</font>&nbsp;<font color="#0000ff"><b>==</b></font>&nbsp;linux-ia64<font color="#0000ff"><b>)</b></font>&nbsp;<font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;CCOMP</font><font color="#0000ff"><b>=</b></font><font color="#00cd00">&#8216;icc&#8217;</font>&nbsp;<font color="#ee0000"># 没有 icc 的可以继续 gcc</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;comp:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">15</font>:&nbsp;&nbsp;<font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;TARGET</font><font color="#0000ff"><b>=</b></font><font color="#00cd00">linux</font>-ia64<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">16</font>:&nbsp;&nbsp;<font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;/home/gamess</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">109</font>: <font color="#0000ff"><b>if </b></font>&nbsp;<font color="#0000ff"><b>(</b></font><font color="#cd00cd">$TARGET</font>&nbsp;<font color="#0000ff"><b>==</b></font>&nbsp;linux-ia64<font color="#0000ff"><b>)</b></font>&nbsp;&nbsp; <font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;BLAS3</font><font color="#0000ff"><b>=</b></font>/opt/intel/mkl/<font color="#00cd00">10</font>.<font color="#00cd00">2</font>.<font color="#00cd00">3</font>.<font color="#00cd00">029</font>/lib/em64t/<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 如果你没有安装 MKL 的话就不要动上面这行</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 由于我选择的 TARGET=linux-ia64，在 line 1507 可以看到已经是默认用了 ifort 作为 FORTRAN</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 的编译器，如果你的 TARGET 是其他的而又想用 ifort 的话，可以去对应的地方 (即</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># if ($TARGET == xxx) then 下面将 FORTRAN 编译器改成 ifort)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;lked:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">18</font>:&nbsp;&nbsp;<font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;TARGET</font><font color="#0000ff"><b>=</b></font><font color="#00cd00">linux</font>-ia64<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">19</font>: <font color="#0000ff"><b>chdir</b></font>&nbsp;/home/gamess<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">498</font>: <font color="#0000ff"><b>if </b></font><font color="#0000ff"><b>(</b></font><font color="#cd00cd">$TARGET</font>&nbsp;<font color="#0000ff"><b>==</b></font>&nbsp;linux-ia64<font color="#0000ff"><b>)</b></font>&nbsp;<font color="#0000ff"><b>then</b></font>&nbsp;<font color="#ee0000"># 若使用 MKL 则在下面添加一行</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">499</font>:&nbsp;&nbsp;&nbsp;&nbsp; setenv MKLPATH /opt/intel/mkl/<font color="#00cd00">10</font>.<font color="#00cd00">2</font>.<font color="#00cd00">3</font>.<font color="#00cd00">029</font>/lib/em64t<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 看它的脚本理论上来说不添加这行也是可以找到 MKL 的，不过在我这里报错说</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 找不到 MKL 里面的某个 so，所以还是加上比较保险</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;rungms:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">60</font>:&nbsp;&nbsp;<font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;SCR</font><font color="#0000ff"><b>=</b></font>/home/gamess/scr/<font color="#cd00cd">$USER</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 存放运算临时文件的地方，自己喜欢放哪里放哪里，如果你内存够大的话也可以放在</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># /dev/shm (实际是个在内存里面的目录)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;将所有的 ~mike/gamess 换成你的 gamess 安装目录（我的是 /home/gamess）<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#cd00cd">$USER</font>/scr 替换成 <font color="#cd00cd">$SCR</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;你可以通过运行下面命令来一次性完成此工作：</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sed <font color="#0000ff"><b>-i</b></font>&nbsp;<font color="#0000ff"><b>&#8216;</b></font><font color="#00cd00">s|~mike/gamess|/home/gamess|g;s|~$USER/scr|$SCR|g</font><font color="#0000ff"><b>&#8216;</b></font>&nbsp;./rungms</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如果你想使用 SMP 方式并行多核运算的话如果是双核机器则修改这里:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">497</font>: <font color="#0000ff"><b>case</b></font>&nbsp;br.msg.chem.iastate.edu: <font color="#ee0000"># 下面添加一行</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line 498: case YOUR-SERVER-NAME: <font color="#ee0000"># YOUR-SERVER-NAME 是运行 hostname 出来的结果</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line 499:&nbsp;&nbsp; if <font color="#0000ff"><b>(</b></font><font color="#cd00cd">$NCPUS</font>&nbsp;&gt; 2<font color="#0000ff"><b>)</b></font>&nbsp;<font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;NCPUS</font><font color="#0000ff"><b>=</b></font><font color="#00cd00">2</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如果是四核机器则修改这里:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">490</font>: <font color="#0000ff"><b>case</b></font>&nbsp;sc.msg.chem.iastate.edu: <font color="#ee0000"># 下面添加一行</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line 491:&nbsp;&nbsp; case YOUR-SERVER-NAME: <font color="#ee0000"># YOUR-SERVER-NAME 是运行 hostname 出来的结果</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line 492:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if <font color="#0000ff"><b>(</b></font><font color="#cd00cd">$NCPUS</font>&nbsp;&gt; 4<font color="#0000ff"><b>)</b></font>&nbsp;<font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;NCPUS</font><font color="#0000ff"><b>=</b></font><font color="#00cd00">4</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;runall:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">13</font>:&nbsp;&nbsp;<font color="#0000ff"><b>chdir</b></font>&nbsp;/home/gamess</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;编译 actvte&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
&nbsp;&nbsp;&nbsp;&nbsp;下面我们要编译链接激活 gamess 代码的程序 actvte <font color="#0000ff"><b>(</b></font>下面命令均在终端下输入<font color="#0000ff"><b>)</b></font>:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff"><b>cd</b></font>&nbsp;/home/gamess/tools/<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 视你 gamess 源文件存放地点的不同而 cd 到不同的目录</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;cp actvte.code actvte.f<br />
&nbsp;&nbsp;&nbsp;&nbsp;sed -i <font color="#0000ff"><b>&#8216;</b></font><font color="#00cd00">s|^\*UNX|&nbsp;&nbsp;&nbsp;&nbsp;|g</font><font color="#0000ff"><b>&#8216;</b></font>&nbsp;actvte.f<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 把以 *UNX 的开头用四个空格替换掉，即取消注释，亮出 UNIX-LIKE 系统的激活代码</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;ifort -o actvte.x -Vaxlib actvte.f<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 或 g95 -o actvte.x actvte.f 如果你没有 ifort 的话</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 成功生成了 actvte.x 以后可以将 actvte.f 删除</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;开始编译&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
&nbsp;&nbsp;&nbsp;&nbsp;然后便可以开始编译了，在终端运行:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff"><b>cd</b></font>&nbsp;/home/gamess<br />
&nbsp;&nbsp;&nbsp;&nbsp;./compall<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 如果你想看着它编译的话，或者让其在后台运行</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;./compall <font color="#0000ff"><b>&amp;</b></font><font color="#0000ff"><b>&gt;</b></font>&nbsp;compall.log <font color="#0000ff"><b>&amp;</b></font><br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 上面两条命令选一即可，无须都执行</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 经过一段取决于你机器性能的时间后（我这里大约用了 20 分钟）主要编译便完成了</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;其后编译 gamess 的分布式数据接口 <font color="#0000ff"><b>(</b></font>DDI<font color="#0000ff"><b>)</b></font>&nbsp;消息传递库，无论是否打算并行计算都必须<br />
&nbsp;&nbsp;&nbsp;&nbsp;编译，否则下面 lked 步骤通不过。假设现在主机名是 YOUR-SERVER-NAME（用 hostname<br />
&nbsp;&nbsp;&nbsp;&nbsp;命令可以看到当前主机名），就在 /etc/hosts 里面填上一行当前主机的IP地址和主机名<br />
&nbsp;&nbsp;&nbsp;&nbsp;例如: <font color="#00cd00">192</font>.<font color="#00cd00">168</font>.<font color="#00cd00">153</font>.<font color="#00cd00">3</font>&nbsp;YOUR-SERVER-NAME <font color="#ee0000"># [参考文献 1]</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;命令:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;sudo su<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff"><b>echo</b></font><font color="#00cd00">&nbsp;</font><font color="#0000ff"><b>&quot;</b></font><font color="#00cd00">192.168.153.3 YOUR-SERVER-NAME</font><font color="#0000ff"><b>&quot;</b></font><font color="#00cd00">&nbsp;</font><font color="#0000ff"><b>&gt;&gt;</b></font>&nbsp;/etc/hosts</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;进入 /home/gamess/ddi 目录，修改 compddi<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;compddi:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">18</font>:&nbsp;&nbsp;<font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;TARGET </font><font color="#0000ff"><b>=</b></font>&nbsp;linux-ia64<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">62</font>:&nbsp;&nbsp;<font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;MAXCPUS&nbsp;&nbsp;</font><font color="#0000ff"><b>=</b></font>&nbsp;<font color="#00cd00">4</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">63</font>:&nbsp;&nbsp;<font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;MAXNODES </font><font color="#0000ff"><b>=</b></font>&nbsp;<font color="#00cd00">2</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># set MAXCPUS 和 set MAXNODES 后面设成你的实际情况，前者代表每个节点中最多</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 包含几个核心（每个节点内可以以SMP方式并行的核心数目），后者代表最多有几个</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 节点，它们设的都可以比实际情况多 [参考文献 1]</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;修改 /home/gamess/ddi/src/std_system.c</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;std_system.c<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">26</font>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct hostent *hp<font color="#0000ff"><b>;</b></font>&nbsp;<font color="#ee0000"># 在其后插入一行</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">27</font>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name <font color="#0000ff"><b>=</b></font>&nbsp;<font color="#0000ff"><b>&quot;</b></font><font color="#00cd00">YOUR-SERVER-NAME</font><font color="#0000ff"><b>&quot;;</b></font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 之所以要加入这么一行是因为GAMESS的bug，会将主机名强行认作为localhost而不是</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 实际主机名，导致运行时提示TCP error之类错误 [参考文献 1]</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;最后运行命令:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;./compddi<br />
&nbsp;&nbsp;&nbsp;&nbsp;mv ddikick.x ..</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;最后编译图形应用程序</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff"><b>cd</b></font>&nbsp;/home/gamess/graphics<br />
&nbsp;&nbsp;&nbsp;&nbsp;编辑 complink 文件<br />
&nbsp;&nbsp;&nbsp;&nbsp;complink:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">15</font>:&nbsp;&nbsp;<font color="#0000ff"><b>chdir</b></font>&nbsp;/home/gamess/graphics<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">18</font>:&nbsp;&nbsp;<font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;TARGET</font><font color="#0000ff"><b>=</b></font>linux-pc<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">31</font>:&nbsp;&nbsp;<font color="#0000ff"><b>if </b></font><font color="#0000ff"><b>(</b></font><font color="#cd00cd">$TARGET</font>&nbsp;<font color="#0000ff"><b>==</b></font>&nbsp;linux-pc<font color="#0000ff"><b>)</b></font>&nbsp;&nbsp; <font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;FORT</font><font color="#0000ff"><b>=</b></font><font color="#00cd00">&#8216;ifort -O2&#8242;</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;之后运行./complink来编译</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;链接程序&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
&nbsp;&nbsp;&nbsp;&nbsp;链接可执行文件<br />
&nbsp;&nbsp;&nbsp;&nbsp;命令：</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff"><b>cd</b></font>&nbsp;/home/gamess<br />
&nbsp;&nbsp;&nbsp;&nbsp;./lked gamess <font color="#0000ff"><b>&amp;</b></font><font color="#0000ff"><b>&gt;</b></font>&nbsp;lked.log</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;如果不出问题的话最终会在当前目录下生成一个 gamess.<font color="#00cd00">00</font>.x 这样的可执行文件，至此我们的<br />
&nbsp;&nbsp;&nbsp;&nbsp;编辑工作就全部完成了，下面就是测试环节，在 /home/gamess 目录下运行 ./runall 将会对<br />
&nbsp;&nbsp;&nbsp;&nbsp;编译好的GAMESS程序进行测试，自动运行<font color="#00cd00">44</font>个测试文件，将在当前目录下得到一批 exam??.log<br />
&nbsp;&nbsp;&nbsp;&nbsp;文件。修改 /home/gamess/tools/checktst 目录下的 checktst 文件:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;checktst:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line <font color="#00cd00">9</font>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff"><b>set</b></font><font color="#008b8b">&nbsp;GMSPATH</font><font color="#0000ff"><b>=</b></font>/home/gamess<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;然后运行此文件，出现提示时输入 /home/gamess，会将所得log文件的结果与标准结果相对比<br />
&nbsp;&nbsp;&nbsp;&nbsp;检查任务是否已正常结束，以及计算误差是否超过阈值。对于failed的任务，检查相应的log文件<br />
&nbsp;&nbsp;&nbsp;&nbsp;除掉毛病后，把 scr 目录下对应文件删掉，若要单独运行一个测试比如 exam42 可以使用命令:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff"><b>cd</b></font>&nbsp;/home/gamess<br />
&nbsp;&nbsp;&nbsp;&nbsp;./rungms exam42 <font color="#00cd00">00</font>&nbsp;<font color="#00cd00">4</font>&nbsp;<font color="#0000ff"><b>&amp;</b></font><font color="#0000ff"><b>&gt;</b></font>exam42.log<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># rungms 的参数意义为: JOB=$1 (输入文件 xxx.inp，可以不输入扩展名); VERNO=$2 (lked</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ee0000"># 一步的 revision 数字，默认 00); NCPUS=$3 (运行时调用的 CPU 核心数)</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;待完成后再 checktst 看是否都已通过。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;一般情况下 exam42 和 exam43 会由于 linux 默认的单个共享内存段的最大值太小而不能通过<br />
&nbsp;&nbsp;&nbsp;&nbsp;使用 /sbin/sysctl <font color="#0000ff"><b>-a</b></font>&nbsp;<font color="#0000ff"><b>|</b></font>&nbsp;grep shmmax 命令察看默认值，这两个任务需要约 48MB，修改<br />
&nbsp;&nbsp;&nbsp;&nbsp;/etc/sysctl.conf，在里面加入一行 kernel.shmmax <font color="#0000ff"><b>=</b></font>&nbsp;<font color="#00cd00">5000000000</font>&nbsp;将其增加到约 500MB<br />
&nbsp;&nbsp;&nbsp;&nbsp;可以使用命令 /sbin/sysctl <font color="#0000ff"><b>-w</b></font>&nbsp;<font color="#008b8b">kernel.shmmax</font>=<font color="#00cd00">5000000000</font>&nbsp;来使其立即生效</p>
<p>参考文献:<br />
&nbsp;&nbsp;&nbsp;&nbsp;参考文献 <font color="#00cd00">1</font>: <a href="http://hi.baidu.com/sobereva/blog/item/fff7b5fd1e8dd04fd6887db6.html">http://hi.baidu.com/sobereva/blog/item/fff7b5fd1e8dd04fd6887db6.html</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;参考文献 <font color="#00cd00">2</font>: 王涛, 量子化学计算程序包GAMESS, 科学计算应用软件系列介绍<br />
</font></p>
]]></content:encoded>
			<wfw:commentRss>http://joolix.com/2010/01/compile-gamess-with-icc-and-mkl-under-archlinux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>看来得给主机商加钱了</title>
		<link>http://joolix.com/2010/01/%e7%9c%8b%e6%9d%a5%e5%be%97%e7%bb%99%e4%b8%bb%e6%9c%ba%e5%95%86%e5%8a%a0%e9%92%b1%e4%ba%86/</link>
		<comments>http://joolix.com/2010/01/%e7%9c%8b%e6%9d%a5%e5%be%97%e7%bb%99%e4%b8%bb%e6%9c%ba%e5%95%86%e5%8a%a0%e9%92%b1%e4%ba%86/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 12:57:44 +0000</pubDate>
		<dc:creator>xiooli</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[essay]]></category>

		<guid isPermaLink="false">http://joolix.com/?p=342</guid>
		<description><![CDATA[RT
google 撤出中国大概是确定了。幸而我博客主机在美国，而开通 ssh 只需加 70 ￥，是时候了。
]]></description>
			<content:encoded><![CDATA[<p>RT</p>
<p>google 撤出中国大概是确定了。幸而我博客主机在美国，而开通 ssh 只需加 70 ￥，是时候了。</p>
]]></content:encoded>
			<wfw:commentRss>http://joolix.com/2010/01/%e7%9c%8b%e6%9d%a5%e5%be%97%e7%bb%99%e4%b8%bb%e6%9c%ba%e5%95%86%e5%8a%a0%e9%92%b1%e4%ba%86/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用 python 生成和解码二维码图片</title>
		<link>http://joolix.com/2010/01/qrcodec-in-python/</link>
		<comments>http://joolix.com/2010/01/qrcodec-in-python/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 13:24:45 +0000</pubDate>
		<dc:creator>xiooli</dc:creator>
				<category><![CDATA[Script]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[essay]]></category>

		<guid isPermaLink="false">http://joolix.com/?p=340</guid>
		<description><![CDATA[了解了一下二维码的一些知识，感到很神奇哈，指甲盖那么大一块的二维码居然可以存放 500 多个汉字，呵呵如果书籍这样印刷的话是不是要少用些纸张呢？ 这个东西据说在现实中用处还挺大的，很多手机都支持拍摄和解读二维码，并且很多人把自己的个人信息也放在里面，印一张包含自己各种信息的二维码图片的名片是不是很酷呢？呵呵，鉴于可能有此需要，我就试着找了一下看看有没有什么 python 的二维码 lib，嘿嘿，还真有，pyqrcodec 就是这样一个 python lib，archlinux 下用 yaourt -S pyqrcodec 就可以安装，其他发行版的可能类似，就不详述了。
看了一下 pyqrcodec 的文档，用法其实很简单，xiooli 顺手写了一个小脚本，实现了 QR 二维码图片的生成和解码，下面是一张例图：
<span class="readmore"><a href="http://joolix.com/2010/01/qrcodec-in-python/" title="用 python 生成和解码二维码图片" target="_blank">阅读全文——共1419字</a></span>]]></description>
			<content:encoded><![CDATA[<p>了解了一下二维码的一些知识，感到很神奇哈，指甲盖那么大一块的二维码居然可以存放 500 多个汉字，呵呵如果书籍这样印刷的话是不是要少用些纸张呢？ 这个东西据说在现实中用处还挺大的，很多手机都支持拍摄和解读二维码，并且很多人把自己的个人信息也放在里面，印一张包含自己各种信息的二维码图片的名片是不是很酷呢？呵呵，鉴于可能有此需要，我就试着找了一下看看有没有什么 python 的二维码 lib，嘿嘿，还真有，pyqrcodec 就是这样一个 python lib，archlinux 下用 yaourt -S pyqrcodec 就可以安装，其他发行版的可能类似，就不详述了。</p>
<p>看了一下 pyqrcodec 的文档，用法其实很简单，xiooli 顺手写了一个小脚本，实现了 QR 二维码图片的生成和解码，下面是一张例图：<br />
<a href="http://www.flickr.com/photos/46010737@N06/4243920153/" title="qr codec picture"><img src="http://farm3.static.flickr.com/2792/4243920153_d2c9fdce8d.jpg" width="370" height="370" alt="a" /></a><br />
生成这张例图的命令和解码的命令如下：</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">xiooli<span style="color: #000000; font-weight: bold;">@</span>XIOOLI<span style="color: #000000; font-weight: bold;">&gt;</span> python qrcode.py <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;hello,大家好，我是 xiooli！&quot;</span> .<span style="color: #000000; font-weight: bold;">/</span>a.png 
generated <span style="color: #c20cb9; font-weight: bold;">file</span>: .<span style="color: #000000; font-weight: bold;">/</span>a.png
xiooli<span style="color: #000000; font-weight: bold;">@</span>XIOOLI<span style="color: #000000; font-weight: bold;">&gt;</span> python qrcode.py <span style="color: #660033;">-d</span> .<span style="color: #000000; font-weight: bold;">/</span>a.png
QR_IMAGEREADER_DECODED, QR_FORMATINFO_UNRECOVERABLE,
get text: hello,大家好，我是 xiooli！</pre></div></div>

<p>qrcode.py 的源码：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</pre></td><td class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
<span style="color: #808080; font-style: italic;"># -*- coding: utf-8 -*-</span>
<span style="color: #808080; font-style: italic;"># Name:     qrcode.py</span>
<span style="color: #808080; font-style: italic;"># Author:   xiooli &lt;xioooli[at]yahoo.com.cn&gt;</span>
<span style="color: #808080; font-style: italic;"># Site:     http://joolix.com</span>
<span style="color: #808080; font-style: italic;"># Licence:  GPLv3</span>
<span style="color: #808080; font-style: italic;"># Version:  100104</span>
&nbsp;
<span style="color: #483d8b;">''</span><span style="color: #483d8b;">'generate and decode qrcode pictures'</span><span style="color: #483d8b;">''</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> PyQrcodec as pqr
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> gen_qrpic<span style="color: black;">&#40;</span>text, <span style="color: #008000;">file</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">''</span><span style="color: #483d8b;">'generate a qrcode file contains the given text'</span><span style="color: #483d8b;">''</span>
    <span style="color: #dc143c;">stat</span>, img = pqr.<span style="color: black;">encode</span><span style="color: black;">&#40;</span>text<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">stat</span>:
        img.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: #008000;">file</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">file</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;failed to generate qrcode picture.&quot;</span>
<span style="color: #ff7700;font-weight:bold;">def</span> qrdecode<span style="color: black;">&#40;</span><span style="color: #008000;">file</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">''</span><span style="color: #483d8b;">'decode the qrcode picture'</span><span style="color: #483d8b;">''</span>
    <span style="color: #dc143c;">stat</span>, text = pqr.<span style="color: black;">decode</span><span style="color: black;">&#40;</span><span style="color: #008000;">file</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">stat</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> text
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;failed to decode the qrcode picture.&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
    args = <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>args<span style="color: black;">&#41;</span> == <span style="color: #ff4500;">1</span> <span style="color: #ff7700;font-weight:bold;">or</span> args<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> == <span style="color: #483d8b;">'-h'</span> <span style="color: #ff7700;font-weight:bold;">or</span> args<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> == <span style="color: #483d8b;">'--help'</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;encode: &quot;</span> + args<span style="color: black;">&#91;</span>0<span style="color: black;">&#93;</span> + <span style="color: #483d8b;">&quot; -e [text] [image file]&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;decode: &quot;</span> + args<span style="color: black;">&#91;</span>0<span style="color: black;">&#93;</span> + <span style="color: #483d8b;">&quot; -d [imgae file]&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">elif</span> args<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> == <span style="color: #483d8b;">'-e'</span>:
        <span style="color: #ff7700;font-weight:bold;">try</span>:
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;generated file: &quot;</span> + gen_qrpic<span style="color: black;">&#40;</span>args<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>,args<span style="color: black;">&#91;</span><span style="color: #ff4500;">3</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span>:
            <span style="color: #ff7700;font-weight:bold;">pass</span>
    <span style="color: #ff7700;font-weight:bold;">elif</span> args<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> == <span style="color: #483d8b;">'-d'</span>:
        <span style="color: #ff7700;font-weight:bold;">try</span>:
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;get text: &quot;</span> + qrdecode<span style="color: black;">&#40;</span>args<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span>:
            <span style="color: #ff7700;font-weight:bold;">pass</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'unrecoded arguments'</span></pre></td></tr></table></div>

<p>想为自己名片加上二维码信息的童鞋们不用愁咯，^^</p>
]]></content:encoded>
			<wfw:commentRss>http://joolix.com/2010/01/qrcodec-in-python/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>用 shedskin 将你的 python 程序转成 C++ 代码</title>
		<link>http://joolix.com/2009/12/convert-your-python-script-into-cpp-with-shedskin/</link>
		<comments>http://joolix.com/2009/12/convert-your-python-script-into-cpp-with-shedskin/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 14:26:06 +0000</pubDate>
		<dc:creator>xiooli</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[essay]]></category>
		<category><![CDATA[program]]></category>

		<guid isPermaLink="false">http://joolix.com/?p=334</guid>
		<description><![CDATA[最近在用 python 写一些东西（puzzleup.com上的题啥的），python 写起来很快也很方便，但是当遇到大量数学运算的时候可能就会很慢，于是我就 google 了一下 python 加速的方法，常用的 pysco 就不用说了，这是最简单的方法，但是效果可能不是最好的，传说 pypy 能够将 python 翻译成 c/java 能代码，但是使用的过程中老是遇到错误（什么：[translation:ERROR]  KeyError: &#8216;target&#8217; bulabula），而且编译这个东西耗费了我 &#62;24 h，喜特！猛回头，瞅见了 shedskin，传说这个东东能将 python 翻译成C++，抱着试试看的心情，我就安装上了，结果一试，还真的有快感诶，赫赫！
<span class="readmore"><a href="http://joolix.com/2009/12/convert-your-python-script-into-cpp-with-shedskin/" title="用 shedskin 将你的 python 程序转成 C++ 代码" target="_blank">阅读全文——共1965字</a></span>]]></description>
			<content:encoded><![CDATA[<p>最近在用 python 写一些东西（puzzleup.com上的题啥的），python 写起来很快也很方便，但是当遇到大量数学运算的时候可能就会很慢，于是我就 google 了一下 python 加速的方法，常用的 pysco 就不用说了，这是最简单的方法，但是效果可能不是最好的，传说 pypy 能够将 python 翻译成 c/java 能代码，但是使用的过程中老是遇到错误（什么：[translation:ERROR]  KeyError: &#8216;target&#8217; bulabula），而且编译这个东西耗费了我 &gt;24 h，喜特！猛回头，瞅见了 shedskin，传说这个东东能将 python 翻译成C++，抱着试试看的心情，我就安装上了，结果一试，还真的有快感诶，赫赫！</p>
<p>使用方法：<br />
普通的话就直接：shedskin xxx.py 就可以了，注意 xxx.py 里面只能有数字，字母和下划线，其他滴不要（路径都不能有，刚刚没太注意，结果老是出警告：*ERROR*:./xxx.py: module names should consist of letters, digits and underscores），会在当前目录下生成一个 xxx.cpp, xxx.hpp 和一个 Makefile，完事以后直接 make 就会编译出一个可执行程序来的。为了验证这个玩意是否好使，我找了一个以前和骨头，lerosua 等童鞋一起做欧拉工程的一道运算量较大的题来做实验。<br />
题目是：</p>
<blockquote><p>http://projecteuler.net/index.php?section=problems&amp;id=10</p>
<p>小于10的所有质数的和是 2 + 3 + 5 + 7 = 17。求小于2000000的所有质数的和。</p></blockquote>
<p>我写了一个 python 版本（鉴于本人的 python 极菜加之有数学恐惧症，大家对该程序的运行效率不要抱太大希望，只限于能够算出答案而已）：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
<span style="color: #808080; font-style: italic;"># -*- coding: utf-8 -*-</span>
<span style="color: #808080; font-style: italic;"># Name:     007-xiooli.py</span>
<span style="color: #808080; font-style: italic;"># Author:   xiooli</span>
<span style="color: #808080; font-style: italic;">#           Email:  &lt;xioooli[at]yahoo.com.cn&gt;</span>
<span style="color: #808080; font-style: italic;">#           Site:   http://joolix.com</span>
<span style="color: #808080; font-style: italic;"># Licence:  GPLv3</span>
<span style="color: #808080; font-style: italic;"># Version:  091024</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> is_prime<span style="color: black;">&#40;</span>prm,i<span style="color: black;">&#41;</span>:
    j=0
    <span style="color: #ff7700;font-weight:bold;">while</span> prm<span style="color: black;">&#91;</span>j<span style="color: black;">&#93;</span><span style="color: #66cc66;">*</span>prm<span style="color: black;">&#91;</span>j<span style="color: black;">&#93;</span> <span style="color: #66cc66;">&lt;</span>= i:
        <span style="color: #ff7700;font-weight:bold;">if</span> i<span style="color: #66cc66;">%</span>prime<span style="color: black;">&#91;</span>j<span style="color: black;">&#93;</span> == 0:
            <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">False</span>
        j+=<span style="color: #ff4500;">1</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">True</span>
&nbsp;
prime=<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> k <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">xrange</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">3</span>,<span style="color: #ff4500;">2000000</span>,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> is_prime<span style="color: black;">&#40;</span>prime,k<span style="color: black;">&#41;</span>:
        prime.<span style="color: black;">append</span><span style="color: black;">&#40;</span>k<span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #008000;">sum</span><span style="color: black;">&#40;</span>prime<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>然后是 lerosua 童鞋的 C 版本：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
</pre></td><td class="code"><pre class="c c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*
 * =====================================================================================
 *
 *       Filename:  003-lerosua.c
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  2009年10月21日 11时37分49秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  lerosua (), lerosua@gmail.com
 *        Company:  cyclone
 *
 * =====================================================================================
 */</span>
&nbsp;
&nbsp;
<span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
<span style="color: #339933;">#include &lt;math.h&gt;</span>
&nbsp;
<span style="color: #339933;">#define MAX 1024000</span>
<span style="color: #808080; font-style: italic;">/** 简单的素数集合*/</span>
<span style="color: #993333;">static</span> <span style="color: #993333;">long</span> <span style="color: #993333;">long</span> primum<span style="color: #009900;">&#91;</span>MAX<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000dd;">2</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">3</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">5</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">7</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">11</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">13</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">17</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">19</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">23</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">29</span> <span style="color: #009900;">&#125;</span>;
&nbsp;
<span style="color: #993333;">static</span> <span style="color: #993333;">long</span> <span style="color: #993333;">int</span> count <span style="color: #339933;">=</span> <span style="color: #0000dd;">10</span>;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/** 填加10001个素数进素数数组*/</span>
<span style="color: #993333;">void</span> fill_prime<span style="color: #009900;">&#40;</span><span style="color: #993333;">long</span> <span style="color: #993333;">long</span> num<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #993333;">long</span> <span style="color: #993333;">long</span> i <span style="color: #339933;">=</span> <span style="color: #0000dd;">31</span>;
	<span style="color: #993333;">long</span> <span style="color: #993333;">int</span> j <span style="color: #339933;">=</span> <span style="color:#800080;">0</span>;
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>; i <span style="color: #339933;">&lt;</span> num; i <span style="color: #339933;">=</span> i <span style="color: #339933;">+</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #993333;">int</span> flag <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span>;
		<span style="color: #993333;">long</span> <span style="color: #993333;">long</span> m<span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">long</span> <span style="color: #993333;">long</span><span style="color: #009900;">&#41;</span>sqrt<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000dd;">1</span>;
		<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>j <span style="color: #339933;">=</span> <span style="color:#800080;">0</span>; primum<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;</span> m; j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">%</span> primum<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color:#800080;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				flag <span style="color: #339933;">=</span> <span style="color:#800080;">0</span>;
				<span style="color: #000000; font-weight: bold;">break</span>;
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>flag<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			primum<span style="color: #009900;">&#91;</span>count<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> i;
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">&gt;</span>num<span style="color: #009900;">&#41;</span>
				<span style="color: #b1b100;">return</span>;
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>count<span style="color: #339933;">&gt;</span>MAX<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;error%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>count<span style="color: #009900;">&#41;</span>;
			exit<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>argv<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #993333;">int</span> i;
	<span style="color: #993333;">long</span> <span style="color: #993333;">long</span> sum<span style="color: #339933;">=</span>0L;
	fill_prime<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">2000000</span><span style="color: #009900;">&#41;</span>;
&nbsp;
	<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color:#800080;">0</span>;i<span style="color: #339933;">&lt;</span>count;i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>primum<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">&lt;</span><span style="color: #0000dd;">2000000</span><span style="color: #009900;">&#41;</span>
			sum<span style="color: #339933;">+=</span>primum<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>;
&nbsp;
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;count %d <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>count<span style="color: #009900;">&#41;</span>;
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%lld<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>sum<span style="color: #009900;">&#41;</span>;
	<span style="color: #666666; font-style: italic;">//printf(&quot;%ld\n&quot;,primum[5]);</span>
	<span style="color: #b1b100;">return</span> <span style="color:#800080;">0</span>;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>下面正面 PK ：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="bash bash" style="font-family:monospace;">xiooli<span style="color: #000000; font-weight: bold;">@</span>XIOOLI<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">time</span> .<span style="color: #000000; font-weight: bold;">/</span>010-lerosua 
count <span style="color: #000000;">148933</span>                                                                                    
<span style="color: #000000;">142913828922</span>                                                                                    
.<span style="color: #000000; font-weight: bold;">/</span>010-lerosua  0.83s user 0.00s system <span style="color: #000000;">95</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">0.875</span> total
xiooli<span style="color: #000000; font-weight: bold;">@</span>XIOOLI<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">time</span> python 010-xiooli.py
<span style="color: #000000;">142913828922</span>                                                                                     
python 010_xiooli.py  19.91s user 0.01s system <span style="color: #000000;">93</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">21.191</span> total</pre></td></tr></table></div>

<p>咳咳，差距呀～～～（厚颜无耻的说一句，比代码行数的话，我可不差哦。。）</p>
<p>好了，闲话少说，今天咱是有备而来，xiooli 要祭出杀手锏了：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="bash bash" style="font-family:monospace;">xiooli<span style="color: #000000; font-weight: bold;">@</span>XIOOLI<span style="color: #000000; font-weight: bold;">&gt;</span> shedskin 010_xiooli.py 
<span style="color: #000000; font-weight: bold;">***</span> SHED SKIN Python-to-C++ Compiler <span style="color: #000000;">0.2</span> <span style="color: #000000; font-weight: bold;">***</span>                                                    
Copyright <span style="color: #000000;">2005</span>-<span style="color: #000000;">2009</span> Mark Dufour; License GNU GPL version <span style="color: #000000;">3</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>See LICENSE<span style="color: #7a0874; font-weight: bold;">&#41;</span>                        
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span>iterative <span style="color: #7a0874; font-weight: bold;">type</span> analysis..<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">**</span>                         
iterations: <span style="color: #000000;">2</span> templates: <span style="color: #000000;">78</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>generating <span style="color: #c20cb9; font-weight: bold;">c++</span> code..<span style="color: #7a0874; font-weight: bold;">&#93;</span>    
xiooli<span style="color: #000000; font-weight: bold;">@</span>XIOOLI<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> 
<span style="color: #c20cb9; font-weight: bold;">g++</span>  <span style="color: #660033;">-O2</span> <span style="color: #660033;">-pipe</span> <span style="color: #660033;">-Wno-deprecated</span>  -I. -I<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>shedskin-<span style="color: #000000;">0.2</span><span style="color: #000000; font-weight: bold;">/</span>lib <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>shedskin-<span style="color: #000000;">0.2</span><span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>builtin.cpp 010_xiooli.cpp <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>shedskin-<span style="color: #000000;">0.2</span><span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>re.cpp <span style="color: #660033;">-lgc</span> <span style="color: #660033;">-lpcre</span>  <span style="color: #660033;">-o</span> 010_xiooli                  
xiooli<span style="color: #000000; font-weight: bold;">@</span>XIOOLI<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">time</span> .<span style="color: #000000; font-weight: bold;">/</span>010_xiooli
<span style="color: #000000;">142913828922</span>                                                                                     
.<span style="color: #000000; font-weight: bold;">/</span>010_xiooli  0.53s user 0.00s system <span style="color: #000000;">94</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">0.561</span> total</pre></td></tr></table></div>

<p>呵呵，生成的那个 cpp 和 hpp 乱七八糟的，加之我又不懂 C++，就不列出来了。<br />
居然比 lerosua 童鞋辛辛苦苦写的那一大堆 C 的还要快 0.2 s 多呢，呵呵，shedskin 真是做题作弊之良器也阿。</p>
<p>ps：相信大点的程序要用 shedskin 转 C++ 的话挺够呛的，不过，可以把 python 程序里面的运行瓶颈部分拿出来转成 C++， 于整个程序的运行效率提高应该有很大的帮助呢。另外 shedskin 不是很灵光，python 里面一些很灵活的东西要写得比较死它才容易认，反正有提示的，遇到出错再改 py 文件。</p>
<p>窃笑中：估计 lerosua 童鞋要郁闷了。</p>
]]></content:encoded>
			<wfw:commentRss>http://joolix.com/2009/12/convert-your-python-script-into-cpp-with-shedskin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
