Index: palm/trunk/SCRIPTS/mrun
===================================================================
--- palm/trunk/SCRIPTS/mrun	(revision 475)
+++ 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
