PGI Compiler の install

Debian unstable の計算機に PGI のコンパイラを入れた時のメモ*1.

マニュアル通りの install で基本的には良いのだけれども,makelocalrc で glibc のバージョンをチェックする所に修正が必要.

配布されている makelocalrc の get_glibc_version() では

if test $? -ne 0; then
   x=`strings $LIBC | grep 'GNU C Library' | cut -d, -f1 | awk '{print $7}'`
else
   x=`strings $LIBC | grep 'GNU C Library' | cut -d, -f1 | awk '{print $8}'`
fi

となっているのだけれど, そのままだと

% strings /lib64/libc.so.6 | grep 'GNU C Library' | cut -d, -f1
GNU C Library (Debian EGLIBC 2.11.1-3) stable release version 2.11.1

となる. なので

if test $? -ne 0; then
   x=`strings $LIBC | grep 'GNU C Library' | cut -d, -f1 | awk '{print $NF}'`
else
   x=`strings $LIBC | grep 'GNU C Library' | cut -d, -f1 | awk '{print $NF}'`
fi

と修正して

% sudo makelocalrc -x /opt/pgi/linux86-64/10.5 

とすると良い.

ついでに環境変数の設定. .zshenv or .zshrc あたりに

 if [ -d /opt/pgi/linux86-64 ]; then
     export PGI=/opt/pgi
     export PATH=${PGI}/linux86-64/2010/bin:${PATH}
     export MANPATH=${MANPATH}:${PGI}/linux86-64/2010/man
     export LM_LICENSE_FILE=${PGI}/license.dat
     MY_MPICH_PGI=${PGI}/linux86-64/2010/mpi/mpich/bin
     load_PGI_MPICH(){
         export PATH=${MY_MPICH_PGI}:${PATH}
     }
     unload_PGI_MPICH(){
         export PATH=${PATH#${MY_MPICH_PGI}:}
     }
 fi

とでも書いておくことにする.MY_MPICH_PGI なんかは PGI に同梱されている mpich の load/unload 用.

*1: 多分 Ubuntu 10.04 とかでもそうなんじゃないかな, とか思ったり