Index: palm/trunk/SCRIPTS/mbuild
===================================================================
--- palm/trunk/SCRIPTS/mbuild	(revision 492)
+++ palm/trunk/SCRIPTS/mbuild	(revision 493)
@@ -113,4 +113,7 @@
      #                    removed, t3e related parts removed
      # 26/02/10 - BjornM- re-adjustments for lcxt4 (new modules)
+     # 01/03/10 - Siggi - mpilib replaced by modules: explicit module settings
+     #                    removed; modules should now be given in the
+     #                    configuration file
 
 
@@ -124,4 +127,5 @@
  locat=normal
  makefile=""
+ module_calls=""
  scirocco=false
  silent=false
@@ -460,4 +464,5 @@
     fi
 
+    modules=""
     netcdf_inc=""
     netcdf_lib=""
@@ -798,8 +803,7 @@
 
 
-       # MPI LIBRARY ERMITTELN
+       # get modules to be load
     line=""
-    found=false
-    grep  "$remote_host_string" $config_file | grep "%mpilib"  >  $tmp_mbuild
+    grep  "$remote_host_string" $config_file | grep "%modules"  >  $tmp_mbuild
     while read line1
     do
@@ -813,11 +817,8 @@
        then
              # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN
-          mpilib=`echo $line | cut -d" " -s -f2`
-          found=true
+          modules=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'`
        fi
 
     done < $tmp_mbuild
-
-    [[ $found = false ]]  &&  mpilib=mpt
 
 
@@ -918,9 +919,4 @@
        line=$(echo "$line" | cut -c51-)
     done
-    if [[ $( echo $remote_host | cut -c1-5 ) = lcsgi ]]
-    then
-       column1="mpi library:"; column2=$mpilib
-       printf "| $column1$column2 | \n"
-    fi
     column1="loader options:"; column2=$loader_options
     printf "| $column1$column2 | \n"
@@ -933,4 +929,17 @@
        line=$(echo "$line" | cut -c51-)
     done
+    if [[ $modules != "" ]]
+    then
+       column1="modules to be load:"; column2=$modules
+       printf "| $column1$column2 | \n"
+       line=$(echo "$modules" | cut -c51-)
+       while [[ "$line" != "" ]]
+       do
+          column1=""
+          column2=$line
+          printf "| $column1$column2 | \n"
+          line=$(echo "$line" | cut -c51-)
+       done
+    fi
     printf "#------------------------------------------------------------------------# \n"
 
@@ -1020,4 +1029,6 @@
           echo "  *** execute \"make\" on remote host"
 
+
+             # generate make call with make options
           if [[ $remote_host = nech ]]
           then
@@ -1027,20 +1038,24 @@
           fi
 
+             # generate command to load modules, if modules are given
+          if [[ "$modules" != "" ]]
+          then
+             module_calls="module load ${modules};"
+          fi
+
           if [[ $remote_host = ibms  ||  $remote_host = ibmy ]]
           then
 
-             ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; echo '$make_call_string' > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" 2>&1 | tee ${remote_host}_last_make_protokoll
+             ssh  ${remote_username}@${remote_addres}  "$module_calls cd ${remote_md}; echo '$make_call_string' > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" 2>&1 | tee ${remote_host}_last_make_protokoll
 
           elif [[ $remote_host = ibmh ]]
           then
 
-             print "export OBJECT_MODE=64; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
+             print "$module_calls export OBJECT_MODE=64; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
 
           elif [[ $remote_host = lcsgib  ||  $remote_host = lcsgih ]]
           then
 
-             print ". /usr/share/modules/init/bash; module load ifort/11.0.069; module load $mpilib; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
-#             print ". /usr/share/modules/init/bash; module load mvapich2/1.2rc1-intel; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
-#             print ". /usr/share/modules/init/bash; module load mvapich2; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
+             print ". /usr/share/modules/init/bash; $module_calls  cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
 
           elif [[ $remote_host = lctit ]]
@@ -1056,9 +1071,9 @@
           then
 
-             print ". /opt/modules/default/init/ksh; module load Base-opts; module load modules; module load pmi; module load pgi; module load PrgEnv-pgi; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
+             print ". /opt/modules/default/init/ksh; $module_calls  cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
 
           else
 
-             print "cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
+             print "cd $module_calls ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
 
           fi
@@ -1171,13 +1186,19 @@
           fi
 
+             # generate command to load modules, if modules are given
+          if [[ "$modules" != "" ]]
+          then
+             module_calls="module load ${modules};"
+          fi
+
           if [[ $remote_host = ibms  ||  $remote_host = ibmy ]]
           then
 
-             ssh  ${remote_username}@${remote_addres}  "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR"
+             ssh  ${remote_username}@${remote_addres}  "$module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR"
 
           elif [[ $remote_host = ibmh ]]
           then
 
