NERSCPowering Scientific Discovery Since 1974

Resolved -- Incorrect path with bash under csh

July 1, 2011 by Helen He (0 Comments)

Symptom:

With default csh or tcsh shell, entering bash (as login or non-login) messes up the path, causing qsub or ftn command either not found or uses wrong path.  Unloadind and loading the PrgEnv-xxx module again may partially address the problem.

For example:

Under csh:
% echo $PATH
/usr/common/usgbin:...
% which qsub
/usr/common/nsg/bin/qsub
% which ftn
/opt/cray/xt-asyncpe/4.7/bin/ftn

Now enter bash:
% bash
..
% which qsub
/opt/torque/2.4.8-201004261413/bin/qsub
% which ftn
no ftn in ...
% module unload PrgEnv-pgi
% module load PrgEnv-pgi
% which qsub
/opt/torque/2.4.8-201004261413/bin/qsub
% which ftn
/opt/cray/xt-asyncpe/4.7/bin/ftn
% exit

Now enter bsh as a login shell:
% bash -l
% which qsub
/usr/common/nsg/bin/qsub
% which ftn
no ftn in ..
% module unload PrgEnv-pgi
% module load PrgEnv-pgi
% which qsub
/usr/common/nsg/bin/qsub
% which ftn
/opt/cray/xt-asyncpe/4.7/bin/ftn
% exit

There are similar problems for using #!/bin/bash in your batch script if your default shell is csh/tcsh. 

For a csh/tcsh user, running the following batch script generates error about
"module command not found" due to the module command in not in the default path.

#!/bin/bash
#PBS -l mppwidth=4
#PBS -l walltime=8:00
#PBS -V
cd $PBS_O_WORKDIR
module list

While the following script runs well:

#PBS -S /bin/bash
#PBS -l mppwidth=4
#PBS -l walltime=8:00
#PBS -V
cd $PBS_O_WORKDIR
module list

Workaround

Change your default shell to bash from NIM interface to use bash directly.  Avoid invoking bash under csh/tcsh.

For batch script, use"#PBS -S /bin/bash" instead of "#!/bin/bash"

Status:

This bug has been resolved as of 9/14/2011.

 

 


Post your comment

You cannot post comments until you have logged in. Login Here.

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments