最近本人在同一台CentOS 6.8 的系统上面安装了Intel的编译器,安装的版本为2015.0.090 环境变量设置如下:
#intel
source /opt/intel/bin/compilervars.sh intel64
同时安装了Gaussian 09 量化计算软件,环境变量设置如下:
#Gaussian 09
export g09root=/home/shims/install
export GAUSS_SCRDIR=${g09root}/g09/scratch
source ${g09root}/g09/bsd/g09.profile
如果按照以上的设置的话可执行文件是没有问题的icc、ifor、g09都能找到
[shims@cluster bsd]$ which icc
/opt/intel/composer_xe_2015.0.090/bin/intel64/icc
[shims@cluster bsd]$ which ifort
/opt/intel/composer_xe_2015.0.090/bin/intel64/ifort
[shims@cluster bsd]$ which g09
~/install/g09/g09
不过查看库文件的关联信息会发下intel相关的没有加入进入
[shims@cluster bsd]$ echo $LD_LIBRARY_PATH
/home/shims/install/fftw/lib:/home/shims/install/g09/bsd:/home/shims/install/g09/private:/home/shims/install/g09
如果我们注释掉gaussian09 相关的环境变量设置的话就可以找到intel相关的库文件路径
#Gaussian 09
#export g09root=/home/shims/install
#export GAUSS_SCRDIR=${g09root}/g09/scratch
#source ${g09root}/g09/bsd/g09.profile
注释掉之后需要注意的是,在本人的这台机子上面会存在通过source ~/.bashrc命令更新环境变量之后会存在通过which g09依然能查到相关的路径,我们可以退出当前登陆再进入就会发现找不到相关的命令所在文件路径。
[shims@cluster ~]$ which g09
而这个时候我们查看库文件路径可以发现intel的库路径出现了
[shims@cluster ~]$ echo $LD_LIBRARY_PATH
根据个人对intel和gaussian的两个文件/opt/intel/bin/compilervars.sh和${g09root}/g09/bsd/g09.profile来看可能存在的问题是都定义了参数LD_LIBRARY_PATH,我们知道当同一个变量两次赋值的话后赋值的会覆盖前一次的赋值,所以我们需要更改的是g09.profile 文件中的LD_LIBRARY_PATH=$GAUSS_EXEDIR给注释掉同时将最后一行的export中的LD_LIBRARY_PATH删除就可以了,而在~/.bashrc中设置环境变量的时候将gaussian 09 改为如下:
#Gaussian 09
export g09root=/home/shims/install
export GAUSS_SCRDIR=${g09root}/g09/scratch
source ${g09root}/g09/bsd/g09.profile
export LD_LIBRARY_PATH=${g09root}/g09:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${g09root}/g09/bsd:$LD_LIBRARY_PATH
通过以上的方式处理的话基本上就解决了环境变量设置冲突的问题。
[shims@cluster 1]$ echo $LD_LIBRARY_PATH
下面是我提供的~/.bashrc文件和g09.profile文件
~/.bashrc
#intel
source /opt/intel/bin/compilervars.sh intel64
#Gaussian 09
export g09root=/home/shims/install
export GAUSS_SCRDIR=${g09root}/g09/scratch
source ${g09root}/g09/bsd/g09.profile
#GAUSS_EXEDIR="${g09root}/g09/bsd:${g09root}/g09/private:${g09root}/g09"
export LD_LIBRARY_PATH=${g09root}/g09:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${g09root}/g09/bsd:$LD_LIBRARY_PATH
vi install/g09/bsd/g09.profile
#
# These commands set up for use of Gaussian 09. They should be source'd
# into each Gaussian 09 user's .login file, after setting the following
# environment variable:
#
# g09root -- Directory which contains the g09 main directory. Defaults
# to users's home directory if not defined before entry.
#
# Top directories for the program:
#
gr=$HOME
if [ "$g09root" ]
then gr=$g09root
fi
GAUSS_EXEDIR="$gr/g09/bsd:$gr/g09/private:$gr/g09"
GAUSS_ARCHDIR="$gr/g09/arch"
GMAIN=$GAUSS_EXEDIR
PATH=$PATH:$GAUSS_EXEDIR
#LD_LIBRARY_PATH=$GAUSS_EXEDIR
G09BASIS="$gr/g09/basis"
F_ERROPT1="271,271,2,1,2,2,2,2"
#following for sgi debugging
#TRAP_FPE="DEBUG;OVERFL=ABORT;DIVZERO=ABORT;INVALID=ABORT;INT_OVERFL=ABORT"
TRAP_FPE="OVERFL=ABORT;DIVZERO=ABORT;INT_OVERFL=ABORT"
MP_STACK_OVERFLOW="OFF"
# to partially avoid KAI stupidity
KMP_DUPLICATE_LIB_OK="TRUE"
#export GAUSS_EXEDIR GAUSS_ARCHDIR PATH GMAIN LD_LIBRARY_PATH F_ERROPT1 TRAP_FPE MP_STACK_OVERFLOW \
# KMP_DUPLICATE_LIB_OK G09BASIS
export GAUSS_EXEDIR GAUSS_ARCHDIR PATH GMAIN F_ERROPT1 TRAP_FPE MP_STACK_OVERFLOW KMP_DUPLICATE_LIB_OK G09BASIS