Ignore:
Timestamp:
Mar 3, 2010 12:27:06 AM (14 years ago)
Author:
raasch
Message:

New:
---

Changed:


combine_plot_fields is now directly called within mrun and must not be given
by an output command in the configuration file any more.

Utility programs (combine_plot_fields, interpret_config) are created by mbuild
separately for each block in the configuration file. Depending on option -K,
mrun is using the utility programs for the respective block.
Parallel make for utility programs.

Default configuration files updated.

mbuild, mrun, UTIL/Makefile

Errors:


File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/mbuild

    r493 r503  
    11#!/bin/ksh
    2 # mbuild - Programmuebersetzungsscript
     2# mbuild - script for compiling the PALM code and its utility programs
    33# $Id$
    44
    5      # Prozedur zur Uebersetzung von Programmteilen mittels make-Mechanismus
    6      # auf einem Remote-Rechner, ausgehend von Quellcode auf einem lokalen
    7      # Rechner
    8 
    9      # Folgende Probleme existieren unter Linux, wenn keine AT&T-Korn-Shell
    10      # verwendet wird:
    11      # Wertzuweisungen an Variablen innerhalb von DO-Schleifen werden nicht
    12      # nach aussen weitergegeben. "while read line" funktioniert nicht
    13      # innerhalb einer Pipe.
    14 
    15      # letzte Aenderung:
    16      # 06/05/02 - Siggi - Beginn der Entwicklung
    17      # 12/06/02 - Siggi - Abschluss der Entwicklungsarbeiten
    18      # 23/06/02 - Siggi - voerst kein make-clean, Abbruch bei batch-mode
    19      # 24/07/02 - Siggi - Keine Verwendung der temporaeren Datei tmp_mbuild
    20      #                    unter linux mehr noetig, da nun AT&T-Korn-Shell
    21      #                    benutzt wird
    22      # 12/09/02 - Siggi - ibmh (hanni.hlrn.de) validiert
    23      # 19/12/02 - Siggi - ibmb validiert
     5     # Procedure to compile code on local and remote hosts using the
     6     # make-mechanism. The source code must be provided on the local host.
     7
     8     # Last changes:
     9     # 06/05/02 - Siggi - start development
     10     # 12/06/02 - Siggi - first version finished
     11     # 12/09/02 - Siggi - ibmh (hanni.hlrn.de) included
     12     # 19/12/02 - Siggi - ibmb included
    2413     # 05/02/03 - Siggi - hostname nobela included
    2514     # 04/03/03 - Siggi - host nech included
     
    116105     #                    removed; modules should now be given in the
    117106     #                    configuration file
    118 
    119 
    120 
    121     # VARIABLENVEREINBARUNGEN + DEFAULTWERTE
     107     # 02/03/10 - Siggi - utility programs are created separately for each
     108     #                    block in the configuration file,
     109     #                    parallel make for utility programs
     110
     111
     112    # VARIABLE DECLARATIONS + DEFAULT VALUES
    122113 compile_utility_programs=false
    123114 config_file=.mrun.config
     
    142133 typeset  -L40 version="MBUILD  2.1  Rev$Rev$"
    143134
    144     # FEHLERBEHANDLUNG
    145     # BEI EXIT:
     135    # ERROR HANDLING
     136    # IN CASE OF EXIT:
    146137 trap 'rm -rf  $working_directory/tmp_mbuild
    147138       if [[ $locat != normal ]]
     
    153144
    154145
    155     # BEI TERMINAL-BREAK:
     146    # IN CASE OF TERMINAL-BREAK:
    156147 trap 'rm -rf  $working_directory/tmp_mbuild
    157148       printf "\n\n +++ mbuild killed by \"^C\" \n\n"
     
    162153 tmp_mbuild=${working_directory}/tmp_mbuild
    163154
    164     # SHELLSCRIPT-OPTIONEN EINLESEN
     155    # READ SHELLSCRIPT-OPTIONS
    165156 while  getopts  :c:h:m:s:u  option
    166157 do
     
    178169
    179170
    180     # PRUEFEN, OB KONFIGURATIONS-DATEI VORHANDEN
     171    # CHECK, IF CONFIGURATION-FILE EXISTS
    181172 if [[ ! -f $config_file ]]
    182173 then
     
    189180
    190181
    191     # LOKALEN RECHNER ERMITTELN
     182    # DETERMINE THE LOCAL HOST
    192183 local_host_real_name=$(hostname)
    193184# local_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}')
     
    195186
    196187
    197     # HOST-IDENTIFIER (local_host) AUS KONFIGURATIONSDATEI BESTIMMEN
     188    # DETERMINE HOST-IDENTIFIER (local_host) FROM THE CONFIG-FILE
    198189 line=""
    199190 grep  "%host_identifier"  $config_file  >  $tmp_mbuild
     
    238229
    239230 
    240     # BENUTZERNAMEN AUF LOKALEM RECHNER AUS KONFIGURATIONSDATEI ERMITTELN
     231    # DETERMINE USER NAME ON LOCAL HOST FROM THE CONFIG-FILE
    241232 line=""
    242233 grep  " $local_host" $config_file | grep "%remote_username"  >  $tmp_mbuild
     
    258249
    259250
    260     # LOKALEN QUELLTEXTPFAD ERMITTELN.
    261     # ZUERST PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD FUER ALLE RECHNER
    262     # VEREINBART WURDE.
    263     # DAZU ZUNAECHST ALLE IN DER KONFIGURATIONSDATEI VEREINBARTEN GLOBALEN
    264     # VARIABLEN SETZEN, WEIL DIESE EVTL. IN PFADNAMEN VERWENDET WERDEN
     251    # DETERMINE LOCAL SOURCE-CODE PATH.
     252    # FIRST CHECK, IF A GLOBAL SOURCE-CODE PATH HAS BEEN DECLARED FOR ALL HOSTS.
     253    # THEREFORE, FIRST SET ALL GLOBAL VARIABLES DECLARED IN THE CONFIG-FILE,
     254    # BECAUSE THEY MAY BE USED AS PART OF THE PATH NAME.
    265255 line=""
    266256 grep "%" $config_file  >  $tmp_mbuild
     
    272262       value=`echo $line | cut -d" " -s -f2`
    273263       eval export $var=\$value
    274 #       eval echo \"   $var=\$$var \"   # AUSGABE ZU TESTZWECKEN
    275264    fi
    276265 done < $tmp_mbuild
    277266
    278     # NUN PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD VEREINBART WURDE
     267    # NOW CHECK, IF A GLOBAL SOURCE-CODE-PATH HAS BEEN DECLARED
    279268 line=""
    280269 grep "%source_path" $config_file  >  $tmp_mbuild
     
    317306
    318307
    319     # GLOBALEN DEPOSITORY-PFAD ERMITTELN
     308    # DETERMINE GLOBAL DEPOSITORY-PATH
    320309 line=""
    321310 grep "%depository_path" $config_file  >  $tmp_mbuild
     
    333322
    334323
    335     # PRUEFEN, OB IN KONFIGURATIONSDATEI EIN HAUPTPROGRAMM
    336     # VEREINBART WURDE
     324    # CHECK, IF A MAIN PROGRAM HAS BEEN DEFINED IN THE CONFIG-FILE
    337325 if [[ $(grep -c "%mainprog" $config_file) != 1 ]]
    338326 then
     
    352340
    353341
    354     # MAKEFILE vorhanden
     342    # CHECK IF MAKEFILE EXITS
    355343 [[ "$makefile" = "" ]]  &&  makefile=$local_source_path/Makefile
    356344 if [[ ! -f $makefile ]]
     
    363351
    364352
    365     # HEADER-AUSGABE (TEIL1: MELDUNGEN UEBER LOKALEN RECHNER)
     353    # HEADER-OUTPUT (PART1: MESSAGES CONCERNING THE LOCAL HOST)
    366354 calltime=$(date)
    367355 printf "\n"
     
    389377 then
    390378
    391        # IN JEDEM FALL ALLEN DATEIEN WRITE-PERMIT GEBEN, DAMIT ES AUF
    392        # DEN REMOTE-RECHNERN NICHT EVTL. ZU PROBLEMEN BEIM UEBERSCHREIBEN KOMMT
     379       # IN ANY CASE, GIVE ALL FILES WRITE-PERMIT, IN ORDER TO AVOID PROBLEMS
     380       # WITH OVERWRITING FILES ON THE REMOTE HOST
    393381    cd  $local_source_path
    394382    printf "\n\n  *** tar of makefile and source files in $local_source_path" 
     
    400388
    401389
    402     # BESTAETIGUNG ZUM WEITERMACHEN EINHOLEN
     390    # GET CONFIRMATION TO CONTINUE
    403391 if [[ $host = all ]]
    404392 then
     
    487475                         then
    488476                            printf "\n  +++ remote host \"$remote_host\" unknown";
    489                             printf "\n      please inform S. Raasch!"
     477                            printf "\n      please inform PALM group support!"
    490478                         fi;;
    491479    esac
     
    588576
    589577    remote_md=$(eval echo $remote_md)
    590     [[ "$condition1" != "" ]]  &&  remote_md=${remote_md}_$condition1
    591     [[ "$condition2" != "" ]]  &&  remote_md=${remote_md}_$condition2
     578    block=""
     579    [[ "$condition1" != "" ]]  &&  block=_$condition1
     580    [[ "$condition2" != "" ]]  &&  block=${block}_$condition2
     581    remote_md==${remote_md}$block
    592582
    593583
     
    803793
    804794
    805        # get modules to be load
     795       # get modules to be loaded
    806796    line=""
    807797    grep  "$remote_host_string" $config_file | grep "%modules"  >  $tmp_mbuild
     
    959949       if [[ $answer = c  ||  $answer = C ]]
    960950       then
    961           silent=false
     951          silent=true
    962952       fi
    963953       if [[ $answer = s  ||  $answer = S ]]
     
    10421032          then
    10431033             module_calls="module load ${modules};"
     1034          else
     1035             module_calls=""
    10441036          fi
    10451037
     
    11381130             ssh  ${remote_username}@${remote_addres} "[[ ! -d ${remote_ud} ]]  &&  (echo \"  *** ${remote_ud} will be created\"; mkdir -p  ${remote_ud}); [[ ! -d ${remote_ud}/../SCRIPTS ]]  &&  (echo \"  *** ${remote_ud}/../SCRIPTS will be created\"; mkdir -p ${remote_ud}/../SCRIPTS)"
    11391131          else
    1140                 # TIT ERLAUBT NUR DIE AUSFï¿œHRUNG GANZ BESTIMMTER KOMMANDOS
     1132                # TIT ERLAUBT NUR DIE AUSFUEHRUNG GANZ BESTIMMTER KOMMANDOS
    11411133                # MIT SSH, DESHALB AUFRUF PER PIPE
    11421134             print "[[ ! -d ${remote_ud} ]]  &&  (echo \"  *** ${remote_ud} will be created\"; mkdir -p  ${remote_ud}); [[ ! -d ${remote_ud}/../SCRIPTS ]]  &&  (echo \"  *** ${remote_ud}/../SCRIPTS will be created\"; mkdir -p  ${remote_ud}/../SCRIPTS)"  |  ssh ${remote_username}@${remote_addres}  2>&1
     
    11461138          if [[ $local_host = decalpha ]]
    11471139          then
    1148                 # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTï¿œNDIGEN PFADES
     1140                # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTAENDIGEN PFADES
    11491141                # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM
    11501142                # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN
     
    11811173          if [[ $remote_host = nech ]]
    11821174          then
    1183              make_call_string="sxmake  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
    1184           else
    1185              make_call_string="make  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
     1175             make_call_string="sxmake  $make_options  BLOCK=$block  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
     1176          else
     1177             make_call_string="make  $make_options  BLOCK=$block  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
    11861178          fi
    11871179
     
    11901182          then
    11911183             module_calls="module load ${modules};"
     1184          else
     1185             module_calls=""
    11921186          fi
    11931187
     
    12921286
    12931287
    1294              # NEUE VERSION AUF LOKALEM RECHNER ZUSAMMENPACKEN
     1288             # TAR NEW VERSION ON LOCAL HOST
    12951289          printf "\n  *** tar update on local host ..."
    12961290          tar -cf  ${mainprog}_current_version.tar  *.$suf *.o *.mod
     
    13031297          echo "  *** compiling the utility programs ..."
    13041298          cd ${local_source_path}/../UTIL
    1305           make  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$loader_options"
     1299
     1300             # TOUCH FILES IN ORDER TO FORCE COMPILATION FOR EVERY BLOCK
     1301          touch  *.f90
     1302          make  $make_options  BLOCK=$block  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$loader_options"
    13061303          cd  -  > /dev/null
    13071304       fi
     
    13251322
    13261323
    1327     # ABSCHLIESSENDE ARBEITEN
     1324    # FINAL WORK
    13281325 rm -f  hosts_found_in_config_file
    13291326
Note: See TracChangeset for help on using the changeset viewer.