GPUで高速なTeraChemを試す
出典: トータル・ディスクロージャ・サイト(事実をありのままに)
TeraChem はGPGPUで量子化学計算を行えるソフトで、PetaChem LLC が開発しています。ベータ版を入手したので性能を調べてみました。
目次 |
テスト環境
| 項目 | CPU+GPUでの測定で使用した |
|---|---|
| CPU | Quad-core Intel Xeon E5540 @ 2.53GHz x 2 (8コア全部を使用) |
| GPU | Tesla C1060 x 1(Multiprocessor 30個 で Core 240個) |
| ノード数 | 1 |
| OS | Fedora release 10 (Cambridge) |
| CUDA | CUDA release 2.3 |
インストール
ベータ版のtarファイルを展開するとインストーラやユーザーズガイドが入っています。
> tar -xf tcv3.tar > cd TCInstaller > ls LICENSE NumGPUs deviceQuery install install.log libs terachemb3.tar.gz userguide3.pdf
あとはインストーラを起動するだけです。
> ./install
ここで、TeraChem を動作させるに必要なハードウェア・ソフトウェアが搭載されているかどうか、自動的に調査されます。当初 CUDA 2.2 しかインストールされていなかったため「CUDA 2.3以降を入れろ」とエラーになりました。そこで、CUDA 2.3 を入れたところインストーラが正常に進みました。ライセンス条項に同意して、インストール先ディレクトリを指定するとTeraChemがインストールされました。
実行する前に環境変数を設定せよと言われているので忘れずに行いましょう。
bashの場合:
$ export OMP_NUM_THREADS=8
$ export LD_LIBRARY_PATH=インストール先ディレクトリ/libs:${LD_LIBRARY_PATH}
実行するときは次のコマンドで行えます。
$ source インストール先ディレクトリ/SetTCVars.sh ←bash用しかついていないようです $ インストール先ディレクトリ/terachem インプットファイル
動作テスト
擬似test397 (OMP_NUM_THREADS=8)
Gaussianのtest397ベンチマークテストを再現させてみました。再現手順としては、test397のインプットをカルテシアン座標に変換してtest397.xyzとして保存し、TeraChemのインプットファイルを次のように記述しました。
$ cat start.sp # basis set basis 3-21g # coordinates file coordinates test397.xyz # molecule charge charge 0 # SCF method (rhf/blyp/b3lyp/etc...): DFT-BLYP method b3lyp # add dispersion correction (DFT-D) dftd no # type of the job (energy/gradient/md/minimize/ts): single-point energy run energy end
上記の通りインプットは見たまんまでわかりやすい形式になっています。type of the job ではシングルポイント計算以外に gradient 計算、MD計算、minimize計算(構造最適化)、ts計算(遷移状態探索)を指定できます。
なお、Gaussian付属の本来のtest397インプットでは forceキーワード と scf=novaraccキーワード が付いていますが、それは再現していません。
さて、上記のインプットで実行してみました。なお、OMP_NUM_THREADS=8 で動かしているので、GPUと同時にCPU8コアも使って計算を行うことになりますが、計算中にtopで見たところほとんどGPU上の計算だけでCPUは使っていない状態でした。
$ ../../terachem start.sp
***********************************************************
* TeraChem, Beta3 *
* Chemistry at the Speed of Graphics *
***********************************************************
* This program may only be used in connection with *
* a valid beta-testing license from PetaChem, LLC. Use *
* of this program or results thereof indicates acceptance *
* of all terms and conditions stated in the license and *
* that a valid license agreement between the user and *
* PetaChem, LLC exists. Users further understand that *
* this is beta software and the correctness of results or *
* their suitability for any purpose is not guaranteed. *
* Please email bugs, suggestions, and comments to *
* help@petachem.com *
***********************************************************
XYZ coordinates test397.xyz
Orbitals will be written to orbitals.log every 1000000000 time step
Spin multiplicity: 1
Using DIIS algorithm to converge WF
WF convergence threshold: 3.00e-05
Maximum number of SCF iterations: 100
Coulomb integral threshold: 1.00e-11
One-electron integral threshold: 1.00e-12
Gradient threshold: 1.00e-12
Exchange integral threshold: 1.00e-11
K-guard threshold: 1.00e-03
X-matrix tolerance: 1.00e-05
Method: RKS
DFT functional: B3LYP with VWN1 correlation
DFT grid type: 2
Initial guess generated by maximum overlap
******************************************
**** SINGLE POINT ENERGY CALCULATIONS ****
******************************************
using 1 out of 1 CUDA devices
0: Tesla C1060 (CC 1.3) -- USED
-----------------------------------------------
Basis set: 3-21g
Total atoms: 168
Total charge: 0
Total electrons: 600 (300-alpha, 300-beta)
Total orbitals: 882
Total AO shells: 570 (414 S-shells; 156 P-shells)
The spin state is singlet
allocated
generating PQs...
generating S...
generating guess...
Time to generate guess: 0.49
0: CUBLAS initialized
Setting up the DFT grid...
time to set the grid = 1.59 s
DFT grid points: 981484 (5842 points/atom)
Purifying P... IDMP = 4.884981e-15
1 DIISerr = 0.190106 Nelec = 599.998943 Exc = -412.359081 a.u. Escf = -3760.545318 a.u. Elapsed time: 15.80 sec
2 DIISerr = 0.386738 Nelec = 599.999675 Exc = -426.001648 a.u. Escf = -3762.432802 a.u. Elapsed time: 16.61 sec
3 DIISerr = 0.318990 Nelec = 599.998717 Exc = -423.712030 a.u. Escf = -3770.087137 a.u. Elapsed time: 16.39 sec
4 DIISerr = 0.072849 Nelec = 599.998630 Exc = -420.769724 a.u. Escf = -3773.871914 a.u. Elapsed time: 15.79 sec
5 DIISerr = 0.063557 Nelec = 599.998871 Exc = -421.752907 a.u. Escf = -3774.018562 a.u. Elapsed time: 15.09 sec
6 DIISerr = 0.016535 Nelec = 599.998821 Exc = -422.007451 a.u. Escf = -3774.114818 a.u. Elapsed time: 14.48 sec
7 DIISerr = 0.003544 Nelec = 599.998790 Exc = -421.863958 a.u. Escf = -3774.127752 a.u. Elapsed time: 13.76 sec
8 DIISerr = 0.001279 Nelec = 599.998791 Exc = -421.805561 a.u. Escf = -3774.129019 a.u. Elapsed time: 13.07 sec
9 DIISerr = 0.001039 Nelec = 599.998793 Exc = -421.818258 a.u. Escf = -3774.129082 a.u. Elapsed time: 12.15 sec
10 DIISerr = 0.000189 Nelec = 599.998793 Exc = -421.821488 a.u. Escf = -3774.129097 a.u. Elapsed time: 11.72 sec
11 DIISerr = 0.000036 Nelec = 599.998793 Exc = -421.821045 a.u. Escf = -3774.129099 a.u. Elapsed time: 11.20 sec
12 DIISerr = 0.000034 Nelec = 599.998793 Exc = -421.821009 a.u. Escf = -3774.129099 a.u. Elapsed time: 10.73 sec
13 DIISerr = 0.000011 Nelec = 599.998793 Exc = -421.820983 a.u. Escf = -3774.129099 a.u. Elapsed time: 10.33 sec
FINAL ENERGY: -3774.129099 a.u.
CENTER OF MASS: {-0.004859, 0.014274, -0.002364} ANGS
DIPOLE MOMENT: {-0.055294, 0.383637, 0.460263} (|D| = 0.601728) DEBYE
Processing time: 180.46 sec
最終行に出力されているように、180.46 秒で計算が完了しました!
一方、CPUでの計算では、某量子化学計算ソフトに同様のインプットを与えたところ CPU 8コア並列でも 500 秒程度要しているのが現状です。これを考えると、TeraChemのようなGPGPUによる高速化効果は大変魅力的と言えます。
擬似test397 (OMP_NUM_THREADS=1)
並列スレッド数を制御する環境変数 OMP_NUM_THREADS を 1 にして測定してみました。
***********************************************************
* TeraChem, Beta3 *
* Chemistry at the Speed of Graphics *
***********************************************************
* This program may only be used in connection with *
* a valid beta-testing license from PetaChem, LLC. Use *
* of this program or results thereof indicates acceptance *
* of all terms and conditions stated in the license and *
* that a valid license agreement between the user and *
* PetaChem, LLC exists. Users further understand that *
* this is beta software and the correctness of results or *
* their suitability for any purpose is not guaranteed. *
* Please email bugs, suggestions, and comments to *
* help@petachem.com *
***********************************************************
XYZ coordinates test397.xyz
Orbitals will be written to orbitals.log every 1000000000 time step
Spin multiplicity: 1
Using DIIS algorithm to converge WF
WF convergence threshold: 3.00e-05
Maximum number of SCF iterations: 100
Coulomb integral threshold: 1.00e-11
One-electron integral threshold: 1.00e-12
Gradient threshold: 1.00e-12
Exchange integral threshold: 1.00e-11
K-guard threshold: 1.00e-03
X-matrix tolerance: 1.00e-05
Method: RKS
DFT functional: B3LYP with VWN1 correlation
DFT grid type: 2
Initial guess generated by maximum overlap
******************************************
**** SINGLE POINT ENERGY CALCULATIONS ****
******************************************
using 1 out of 1 CUDA devices
0: Tesla C1060 (CC 1.3) -- USED
-----------------------------------------------
Basis set: 3-21g
Total atoms: 168
Total charge: 0
Total electrons: 600 (300-alpha, 300-beta)
Total orbitals: 882
Total AO shells: 570 (414 S-shells; 156 P-shells)
The spin state is singlet
allocated
generating PQs...
generating S...
generating guess...
Time to generate guess: 0.44
0: CUBLAS initialized
Setting up the DFT grid...
time to set the grid = 1.59 s
DFT grid points: 981484 (5842 points/atom)
Purifying P... IDMP = 4.440892e-15
1 DIISerr = 0.190106 Nelec = 599.998943 Exc = -412.359081 a.u. Escf = -3760.545318 a.u. Elapsed time: 16.05 sec
2 DIISerr = 0.386738 Nelec = 599.999675 Exc = -426.001648 a.u. Escf = -3762.432802 a.u. Elapsed time: 16.76 sec
3 DIISerr = 0.318990 Nelec = 599.998717 Exc = -423.712030 a.u. Escf = -3770.087137 a.u. Elapsed time: 16.62 sec
4 DIISerr = 0.072849 Nelec = 599.998630 Exc = -420.769724 a.u. Escf = -3773.871915 a.u. Elapsed time: 15.93 sec
5 DIISerr = 0.063557 Nelec = 599.998871 Exc = -421.752907 a.u. Escf = -3774.018561 a.u. Elapsed time: 15.10 sec
6 DIISerr = 0.016535 Nelec = 599.998821 Exc = -422.007451 a.u. Escf = -3774.114817 a.u. Elapsed time: 14.68 sec
7 DIISerr = 0.003544 Nelec = 599.998790 Exc = -421.863958 a.u. Escf = -3774.127752 a.u. Elapsed time: 13.97 sec
8 DIISerr = 0.001279 Nelec = 599.998791 Exc = -421.805561 a.u. Escf = -3774.129019 a.u. Elapsed time: 13.20 sec
9 DIISerr = 0.001039 Nelec = 599.998793 Exc = -421.818258 a.u. Escf = -3774.129082 a.u. Elapsed time: 12.37 sec
10 DIISerr = 0.000189 Nelec = 599.998793 Exc = -421.821488 a.u. Escf = -3774.129097 a.u. Elapsed time: 11.96 sec
11 DIISerr = 0.000036 Nelec = 599.998793 Exc = -421.821045 a.u. Escf = -3774.129099 a.u. Elapsed time: 11.45 sec
12 DIISerr = 0.000034 Nelec = 599.998793 Exc = -421.821009 a.u. Escf = -3774.129099 a.u. Elapsed time: 10.95 sec
13 DIISerr = 0.000011 Nelec = 599.998793 Exc = -421.820983 a.u. Escf = -3774.129099 a.u. Elapsed time: 10.55 sec
FINAL ENERGY: -3774.129099 a.u.
CENTER OF MASS: {-0.004859, 0.014274, -0.002364} ANGS
DIPOLE MOMENT: {-0.055294, 0.383637, 0.460262} (|D| = 0.601727) DEBYE
Processing time: 183.18 sec
計算時間はほとんど変わりませんでした。やはり、今回の計算では、CPUスレッド並列処理はほとんど使われていないと考えられます。
Acknowledgement
TeraChem version Beta-1, PetaChem, LLC (2009). See http://www.petachem.com.
“I. S. Ufimtsev and T. J. Martínez. Quantum Chemistry on Graphical Processing Units. 3. Analytical Energy Gradients and First Principles Molecular Dynamics, Journal of Chemical Theory and Computation, 5:2619-2628, 2009.”
Electronic documents will include a direct link to the official TeraChem page at http://www.petachem.com.
--ヒロちゃん 2010年3月9日 (火) 17:25 (JST)
この記事へのコメントをお寄せください
- サイトへの書き込みに差し支えございましたら トータルディスクロージャーサイトサポート係へメールをお送りください 。
- トータル・ディスクロージャ・サイトに投稿された文章と画像は、すべてその著作権がHPCシステムズ株式会社に帰属し、HPCシステムズ株式会社が著作権を所有することに同意してください。
- あなたの文章が他人によって自由に編集、配布されることを望まない場合は、投稿を控えてください。
- コメントを書き込む場合は名前にひらがなを織り交ぜてください。
- あなたの投稿する文章と画像はあなた自身によって書かれたものであるか、パブリック・ドメインかそれに類する自由なリソースからの複製であることを約束してください。あなたが著作権を保持していない作品を許諾なしに投稿してはいけません!