-             print "export OBJECT_MODE=64; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres}
+             print "$module_calls export OBJECT_MODE=64; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres}
 
           elif [[ $remote_host = lctit ]]
@@ -1187,5 +1208,5 @@
              while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]]
              do
-                print "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
+                print "$module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
              done
 
@@ -1193,9 +1214,9 @@
           then
 
-             print ". /opt/modules/default/init/ksh; module load Base-opts; module load modules; module load pmi; module load pgi; module load PrgEnv-pgi; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
+             print ". /opt/modules/default/init/ksh; $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
 
           else
 
-             print "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
+             print "$module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
 
           fi
@@ -1238,4 +1259,10 @@
           echo " "
           echo "  *** execute \"make\" on local host"
+
+             # first load modules, if given
+          if [[ "$modules" != "" ]]
+          then
+             module load ${modules}
+          fi
 
           make  $make_options  PROG=$mainprog  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$loader_options"  2>&1 | tee ${remote_host}_last_make_protokoll
Index: palm/trunk/SCRIPTS/mrun
===================================================================
--- palm/trunk/SCRIPTS/mrun	(revision 492)
+++ palm/trunk/SCRIPTS/mrun	(revision 493)
@@ -198,4 +198,6 @@
      # 03/02/10 - Siggi  - make options (mopts) to be set by configuration file
      #                     implemented
+     # 08/02/10 - Siggi  - loading of modules now controlled via configuration
+     #                     file (modules)
 
 
@@ -261,5 +263,5 @@
     mc=`echo $mc | cut -f2- -d"/"`
  done
- module_files=""
+ module_calls=""
  mrun_script_name=$mc
  netcdf_inc=""
@@ -2072,8 +2074,21 @@
 
 
+    # set module load command and export for subjob
+ if [[ "$modules" != "" ]]
+ then
+    export module_calls="module load ${modules};"
+ fi
+
+
     # SET DEFAULT VALUE FOR MPI MODULE TO BE USED ON SGI-ALTIX
  if [[ $host = lcsgib  ||  $host = lcsgih ]]
  then
-    [[ "$mpilib" = "" ]]  &&  export mpilib=mpt
+    if [[ $(echo $modules | grep -c mpt ) != 0 ]]
+    then
+       mpilib=mpt
+    elif [[ $(echo $modules | grep -c mvapich ) != 0 ]]
+    then
+       mpilib=mvapich
+    fi
  fi
 
@@ -2125,5 +2140,5 @@
     if [[ "$mopts" != "" ]]
     then
-       spalte1=make-options:; spalte2=$mopts
+       spalte1="make options:"; spalte2=$mopts
        printf "| $spalte1$spalte2 | \n"
        zeile=$(echo "$mopts" | cut -c41-)
@@ -2137,5 +2152,5 @@
     fi
 
-    spalte1=cpp-directives:; spalte2=$cpp_options
+    spalte1="cpp directives:"; spalte2=$cpp_options
     printf "| $spalte1$spalte2 | \n"
     zeile=$(echo "$cpp_options" | cut -c41-)
@@ -2148,5 +2163,5 @@
     done
 
-    spalte1=compiler-options:; spalte2="$fopts"
+    spalte1="compiler options:"; spalte2="$fopts"
     printf "| $spalte1$spalte2 | \n"
     zeile=$(echo "$fopts" | cut -c41-)
@@ -2159,7 +2174,18 @@
     done
 
-    spalte1=linker-options:; spalte2=$lopts
+    spalte1="linker options:"; spalte2=$lopts
     printf "| $spalte1$spalte2 | \n"
     zeile=$(echo "$lopts" | cut -c41-)
+    while [[ "$zeile" != "" ]]
+    do
+       spalte1=""
+       spalte2=$zeile
+       printf "| $spalte1$spalte2 | \n"
+       zeile=$(echo "$zeile" | cut -c41-)
+    done
+
+    spalte1="modules to be load:"; spalte2=$modules
+    printf "| $spalte1$spalte2 | \n"
+    zeile=$(echo "$modules" | cut -c41-)
     while [[ "$zeile" != "" ]]
     do
@@ -2300,4 +2326,11 @@
     tmpcreate=true
 
+       # set striping on lustre file system
+#    if [[ $localhost = lcsgih ]]
+#    then
+#       lfs setstripe -s 8192k -c 16  $TEMPDIR
+#       lfs getstripe $TEMPDIR
+#    fi
+
 
        # SAEMTLICHE QUELLTEXT-DATEIEN BZW. AUSFUEHRBARES PROGRAMM IN 
@@ -2430,11 +2463,15 @@
        printf "      compilername:             $compiler_name\n"
        printf "      compiler options:         $fopts\n"
