Parallel Gaussian, util.so and LD LIBRARY PATH

From Research Computing

This is a note on a problem G03+linda7.1 has with certain environment variable configurations. The default vanilla .bashrc invokes /etc/profile. Environment variables for all users are set in /etc/profile and in /etc/profile.d/global.sh (for the bash shell). However, even if one sources the environment variables /usr/local/gaussian/g03/bsd/g03.profile in either of these locations, parallel gaussian (g03 or g98) will be unable to find util.so. As I wrote this, I checked that indeed, /etc/profile.d/global.sh contained the lines one would expect:

export g03root=/usr/local/gaussian
 
if [ -f $g03root/g03/bsd/g03.profile ]; then
        . $g03root/g03/bsd/g03.profile
fi

Among other things, these lines set LD_LIBRARY_PATH so that parallel gaussian can find util.so. However, the variable is not set when linda launches remote shells for worker tasks (these are non-interactive shells); in SGE, these tasks will appear as SLAVE jobs.

My fix was to modify the file

/usr/local/gaussian/g03/linda7.1/intel-linux2.4/bin/linda_rsh

by setting the LD_LIBRARY_PATH environment variable to the path containing the shared library util.so (curiously missing the lib prefix), as shown below.

  *)   case "$rsh_arg" in
         on) exec /usr/bin/on -n $host "$@"
             ;;
         ssh) exec /usr/bin/ssh -x $host $user -n "$@"
             ;;
         *)  exec /usr/bin/rsh $host $user -n \
            "export LD_LIBRARY_PATH=/usr/local/gaussian/g03:$LD_LIBRARY_PATH;$@"
             ;;
       esac

This leads to a more general question of system design: Why LD_LIBRARY_PATH is bad (http://www.visi.com/~barr/ldpath.html) discusses the case against the use of the deprecated variable LD_LIBRARY_PATH in Solaris (http://www.sun.com/software/solaris/) and, by extension, to Linux (http://www.linux.org). In this article, David Barr (http://www.visi.com/~barr/), a systems administrator for Google (http://www.google.com), makes an observation that happens to apply to Gaussian's (http://www.gaussian.com) use of LD_LIBRARY_PATH:

"Often programs (even commercial ones) are compiled without any run-time
 loader paths at all, forcing you to have LD_LIBRARY_PATH set or else the
 program won't run."