I wrote charmm 37 installation into GPU machine in Japanese. Installation was almost succeeded with some warning. But it's not completely work executable file such as PARAllel statement warning.
I can write and read easy English also. If you have any question, please feel free to let me know.
分子動力学計算ソフトウェアCharmmを使用しているのですが、新しいバージョン37からGPU機能が加わりました。そこでインストールを試みたのですがエラーが多発しうまくいきませんでしたので、ソースコードやMakefileをいじったりして何とかコンパイルまで通るようにはなりました。ただ、計算は出来なかったのでまだ何らかの不具合が残っているのかと思われますが、とりあえず記録にだけでも残しておくとなにかの役に立つかもしれないと思い、以下にその経緯をまとめました。
charmmの公式マニュアルにインストール方法が記されています。
http://www.charmm.org/documentation/c37b1/gpu.html# Installation
ただし、私の使っている環境ではうまくいきませんでした。ちなみに、OSはFedora 13 64bit版です(uname -a -> 2.6.34.9-69.fc13.x86_64)。
c37b1.tar.gzを解凍して/usr/localに展開
tar xzvf c37b1.tar.gz mv c37b1 /usr/local/c37b1_GPU
インストール
./install.com gpu xxlarge
install.com> Directory /usr/local/c37b1_GPU/build/gpu does not exist. Creating /usr/local/c37b1_GPU/build/gpu ... install.com> Phase 1 completed. install.com> The preprocessor prefx_gpu installed. install.com> Phase 2 completed. install.com> Processing CHARMM source on gpu... Finished compiling CHARMM/CUDA interface library. More info in /usr/local/c37b1_GPU/build/gpu/gpu.log There is some problem compiling/running CUDA code for CHARMM make sure you can run CUDA programs and have proper CUDA environment see /usr/local/c37b1_GPU/build/gpu/gpu.log for details
そこで、build/gpu/gpu.logを見ると、md_mother.cuのコンパイルでエラーが発生している事がわかったので、findで場所を調べてみると、tool/gpu/rs/にあることがわかりました。
そこで直接makeしてみます。
[root@localhost rs]# make gcc -O -ffast-math -DCUDA_SDK_2 -o emutestvg emutest.c libmd3withg80vg.a -L/usr/local/cuda/lib64 -lcudart -lGLU -lGL -lm /usr/bin/ld: libmd3withg80vg.a(vtgrape.o): undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' /usr/bin/ld: note: 'pthread_create@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line /lib64/libpthread.so.0: could not read symbols: Invalid operation collect2: ld returned 1 exit status make: *** [emutestvg] Error 1
止まりました。libpthread関係のエラーでしょうか。調べてみると、情報がありました。
http://www.linuxforums.org/forum/coffee-lounge/175945-undefined-reference-symbol-pthread_key_delete-glibc_2-2-5-a.html
どうやら、-L/lib64と-lpthreadをコンパイル時にいれればOKのようです。tool/gpu/rs/Makefileの49行目のCFLAGSにこれを追記して再びmake。
[root@localhost rs]# make gcc -O -ffast-math -L/lib64 -lpthread -DCUDA_SDK_2 -o emutestvg emutest.c libmd3withg80vg.a -L/usr/local/cuda/lib64 -lcudart -lGLU -lGL -lm /usr/bin/ld: libmd3withg80vg.a(md_mother.o): undefined reference to symbol '__gxx_personality_v0@@CXXABI_1.3' /usr/bin/ld: note: '__gxx_personality_v0@@CXXABI_1.3' is defined in DSO /usr/lib64/libstdc++.so.6 so try adding it to the linker command line /usr/lib64/libstdc++.so.6: could not read symbols: Invalid operation collect2: ld returned 1 exit status make: *** [emutestvg] Error 1
こんどはlibstdc++関係のエラーです。調べてみると、ありました。
http://stackoverflow.com/questions/329059/what-is-gxx-personality-v0-for
- lstdc++を追記する必要がありそうです。同じCFLAGSに追記しました。
[root@localhost rs]# make gcc -O -ffast-math -L/lib64 -lpthread -lstdc++ -DCUDA_SDK_2 -o emutestvg emutest.c libmd3withg80vg.a -L/usr/local/cuda/lib64 -lcudart -lGLU -lGL -lm gfortran -O -ffast-math -o sample_md3vg sample_md3.f libmd3withg80vg.a -L/usr/local/cuda/lib64 -lcudart -lGLU -lGL -lm sample_md3.f:1480.72: if(jstack.gt.NSTACK)pause 'NSTACK too small in indexx' 1 Warning: Deleted feature: PAUSE statement at (1) /usr/bin/ld: libmd3withg80vg.a(vtgrape.o): undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' /usr/bin/ld: note: 'pthread_create@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line /lib64/libpthread.so.0: could not read symbols: Invalid operation collect2: ld returned 1 exit status make: *** [sample_md3vg] Error 1
今度はgfortranコマンドでエラーです。しかも、ソースコードのエラーを示してみます。調べてみると、fortranのpauseはバージョン95では廃止されているととのこと。試しにpauseをstopに変えてやってみます。
sample_md3.fの1480行目
c if(jstack.gt.NSTACK)pause 'NSTACK too small in indexx' if(jstack.gt.NSTACK) stop
makeする。
[root@localhost rs]# make clean # コンパイル済みファイルを一旦消去 [root@localhost rs]# make gfortran -O -ffast-math -o sample_md3vg sample_md3.f libmd3withg80vg.a -L/usr/local/cuda/lib64 -lcudart -lGLU -lGL -lm /usr/bin/ld: libmd3withg80vg.a(vtgrape.o): undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' /usr/bin/ld: note: 'pthread_create@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line /lib64/libpthread.so.0: could not read symbols: Invalid operation collect2: ld returned 1 exit status make: *** [sample_md3vg] Error 1
gfortranでもpthreadのエラーです。MakefileのFFLAGSに-L/lib64と-lpthreadを追記してmake。
Makefile 48行目付近
CFLAGS = $(CFLAGSCORE) -L/lib64 -lpthread -lstdc++ CFLAGS += $(CUDA_SDK2) FFLAGS = $(CFLAGSCORE) -L/lib64 -lpthread -lstdc++
コンパイル通りました。試しにmake cleanして再make。warningが大量にでてきたけど、一応通る。
今度はtool/gpu/pmeで。
cd /usr/local/c37b1_GPU/tool/gpu/pme make ###### 長いエラーメッセージ gfortran forttest.f90 libmd3withg80s.a -L/usr/local/cuda//lib64 -lcuda -lcudart -lGL -lGLU -lm -lcufft -o gputest /usr/bin/ld: libmd3withg80s.a(gpupme_mother.o): undefined reference to symbol '__gxx_personality_v0@@CXXABI_1.3' /usr/bin/ld: note: '__gxx_personality_v0@@CXXABI_1.3' is defined in DSO /usr/lib64/libstdc++.so.6 so try adding it to the linker command line /usr/lib64/libstdc++.so.6: could not read symbols: Invalid operation collect2: ld returned 1 exit status make: *** [gputest] Error 1
またまた似たようなエラーが。Makefileを修正します。
Makefile 105行目付近
FC = gfortran -L/lib64 -lpthread -lstdc++
Makefile 110行目付近
CFLAGS = $(OPTFLAGS) -L/lib64 -lpthread -lstdc++
make clean # コンパイル済みファイルを一旦消去 make
またWarningがたくさん出るけど一応通る。
再び、install.comを実行。
cd /usr/local/c37b1_GPU ./install.com gpu xxlarge
5分ほど待った後にエラー発生。build/gpu/gpu.logを見ると、どうやら最後のコンパイルでエラーが発生している様子。
/usr/bin/ld: /usr/local/c37b1_GPU/tool/gpu/gcc/libmd3withg80vg.a(vtgrape.o): undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' /usr/bin/ld: note: 'pthread_create@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line /lib64/libpthread.so.0: could not read symbols: Invalid operation collect2: ld returned 1 exit status make: *** [/usr/local/c37b1_GPU/exec/gpu/charmm] Error 1
エラーの内容はpthread。直接buildフォルダ中のMakefileを書き変えて再コンパイルを試みる。
vi build/gpu/Makefile ./install.com gpu xxlarge
GLIB = -L/lib64 -lpthread -lstdc++
しかしエラー。build/gpu/Makefileを見てみると元に戻ってしまっていることに気付く。毎回どこかで自動生成されているらしい。
install.com 2131付近
# # prepare the host platform dependent Makefile # 08-AUG-92, Always re-generate Makefile, ydw. sed -e "/^ROOT =/s@rootdir@$chmroot@" $chmbuild/Makefile_$chm_host > Makefile_$$ #
ここら辺が怪しい。platform別で書き変えてるみたい。build/UNXフォルダを見たら、Makefile_gpuがあったのでこれかと思い、書き換える。
GLIB = -L/lib64 -lpthread -lstdc++
再コンパイル。
./install.com gpu xxlarge [root@localhost c37b1_GPU]# ./install.com gpu xxlarge Mon Feb 4 12:31:19 JST 2013 reading module declarations Updating /usr/local/c37b1_GPU/build/gpu/Makefile_gpu install.com> Phase 1 completed. install.com> pref.dat already exists and contains the following preprocessor directives. ###### 長いメッセージ ########## install.com> The existing pref.dat will be used in this installation. install.com> Phase 2 completed. install.com> Processing CHARMM source on gpu... Finished compiling CHARMM/CUDA interface library. More info in /usr/local/c37b1_GPU/build/gpu/gpu.log install.com> CHARMM Installation is completed. The CHARMM executable is /usr/local/c37b1_GPU/exec/gpu/charmm. install.com> Phase 3 completed. Mon Feb 4 12:31:23 JST 2013
行けたようです。実行ファイルはexec/gpu/charmmです。
root@localhost c37b1_GPU]# exec/gpu/charmm 1 Chemistry at HARvard Macromolecular Mechanics (CHARMM) - Developmental Version 37b1 September 30, 2012 Copyright(c) 1984-2001 President and Fellows of Harvard College All Rights Reserved Current operating system: Linux-2.6.34.9-69.fc13.x86_64(x86_64)@localhost Created on 2/4/13 at 12:39:02 by user: guest Maximum number of ATOMS: 360720, and RESidues: 120240
ただし、マニュアル( http://www.charmm.org/documentation/c37b1/gpu.html# Parallel )に書いてあるようなPARAllelコマンドが使えませんでした。使い方が悪いのかインストールが悪いのかわかりません。