计算化学公社

 找回密码 Forget password
 注册 Register
Views: 11715|回复 Reply: 1
打印 Print 上一主题 Last thread 下一主题 Next thread

[新手求助] molpro环境变量配置

[复制链接 Copy URL]

55

帖子

1

威望

208

eV
积分
283

Level 3 能力者

跳转到指定楼层 Go to specific reply
楼主
请问一下,我看molpro手册上说可以通过更改bin/molpro中的-d -I -W的选项更改默认环境变量,但是我打开molpro文件怎么没有看到这几个选项啊?

我的molpro文件如下:
  1. #!/bin/sh
  2. MOLPRO_PREFIX='/home/hexin/molpro/molprop_2012_1_Linux_x86_64_i8'
  3. exe="${MOLPRO_PREFIX}/bin/molpro.exe"
  4. HOSTFILE_FORMAT="%u %N %n %x %d"
  5. LAUNCHER="${MOLPRO_PREFIX}/parallel.x %x"
  6. envlist="LD_LIBRARY_PATH"
  7. LD_LIBRARY_PATH=":$LD_LIBRARY_PATH"
  8. USER=${USER:-$LOGNAME}
  9. if [ "x`hostname`" != x ] ; then
  10. HOST="`hostname`"
  11. else
  12. # used previously, but sometimes the variables were not set correctly
  13. HOST=${HOST:-${HOSTNAME:-`hostname`}}
  14. HOST="`echo ${HOST} | sed -e 's/\..*//g'`"
  15. fi
  16. AIXTHREAD_SCOPE=${AIXTHREAD_SCOPE:-"s"}
  17. if [ x"$MOLPRO_OPTIONS" != x ] ; then
  18. set -- $MOLPRO_OPTIONS "$@"
  19. MOLPRO_OPTIONS=""
  20. fi
  21. hostfile="${TMPDIR:-/tmp}/procgrp.$"
  22. MOLPRO_OPTIONS_FILE="${TMPDIR:-/tmp}/molpro_options.$"
  23. MOLPRO_NOARG="1"
  24. logfile=1
  25. MP_NODES=${MP_NODES:-0}
  26. MP_PROCS=${MP_PROCS:-1}
  27. if   [ x"$PBS_NODEFILE" != x ] ; then
  28. nodefile="$PBS_NODEFILE" # PBS
  29. elif [ x"$QSUB_NODEINF" != x ] ; then
  30. nodefile="$QSUB_NODEINF" # NQS
  31. elif [ x"$PE_HOSTFILE"  != x ] ; then
  32. nodefile="$PE_HOSTFILE"  # SunGridEngine
  33. elif [ x"$LSB_DJOB_HOSTFILE" != x ]; then
  34. nodefile="$LSB_DJOB_HOSTFILE" # LSF
  35. elif [ x"$LSB_HOSTS" != x ]; then
  36. nodefile="${TMPDIR:-/tmp}/nodefile.$" # Lava
  37. rm -f "${nodefile}"
  38. for h in $LSB_HOSTS ; do echo $h >> "${nodefile}" ; done
  39. else
  40. nodefile=""
  41. fi
  42. nodelist=
  43. NODELIST=
  44. OMP_NUM_THREADS=${OMP_NUM_THREADS:-1}
  45. proc=0
  46. RT_GRQ=${RT_GRQ:-"ON"}
  47. verbose=0
  48. envlist="$envlist AIXTHREAD_SCOPE MOLPRO_PREFIX MP_NODES MP_PROCS \
  49. MP_TASKS_PER_NODE MOLPRO_NOARG MOLPRO_OPTIONS MOLPRO_OPTIONS_FILE \
  50. MPI_MAX_CLUSTER_SIZE PROCGRP RT_GRQ TCGRSH TMPDIR XLSMPOPTS"

  51. if [ "x${machine}" = xXT ] ; then
  52. SHMEM_SWAP_BACKOFF="150"
  53. CRAY_PORTALS_USE_BLOCKING_POLL="yes"
  54. XT_SYMMETRIC_HEAP_SIZE="1G"
  55. envlist="$envlist SHMEM_SWAP_BACKOFF CRAY_PORTALS_USE_BLOCKING_POLL XT_SYMMETRIC_HEAP_SIZE"
  56. fi

  57. molpro_help () {
  58. cat << _EOF_

  59. This help information relates to the shell script only, for details on
  60. options processed by the Molpro executable please refer to the Molpro
  61. manual.

  62. The main purpose of this shell script is to enable launching of the
  63. Molpro executable for parallel execution by setting up the environment,
  64. host files etc. It is possible to run the Molpro executable directly
  65. for serial builds, or launch with mpirun or equivalent for parallel
  66. builds.

  67. -h | --help                : print this help information
  68. --hostfile-format          : override the default hostfile format
  69. --launcher                 : override the default executable launcher
  70. --nodefile                 : override the default location of the node file
  71. -n | --tasks               : specify number of processes
  72. -N | --task-specification  : specify processes, nodes, threads (see Molpro manual for details)
  73. -t | --omp-num-threads     : specify number of openmp threads (if enabled)
  74. --tcgssh                   : for TCGMSG builds, use ssh instead of rsh
  75. -v                         : verbose output (also passed onto the Molpro executable)
  76. -x                         : specify a different Molpro executable to run
  77. *                          : all other options passed on to the main Molpro executable

  78. _EOF_
  79. exit 0
  80. }

  81. while test "x$1" != x ; do
  82. case $1 in
  83.   -h | --help                          ) molpro_help ;;
  84.   --hostfile-format                    ) shift; HOSTFILE_FORMAT="$1" ;;
  85.   --launcher                           ) shift; LAUNCHER="$1" ;;
  86.   --nodefile                           ) shift; nodefile="$1" ;;
  87.   -n | --tasks                         ) shift; nodelist="$1" ;;
  88.   -n*                                  ) nodelist="`echo "$1" | sed -e 's/^-n//g'`" ;;
  89.   -N | --task-specification            ) shift; NODELIST="$1" ;;
  90.   -t | --omp-num-threads               ) shift; OMP_NUM_THREADS="$1" ;;
  91.   --tcgssh                             ) TCGRSH="`which ssh`" ;;
  92.   -v                                   ) verbose=1; MOLPRO_OPTIONS="$MOLPRO_OPTIONS -v";;
  93.   -x                                   ) shift; exe="$1" ;;
  94.   *                                    ) MOLPRO_OPTIONS="$MOLPRO_OPTIONS $1" ;;
  95. esac
  96. shift
  97. done

  98. # add executable directory to PATH for finding mrcc executables
  99. export PATH="`echo ${exe} | sed -e 's/\/[^\/]*$//g'`:${PATH}"

  100. if [ "x$LAUNCHER" = x ] ; then
  101. mode="serial"
  102. if [ "x$verbose" = x1 ] ; then echo " # SERIAL mode"; fi
  103. LAUNCHER="$exe"
  104. else
  105. mode="parallel"
  106. if [ "x$verbose" = x1 ] ; then echo " # PARALLEL mode"; fi

  107. # determine MP_PROCS
  108. MP_PROCS=1
  109. if [ "x$nodelist" != x ] ; then
  110.   MP_PROCS="`echo $nodelist | sed -e 's/\/.*$//g' -e '/:/d'`"
  111.   tasks_per_node="`echo $nodelist | sed -e 's/^.*\///g' -e 's/^[0-9]*$//g' -e 's/:.*$//g'`"
  112.   k="`echo $nodelist | sed -e '/:/!d' -e 's/^.*://g'`"
  113.   if [ "x$verbose" = x1 ] ; then
  114.    echo " nodelist=$nodelist"
  115.    echo " first   =$MP_PROCS"
  116.    echo " second  =$tasks_per_node"
  117.    echo " third   =$k"
  118.   fi
  119.   if [ "x$k" != x ] ; then OMP_NUM_THREADS="$k"; fi
  120. fi
  121. XLSMPOPTS="parthds=$OMP_NUM_THREADS"
  122. if [ "x${tasks_per_node}" = x ] ; then
  123.   LAUNCHER="`echo $LAUNCHER | sed -e 's/ -npernode %p//'`"
  124. else
  125.   MPI_TASKS_PER_NODE="$tasks_per_node"
  126.   MPI_MAX_CLUSTER_SIZE="$tasks_per_node"
  127. fi

  128. # set up & write a hostfile
  129. if [ "x$HOSTFILE_FORMAT" != x ] ; then
  130.   HOSTFILE_FORMAT="`echo $HOSTFILE_FORMAT | sed -e 's/%d/$working_dir/g'`"
  131.   HOSTFILE_FORMAT="`echo $HOSTFILE_FORMAT | sed -e 's/%N/$hostname/g'`"
  132.   HOSTFILE_FORMAT="`echo $HOSTFILE_FORMAT | sed -e 's/%n/1/g'`"
  133.   HOSTFILE_FORMAT="`echo $HOSTFILE_FORMAT | sed -e 's/%u/$user/g'`"
  134.   HOSTFILE_FORMAT="`echo $HOSTFILE_FORMAT | sed -e 's/%x/$exe/g'`"
  135.   if [ "x$verbose" = x1 ] ; then echo " HOSTFILE_FORMAT: $HOSTFILE_FORMAT"; fi

  136.   working_dir="`pwd`"
  137.   rm -f $hostfile
  138.   if [ -r "$nodefile" ] ; then # get nodes from PBS, this should over ride MP_PROCS etc.
  139.    user="$USER"
  140.    nodes_used=0
  141. # some nodefiles contain other columns, assume node is in first column, nprocs in second
  142.    cat $nodefile | while read line; do
  143.     hostname="`echo $line | sed -e 's/ .*$//g'`"
  144.     count="`echo $line | sed -e 's/^[^ ]* *//g' -e 's/ .*$//g'`"
  145.     if [ x"$count" = x ] ; then count=1 ; fi
  146.     while [ $count -gt 0 ]; do
  147.      count=`expr $count - 1`
  148.      nodes_used=`expr $nodes_used + 1`
  149.      if [ "x$nodelist" != x ] ; then
  150.       if [ $nodes_used -le $MP_PROCS ] ; then
  151.        eval echo "$HOSTFILE_FORMAT" >> $hostfile
  152.       fi
  153.      else
  154.       eval echo "$HOSTFILE_FORMAT" >> $hostfile
  155.      fi
  156.     done
  157.    done
  158.    MP_PROCS=`cat "$hostfile" | wc -l`
  159.   elif [ "x$NODELIST" != x ] ; then # get nodes from -N option
  160.    hostname="$HOST"
  161.    user="$USER"
  162.    NODELIST="`echo $NODELIST | sed -e 's/,/ /g'`"
  163.    for i in $NODELIST; do
  164.     eval `echo $i | awk -v RS=: '{if (int($1)==$1) print "count="$1; else print "hostname="$1}'`
  165.     while [ $count -gt 0 ]; do
  166.      count=`expr $count - 1`
  167.      eval echo "$HOSTFILE_FORMAT" >> $hostfile
  168.     done
  169.    done
  170.    MP_PROCS=`cat "$hostfile" | wc -l`
  171.   else # local machine
  172.    hostname="$HOST"
  173.    user="$USER"
  174.    count=$MP_PROCS
  175.    > $hostfile
  176.    while [ $count -gt 0 ]; do
  177.     count=`expr $count - 1`
  178.     eval echo "$HOSTFILE_FORMAT" >> $hostfile
  179.    done
  180.   fi
  181. # should sort hostfile somehow with sort on column with node names
  182.   if [ "x$verbose" = x1 ] ; then echo; cat $hostfile; echo; fi
  183. # below is needed for tcgmsg, but really this should be treated more generally
  184.   PROCGRP="$hostfile"
  185. fi

  186. LAUNCHER="`echo $LAUNCHER | sed -e 's/%x/$exe/g'`"
  187. LAUNCHER="`echo $LAUNCHER | sed -e 's/%h/$hostfile/g'`"
  188. LAUNCHER="`echo $LAUNCHER | sed -e 's/%n/$MP_PROCS/g'`"
  189. LAUNCHER="`echo $LAUNCHER | sed -e 's/%p/$tasks_per_node/g'`"
  190. for i in $envlist ; do
  191.   eval j="$"$i
  192.   if [ "x${j}" != x ] ; then LAUNCHER="`echo $LAUNCHER | sed -e 's/%e/'$i='


  193. $i' %e/g'`"; fi
  194. done
  195. LAUNCHER="`echo $LAUNCHER | sed -e 's/%e//g'`"

  196. fi

  197. for i in $envlist ; do
  198. eval j="$"$i
  199. if [ "x${j}" != x ] ; then
  200.   export $i
  201.   if [ "x$verbose" = x1 ] ; then echo " export $i='${j}'" ; fi
  202. else
  203.   if [ "x$verbose" = x1 ] ; then echo "        $i='${j}'" ; fi
  204. fi
  205. done

  206. if [ "x${OMP_NUM_THREADS}" != x1 ] ; then
  207. MOLPRO_OPTIONS="${MOLPRO_OPTIONS} -t ${OMP_NUM_THREADS}"
  208. fi

  209. LAUNCHER="`eval echo $LAUNCHER` $MOLPRO_OPTIONS"
  210. if [ "x$verbose" = x1 ] ; then echo "$LAUNCHER" ; fi
  211. if [ "x$mode" = xserial ] ; then
  212. exec $LAUNCHER
  213. else
  214. echo "${MOLPRO_OPTIONS}" > ${MOLPRO_OPTIONS_FILE}
  215. if [ x"`uname -s`" = xDarwin ] ; then
  216.   tt=`lsof -p $|egrep ' 0u *CHR'| sed -e 's/^.*  *//'|grep '/dev/tty'`
  217.   if [ x"$tt" = x ] ; then
  218.    eval $LAUNCHER
  219.    rc=$?
  220.   else
  221.    eval $LAUNCHER </dev/null
  222.    rc=$?
  223.   fi
  224. else
  225.   eval $LAUNCHER
  226.   rc=$?
  227. fi
  228. fi

  229. if [ "x${LSB_HOSTS}" != x ] && [ "x${LSB_DJOB_HOSTFILE}" = x ]; then rm -f "${nodefile}" ; fi
  230. rm -f ${hostfile} ${MOLPRO_OPTIONS_FILE}
  231. exit ${rc}
复制代码



55

帖子

1

威望

208

eV
积分
283

Level 3 能力者

2#
 楼主 Author| 发表于 Post on 2015-1-30 18:34:58 | 只看该作者 Only view this author
molpro安装求助

本版积分规则 Credits rule

手机版 Mobile version|北京科音自然科学研究中心 Beijing Kein Research Center for Natural Sciences|京公网安备 11010502035419号|计算化学公社 — 北京科音旗下高水平计算化学交流论坛 ( 京ICP备14038949号-1 )|网站地图

GMT+8, 2025-8-12 21:17 , Processed in 0.177179 second(s), 21 queries , Gzip On.

快速回复 返回顶部 返回列表 Return to list