-       printf "      preprocessor-directives:  $cpp_options \n"
-       printf "      linker-options:           $lopts \n"
+       printf "      preprocessor directives:  $cpp_options \n"
+       printf "      linker options:           $lopts \n"
+       if [[ "$modules" != "" ]]
+       then
+          printf "      modules to be load:       $modules \n"
+       fi
        printf "      source code files:        $source_list \n"
 
        if [[ $localhost = nech ]]
        then
-          ssh  136.172.44.192 -l $usern ". /SX/opt/etc/initsx.sh; cd \$HOME/work/${usern}.$kennung; sxmake $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
+          ssh  136.172.44.192 -l $usern ". /SX/opt/etc/initsx.sh; $module_calls cd \$HOME/work/${usern}.$kennung; sxmake $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
           cp  $TEMPDIR_COMPILE/a.out  .
           [[ $? != 0 ]]  &&  compile_error=true
@@ -2443,21 +2480,22 @@
        then
           printf "      compiler is called via ssh on \"plogin1\" \n"
-          ssh  plogin1  -l $usern  "export PATH=/sw/ibm/xlf/12.1.0.3/usr/bin:$PATH; cd $TEMPDIR; make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
+          ssh  plogin1  -l $usern  "export PATH=/sw/ibm/xlf/12.1.0.3/usr/bin:$PATH; $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
           [[ ! -f a.out ]]  &&  compile_error=true
           continue   # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN
        elif [[ $localhost = lcsgib ]]
        then
-          printf "      compiler is called via ssh on \"bicegate\" using module \"$mpilib\" \n"
-          ssh  130.73.232.103  -l $usern  ". /usr/share/modules/init/bash; module load ifort/11.0.069; module load $mpilib; cd $TEMPDIR; make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
+          printf "      compiler is called via ssh on \"bicegate\" \n"
+          ssh  130.73.232.103  -l $usern  ". /usr/share/modules/init/bash; $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
           [[ ! -f a.out ]]  &&  compile_error=true
           continue   # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN
        elif [[ $localhost = lcsgih ]]
        then
-          printf "      compiler is called via ssh on \"hicegate2\" using module \"$mpilib\" \n"
-          ssh  130.75.4.103    -l $usern  ". /usr/share/modules/init/bash; module load ifort/11.0.069; module load $mpilib; cd $TEMPDIR; make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" 2>&1 "
+          printf "      compiler is called via ssh on \"hicegate2\" \n"
+          ssh  130.75.4.103    -l $usern  ". /usr/share/modules/init/bash; $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" 2>&1 "
           [[ ! -f a.out ]]  &&  compile_error=true
           continue   # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN
        else
           [[ $localhost = lctit ]]  &&  export LM_LICENSE_FILE=27050@tggls
+          [[ "$module_calls" != "" ]]  &&  eval $module_calls
           make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$fopts"  LDFLAGS="$lopts"
        fi
Index: palm/trunk/SCRIPTS/subjob
===================================================================
--- palm/trunk/SCRIPTS/subjob	(revision 492)
+++ palm/trunk/SCRIPTS/subjob	(revision 493)
@@ -115,4 +115,7 @@
      # 26/02/10 - BjornM- re-adjustments for lcxt4 (new modules, email
      #                    notification)
+     # 01/03/10 - Siggi - loading of modules controlled by environment variable
+     #                    module_calls
+
 
 
@@ -815,7 +818,5 @@
 
 . /usr/share/modules/init/bash
-module load ifort/11.0.069
-module load $mpilib
-module load netcdf
+$module_calls
 
 echo ld_library_path=\$LD_LIBRARY_PATH
@@ -835,6 +836,5 @@
 
 . /usr/share/modules/init/bash
-module load ifort/11.0.069
-module load netcdf
+$module_calls
 
 %%END%%
@@ -861,10 +861,5 @@
 
 . /opt/modules/default/init/ksh
-module load modules
-module load PrgEnv-pgi
-module load Base-opts
-module load moab
-module load torque
-module load pmi
+$module_calls
 
 %%END%%
@@ -885,10 +880,5 @@
 
 . /opt/modules/default/init/ksh
-module load modules
-module load PrgEnv-pgi
-module load Base-opts
-module load moab
-module load torque
-module load pmi
+$module_calls
 
 %%END%%
@@ -938,8 +928,5 @@
 
 . /opt/modules/default/init/ksh
-module load modules/3.1.6
-module load netcdf/3.6.2
-module load PrgEnv-pgi/2.2.41
-module load Base-opts/2.2.41
+$module_calls
 
 %%END%%
@@ -958,8 +945,5 @@
 
 . /opt/modules/default/init/ksh
-module load modules/3.1.6
-module load netcdf/3.6.2
-module load PrgEnv-pgi/2.2.41
-module load Base-opts/2.2.41
+$module_calls
 
 %%END%%
