#!/bin/ksh ##!/home/DSRC/NC/tatuyama/pub/ksh NEEDED ON NEC AT RIAM !!!!!!!!!! # mrun - Plot-Shellskript Version: @(#)MRUN 2.0 07/03/07 # $Id: mrun 61 2007-03-12 05:42:06Z raasch $ # Prozedur zum Starten von Modellaeufen # letzte Aenderung: # 03/03/94 - Siggi - Entwicklungsbeginn # 21/03/94 - Siggi - Entwicklungsabschluss (Version 1.0) # 09/12/94 - Siggi - allexport unterbunden; statt dessen werden jetzt ein- # zelne Variable exportiert. Dies ist noetig, weil an- # sonsten irgendein Speicher ueberlaeuft und von mrun # aufgerufene Programme (z.B. stageout) mit Fehlern # abbrechen (too many arguments) # 20/06/95 - Siggi - noclobber muss explizit abgeschaltet, da jetzt # defaultmaessig im RRZN-Profile eingeschaltet # 10/06/97 - Siggi - Zusaetzliche Option -C bei cpp, damit // nicht # wegfallen # 25/04/00 - Siggi - Version 1.5 # remote_addres und remote_user in return_addres bzw. # return_username umbenannt, return_username wird dem # mrun-Aufruf im Job ueber Option -U mitgegeben. # Neue Variable remote_username, die beim interaktiven # mrun-Aufruf zwingend ueber die neue Option -u oder # in der Konfigurationsdatei angegeben werden muss. # 08/02/01 - Siggi - Alle mrun-Meldungen ins englische uebersetzt, # Version 1.7 # 05/05/02 - Siggi - Uebersetzungen mittels make-Mechanismus moeglich # 21/11/02 - Siggi - ENV-Variable XLFRTEOPTS wird vor Ausfuehrung auf # IBM gesetzt, um Record-Laenge der NAMELIST-Dateien, # zu bestimmen; Praeprozessoroptionen haben nun alle # die Form -Dtext=text, weil auf IBM sonst text durch # die leere Zeichenkette ersetzt wird # 01/08/03 - Siggi - Test of implementing dvrp+1PE on ibm # 07/01/04 - Siggi - additional preprocessor directive for ibm included # (-D$OMP=OMP) in order to avoid problems with # OMP_NUM_THREADS # 04/01/05 - Siggi - archiving on hanni and berni is done in separate # tar files, one for each node used # 07/01/04 - Siggi - old code for t3e, vpp and hpcs eliminated # 09/01/05 - Siggi - workaround for getting the IP address on gfdl3 # 17/01/05 - Siggi - job for data transfer to local machine now within # job class c1 (HLRN) # 27/01/05 - Siggi - IP address workaround for gfdl3 removed # 28/01/05 - Siggi - tar-filenames on $PERM (HLRN) now include the # base filename and cycle number # 16/02/05 - Gerald - hababai validated # 14/03/05 - Siggi - abort on NEC after first runtime error (F_ERRCNT) # 29/03/05 - Marcus - berni*-en0 validated # 21/04/05 - Siggi - transfer-job-protocol for avs-data is no more stored # 24/04/05 - Siggi - netcdf support on lcmuk # 25/04/05 - Siggi - netcdf support on gfld3 (decalpha) # 11/05/05 - Siggi - files with non-numeric extensions (.xxx after cycle # number) can now be used within interactive runs # 12/05/05 - Siggi - netcdf support on ibm # 13/05/05 - Siggi - error in tar-filenames on $PERM (HLRN) removed # 18/05/05 - Siggi - netcdf support on nec # 24/05/05 - Siggi - netcdf support on ibms # 14/06/05 - Siggi - sleep interval after submit of restart job increased # to 30 seconds # 28/06/05 - Siggi - bora adjusted to new intel compiler (LD_LIBRARY_ # PATH is temporarily set) # 07/09/05 - Siggi - setting of MP_EAGER_LIMIT switched off because it # caused warnings in the job protocol # 20/10/05 - Siggi - update of netcdf-version on decalpha (gfdl3) # 25/10/05 - Siggi - error in listing files for getting the cycle number # removed # 26/10/05 - Siggi - new paths for dvrp-library, transfer of catalogs # realized by file attribute trpe # 28/10/05 - Siggi - if existing, the file extension is output in case # of missing input file - no job abort in case of # missing input files with file extensions # (preliminary solution) # 31/10/05 - Siggi - data transfer from nech now within seperate job # 04/11/05 - Siggi - netcdf 3.6.0-p1 on ibmh/ibmb # 07/12/05 - Siggi - gallego and elephanta admitted # 30/12/05 - Siggi - gfdl5 (ibmy) admitted # 10/01/06 - Siggi - cpp directive for NetCDF 64bit support # 20/01/06 - Siggi - cpp directive for ibmy # 09/02/06 - Siggi - ibmy admitted for batch mode # 13/04/06 - Siggi - ostria admitted # 18/04/06 - Siggi - usage of OpenMP implemented (additional option -O) # 10/05/06 - Siggi - environment variable XLSMPOPTS set on IBM for # optimization of OpenMP runs (option stacksize is # necessary for large gridpoint numbers because # otherwise a segmentation fault occurs) # 23/05/05 - Siggi - lctit (SUN Fire X4600) admitted # 21/08/06 - Siggi - standard mrun path on scirocco is as on bora # 23/08/06 - Siggi - netcdf support for scirocco (notebook) # 20/09/06 - Marcus - add DVRP library on nech # 24/10/06 - Siggi - Environment variables for PALM steering are written # on local NAMELIST file ENVPAR # 24/11/06 - Siggi - levanto admitted, maestro switched to ifc 9.1 # 28/11/06 - Siggi - call to interpret_config.x_levanto because of SuSe 10 # 06/02/07 - Siggi - add DVRP library on lcmuk # 07/02/07 - Siggi - revision of source code handling, source code is # now expected in directory given by source_path and # not in the current working directory, source code # files provided in add_source_path are allways # compiled, source code to be compiled is allways # sampled in SOURCES_FOR_RUN_$fname which is a # subdirectory of the current working directory, # -s TEST changed to -s WRITE_PERMIT or -s WP, # adapted for RIAM (neck) # bugfix for cycle number of output file (extout) # all hpmuk-related code removed # 14/02/07 - Siggi - dvrp support for neck added # 28/02/07 - Siggi - empty lines in configuration file are accepted # mrun_path replaced by PALM_BIN, # all machines are calling interpret_config.x # VARIABLENVEREINBARUNGEN + DEFAULTWERTE set +o allexport # SICHERHEITSHALBER UNTERBINDEN, DA SONST EVTL. STAGEOUT # NICHT LAUEFT (TOO MANY ARGUMENTS - PROBLEM) set +o noclobber # EXISTIERENDE DATEIEN DUERFEN UEBERSCHRIEBEN WERDEN AddFilenames="" additional_conditions="" add_source_path="" afname="" archive_save=true archive_system=none compiler_name="" cond1="" cond2="" config_file=.mrun.config cpp_opts="" cpumax=0 cpurest=0 delete_temporary_catalog=true do_batch=false do_compile=true do_remote=false do_stagein=true do_stageout=true do_trace=false email_notification="" exclude="" executable="" execution_error=false filetransfer_protocol="" fname=test fromhost="" host="" host_file="" hp="" ignore_archive_error=false input_list="" interpreted_config_file="" job_on_file="" keep_data_from_previous_run=false localhost_realname=$(hostname) local_compile=false locat=normal mainprog="" makefile="" mc=$0 while [[ $(echo $mc | grep -c "/") != 0 ]] do mc=`echo $mc | cut -f2- -d"/"` done module_files="" MODULE_OPTIONS="" mrun_script_name=$mc netcdf_support=false node_usage=default numprocs="" OOPT="" openmp=false output_list="" package_list="" punkte="..........................................................." queue=none read_from_config="" restart_run=false return_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}') if [[ $return_addres = 130.75.105.158 ]] then return_addres=172.20.25.41 echo "+++ WARNING: return_addres changed to $return_addres !!!!!" fi # if [[ $return_addres = 210.117.65.1 ]] # if [[ $(nslookup `hostname` 2>&1 | grep -c 210.117.65.1) = 1 ]] # then # [[ $localhost_realname = gfdl3.yonsei.ac.kr ]] && return_addres=165.132.26.56 # fi return_password="" return_username=$LOGNAME remotecall=false remote_username="" run_mode="" scirocco=false store_on_archive_system=true striche=" ----------------------------------------------------------------------------" silent=false source_list="" source_path=SOURCE tasks_per_node="" threads_per_task=1 tmpcreate=false tmp_data_catalog="" transfer_problems=false usern=$LOGNAME use_makefile="" working_directory=`pwd` TOPT="" XOPT="" zeit=$( date | cut -c 12-19 ) typeset -i iec=0 iic=0 iin=0 ioc=0 iout=0 memory=0 stagein_anz=0 stageout_anz=0 typeset -i cputime i ii icycle inode ival jobges jobsek maxcycle minuten nodes pes sekunden tp1 typeset -R40 calltime typeset -L20 spalte1 typeset -L40 spalte2 typeset -L60 spalte3 typeset -L35 string1=`date` typeset -L12 string2=$usern typeset -L12 string3=$localhost_realname typeset -L12 string4 typeset -L12 string5 typeset -L20 version="MRUN 2.0" # EINZELNE VARIABLE FUER HAUPTPROGRAMM EXPORTIEREN export cpurest fname host localhost return_addres return_username remotecall tasks_per_node # FOLGENDE VARIABLEN MUESSEN FUER DIE INTERPRETATION DER KONFIGURATIONSDATEI # EXPORTIERT WERDEN export afname config_file cpp_opts cpumax do_batch do_trace fname fromhost export input_list memory numprocs output_list queue run_mode # FEHLERBEHANDLUNG # BEI EXIT: trap 'if [[ $locat != localhost ]] then # if [[ ! -f ${mrun_path}/statistik/mrun_statistik ]] # then # cat > ${mrun_path}/statistik/mrun_statistik << %STATEND% #MRUN-calls on $localhost # #date and time user localhost remotehost termination mrun-command #-------------------------------------------------------------------------------------------------------------------- #%STATEND% # chmod 666 ${mrun_path}/statistik/mrun_statistik # fi # # # EINTRAG IN DIE STATISTIK-DATEI # string4=$host # string5=$locat # if [[ "$job_on_file" = "" && $locat != control_c && $locat != user_abort ]] # then # if [[ $do_batch = true ]] # then # printf "$string1$string2$string3$string4$string5$mrun_com \n" >> ${mrun_path}/statistik/mrun_statistik # else # printf "$string1$string2$string3$string4$string5$mc \n" >> ${mrun_path}/statistik/mrun_statistik # fi # fi continue fi if [[ $locat != normal && $locat != control_c && $locat != local_compile ]] then # EVENTUELLE ERROR-KOMMANDOS ABARBEITEN (( i = 0 )) while (( i < iec )) do (( i = i + 1 )) printf "\n *** Execution of ERROR-command:\n" printf " >>> ${err_command[$i]}\n" eval ${err_command[$i]} done if [[ -n $interpreted_config_file ]] then rm -rf $interpreted_config_file fi if [[ $tmpcreate = true ]] then printf "\n *** Contents of \"$TEMPDIR\":\n" ls -al; cd [[ $delete_temporary_catalog = true ]] && rm -rf $TEMPDIR fi if [[ -f ~/job_queue/JOBINFO.$QSUB_REQID ]] then rm -rf ~/job_queue/JOBINFO.$QSUB_REQID fi printf "\n\n+++ MRUN killed \n\n" elif [[ $locat != control_c ]] then printf "\n\n --> all actions finished\n\n" printf " Bye, bye $usern !!\n\n" fi' exit # BEI TERMINAL-BREAK: trap '[[ $tmpcreate = true ]] && (cd; rm -rf $TEMPDIR) if [[ -f ~/job_queue/JOBINFO.$QSUB_REQID ]] then rm -rf ~/job_queue/JOBINFO.$QSUB_REQID fi printf "\n+++ MRUN killed by \"^C\" \n\n" locat=control_c exit ' 2 # CHECK IF THE PATH FOR THE PALM BINARIES (SCRIPTS+UTILITY-PROGRAMS) HAS # BEEN SET if [[ "$PALM_BIN" = "" ]] then printf "\n +++ environment variable PALM_BIN has not been set" printf "\n please set it to the directory where the PALM scripts are located" locat=palm_bin; exit fi # EVTL. NAMEN DES LOKALEN RECHNERS MIT UEBERGREIFENDEM NAMEN VERSEHEN case $localhost_realname in (atmos) localhost=lcide;; (bora|breva|elephanta|gallego|gregale|hababai|irifi|levanto|maestro|orkan|ostria|poniente|quanero|scirocco|vorias) localhost=lcmuk;; (breg*-en0|berni*-en0) localhost=ibmb; archive_system=tivoli;; (cs*) localhost=nech; archive_system=ut;; (gate|n-sx) PATH=$MRUN_BIN:$PATH:/usr/bin/nqsII; localhost=neck;; (ground.yonsei.ac.kr) localhost=decalpha;; (gfdl3.yonsei.ac.kr) localhost=decalpha;; (gfdl5) localhost=ibmy;; (hreg*-en0|hanni*-en0) localhost=ibmh; archive_system=tivoli;; (nobel*) localhost=ibms;; (sun1|sun2) localhost=unics;; (tgg*) localhost=lctit;; (*) printf "\n +++ Host \"$localhost_realname\" not admitted for mrun \n" locat=localhost; exit;; esac [[ $localhost_realname = scirocco ]] && scirocco=true # SHELLSCRIPT-OPTIONEN EINLESEN UND KOMMANDO NEU ZUSAMMENSETZEN, FALLS ES # FUER FOLGEJOBS BENOETIGT WIRD while getopts :a:AbBc:Cd:D:f:Fh:H:i:IkK:m:M:n:o:Op:P:q:r:R:s:St:T:u:U:vxX: option do case $option in (a) afname=$OPTARG;; (A) store_on_archive_system=false; mc="$mc -A";; (b) do_batch=true; mc="$mc -b";; (B) delete_temporary_catalog=false; mc="$mc -B";; (c) config_file=$OPTARG; mc="$mc -c$OPTARG";; (C) restart_run=true; mc="$mc -C";; (d) fname=$OPTARG; mc="$mc -d$OPTARG";; (D) cpp_opts="$cpp_opts $OPTARG"; mc="$mc -D$OPTARG";; (f) filetransfer_protocol=$OPTARG; mc="$mc -f$OPTARG";; (F) job_on_file="-D"; mc="$mc -F";; (h) host=$OPTARG; mc="$mc -h$OPTARG";; (H) fromhost=$OPTARG; mc="$mc -H$OPTARG";; (i) input_list=$OPTARG; mc="$mc -i'$OPTARG'";; (I) ignore_archive_error=true; mc="$mc -I";; (k) keep_data_from_previous_run=true; mc="$mc -k";; (K) additional_conditions="$OPTARG"; mc="$mc -K$OPTARG";; (m) memory=$OPTARG; mc="$mc -m$OPTARG";; (M) makefile=$OPTARG; mc="$mc -M$OPTARG";; (n) node_usage=$OPTARG; mc="$mc -n$OPTARG";; (o) output_list=$OPTARG; mc="$mc -o'$OPTARG'";; (O) use_openmp=true; mc="$mc -O";; (p) package_list=$OPTARG; mc="$mc -p'$OPTARG'";; (P) return_password=$OPTARG; mc="$mc -P$OPTARG";; (q) queue=$OPTARG; mc="$mc -q$OPTARG";; (r) run_mode=$OPTARG; mc="$mc -r'$OPTARG'";; (R) remotecall=true;return_addres=$OPTARG; mc="$mc -R$OPTARG";; (s) source_list=$OPTARG; mc="$mc -s'$OPTARG'";; (S) read_from_config=false; mc="$mc -S";; (t) cpumax=$OPTARG; mc="$mc -t$OPTARG";; (T) tasks_per_node=$OPTARG; mc="$mc -T$OPTARG";; (u) remote_username=$OPTARG; mc="$mc -u$OPTARG";; (U) return_username=$OPTARG; mc="$mc -U$OPTARG";; (v) silent=true; mc="$mc -v";; (x) do_trace=true;set -x; mc="$mc -x";; (X) numprocs=$OPTARG; mc="$mc -X$OPTARG";; (\?) printf "\n +++ unknown option $OPTARG \n" printf "\n --> type \"$0 ?\" for available options \n" locat=parameter;exit;; esac done # EVTL. POSITIONSPARAMETER EINLESEN # ZUR ZEIT GIBT ES NUR DEN PARAMETER ? (=KURZINFO) shift OPTIND-1 # KURZE AUFRUFBESCHREIBUNG WIRD HIER AUSGEGEBEN if [[ "$1" = "?" ]] then (printf "\n *** mrun can be called as follows:\n" printf "\n $mrun_script_name -b -c.. -d.. -D.. -f.. -F -h.. -i.. -I -K.. -m.. -o.. -p.. -r.. -R -s.. -t.. -T.. -v -x -X.. \n" printf "\n Description of available options:\n" printf "\n Option Description Default-Value" printf "\n -a base name of input files equiv. -d" printf "\n -A no archiving when using file-attribute fl" printf "\n -b batch-job on local machine ---" printf "\n -B do not delete temporary directory at end ---" printf "\n -c configuration file .mrun.config" printf "\n -d base name of files attached to program test" printf "\n -D preprocessor(cpp)-directives \"\" " printf "\n -f filetransfer protocol (ftp or scp) depending on -h" printf "\n -F create remote job file only ---" printf "\n -h execution host $localhost_realname" printf "\n -i INPUT control list \"\" " printf "\n -I archiving errors of previous batch-jobs" printf "\n will be ignored" printf "\n -k keep data from previous run" printf "\n -K additional conditions for controling" printf "\n usage of conditional code and" printf "\n env-variables in configuration file \"\" " printf "\n -m memory demand in MB (batch-jobs) 0 MB" printf "\n -M Makefile name Makefile" printf "\n -n node usage (shared/not_shared) depending on -h" printf "\n -o OUTPUT control list \"\" " printf "\n -O use OpenMP ---" printf "\n -p software package list \"\" " printf "\n -q queue \"$queue\" " printf "\n -r run control list (combines -i -o) \"\" " printf "\n -s filenames of routines to be compiled \"\" " printf "\n must end with .f, .f90, .F, or .c !" printf "\n use \"..\" for more than one file and wildcards" printf "\n -s TEST compiles all files with w-permit" printf "\n -S config file interpreted by shellscript ---" printf "\n -t allowed cpu-time in seconds (batch) 0" printf "\n -T tasks per node depending on -h" printf "\n -u username on remote machine \"\" " printf "\n -v no prompt for confirmation ---" printf "\n -x tracing of mrun for debug purposes ---" printf "\n -X # of processors (on parallel machines) 1" printf "\n " printf "\n Possible values of positional parameter :" printf "\n \"?\" - this outline \n\n") | more exit elif [[ "$1" != "" ]] then printf "\n +++ positional parameter $1 unknown \n" locat=parameter; exit fi # KURZE STARTMELDUNG printf "\n*** $version " printf "\n will be executed. Please wait ..." # BASISNAME DER INPUT-DATEIEN GLEICH ALLGEMEINEM BASISNAMEN SETZEN, # WENN NICHT VOM BENUTZER ANDERS BESTIMMT [[ "$afname" = "" ]] && afname=$fname # EVTL. RUN-MODUS DEN I/O-LISTEN HINZUFUEGEN if [[ "$run_mode" != "" ]] then input_list="$input_list $run_mode" output_list="$output_list $run_mode" fi # RECHNERNAMEN ABSPEICHERN, VON DEM AUS JOB GESTARTET WIRD, # ALLERDINGS NUR DANN, WENN NICHT PER OPTION -H BEREITS EIN WERT # ZUGEWIESEN WURDE (MRUN MACHT DIES IMMER, WENN ES SELBST BATCH-JOBS # STARTET) if [[ "$fromhost" = "" ]] then fromhost=$localhost fi # PRUEFEN, OB MRUN NUR TESTWEISE AUF DER LOKALEN MASCHINE KOMPILIEREN SOLL if [[ "$source_list" = LOCAL_COMPILE_TEST ]] then source_list=TEST local_compile=true host=$localhost fi # PRUEFEN, OB AUF REMOTE-MASCHINE GERECHNET WERDEN SOLL # WERT VON do_remote WIRD FUER DATEIVERBINDUNGEN BENOETIGT. # WENN AUF REMOTE-MASCHINE GERECHNET WIRD, IST GLEICHZEITIG KLAR, # DASS EIN BATCH-JOB GESTARTET WERDEN MUSS if [[ -n $host && "$host" != $localhost ]] then do_batch=true do_remote=true case $host in (ibm|ibmb|ibmh|ibms|ibmy|nech|neck|lctit|unics) true;; (*) printf "\n" printf "\n +++ execution host \"$host\" not admitted for MRUN," printf "\n or NQS not available on execution host!" locat=nqs; (( iec = 0 )); exit;; esac else host=$localhost fi # ZUSATZBEDINGUNGEN (OPTION -K) AUSWERTEN if [[ -n $additional_conditions ]] then echo $additional_conditions | cut -d" " -f1-3 | read cond1 cond2 dummy # cond1=`echo $additional_conditions | cut -d" " -f1` # cond2=`echo $additional_conditions | cut -d" " -s -f2` # dummy=`echo $additional_conditions | cut -d" " -s -f3` if [[ -n $dummy ]] then printf "\n +++ more than 2 additional conditions given for Option \"-K\"" locat=options; exit fi fi # PRUEFEN, OB EVTL. BEI VORHERGEHENDEM LAUF (KETTENJOB) EINE # ARCHIVIERUNG FEHLGESCHLAGEN IST if [[ -f ~/job_queue/ARCHIVE_ERROR_$fname ]] then if [[ $ignore_archive_error = false ]] then printf "\n +++ data archiving of previous run failed" printf "\n see directory \~/job_queue on remote machine" locat=archive; exit else printf "\n +++ warning: data archiving in a previous run failed" printf "\n MRUN continues, trying to get backup copy" fi fi # PRUEFEN, OB KONFIGURATIONS-DATEI VORHANDEN if [[ ! -f $config_file ]] then printf "\n\n +++ configuration file: " printf "\n $config_file" printf "\n does not exist" locat=connect; exit fi # LESEN UND INTERPRETIEREN DER KONFIGURATIONS-DATEI VOM SHELLSCRIPT AUS # VORUEBERGEHEND ZWINGEND AUF LINUX-RECHNERN if [[ "$read_from_config" = false ]] then [[ $silent = false ]] && printf "\n Reading the configuration file... " while read zeile do [[ $silent = false ]] && printf "." # ZUERST EVENTUELL VORKOMMENDE ENVIRONMENT-VARIABLEN DURCH IHRE WERTE # ERSETZEN eval zeile=\"$zeile\" # INTERPRETATION DER ZEILE if [[ "$(echo $zeile)" = "" ]] then # LEERZEILE, KEINE AKTION continue elif [[ "$(echo $zeile | cut -c1)" = "#" ]] then # ZEILE IST KOMMENTARZEILE true elif [[ "$(echo $zeile | cut -c1)" = "%" ]] then # ZEILE DEFINIERT ENVIRONMENT-VARIABLE zeile=$(echo $zeile | cut -c2-) echo $zeile | cut -d" " -f1-5 | read var value for_host for_cond1 for_cond2 # var=`echo $zeile | cut -d" " -f1` # value=`echo $zeile | cut -d" " -s -f2` # for_host=`echo $zeile | cut -d" " -s -f3` # for_cond1=`echo $zeile | cut -d" " -s -f4` # for_cond2=`echo $zeile | cut -d" " -s -f5` if [[ "$for_host" = "" || ( "$for_host" = $host && "$for_cond1" = "$cond1" && "$for_cond2" = "$cond2" ) || $(echo "$input_list$output_list"|grep -c "$for_host") != 0 ]] then # BEI COMPILER- CPP- ODER LINKEROPTIONEN EVTL ":" DURCH " " # ERSETZEN. "::" WIRD DURCH ":" ERSETZT. value=`echo $value | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` # ENVIRONMENT-VARIABLE WIRD WERT AUS KONFIGURATIONSDATEI # ZUGEWIESEN, WENN SIE SELBST NOCH KEINEN WERT UEBER DIE # ENTSPRECHENDE SCRIPT-OPTION ERHALTEN HAT. SOLCHE # VARIABLEN HAETTEN DANN DEN WERT "" ODER IM INTEGER-FALL DEN # WERT 0. ALLGEMEINE REGEL ALSO: SCRIPT-OPTION GEHT UEBER # KONFIGURATIONSDATEI if [[ "$(eval echo \$$var)" = "" || "$(eval echo \$$var)" = "0" ]] then eval $var=\$value # EVTL. BILDSCHIRMAUSGABEN DER ENVIRONMENT-VARIABLEN if [[ $do_trace = true ]] then printf "\n*** ENVIRONMENT-VARIABLE $var = $value" fi fi # WENN ENVIRONMENT-VARIABLE HOST VEREINBART, DANN SOFORT AUSWERTEN # WERT VON do-remote WIRD BEI DATEIVERBINDUNGEN BENOETIGT # WENN AUF REMOTE-MASCHINE GERECHNET WIRD, IST GLEICHZEITIG KLAR, # DASS EIN BATCH-JOB GESTARTET WERDEN MUSS if [[ $var = host ]] then if [[ -n $host && "$host" != $localhost ]] then do_batch=true do_remote=true case $host in (ibm|ibms|ibmy|lctit|nech|neck|unics) true;; (*) printf "\n +++ no queueing system available on execution host \"$host\"" locat=nqs; exit;; esac else host=$localhost fi fi # VOM BENUTZER DEFINIERTE ENVIRONMENT VARIABLEN MUESSEN PRINZIPIELL # EXPORTIERT WERDEN, DA SIE VIELLEICHT IN WEITER UNTEN AUFZURUFEN- # DEN PROGRAMMEN BENOETIGT WERDEN export $var fi elif [[ "$(echo $zeile | cut -c1-3)" = "EC:" ]] then # ZEILE DEFINIERT ERROR-KOMMANDO (( iec = iec + 1 )) zeile=$(echo $zeile | cut -c4-) err_command[$iec]="$zeile" elif [[ "$(echo $zeile | cut -c1-3)" = "IC:" ]] then # ZEILE DEFINIERT INPUT-KOMMANDO (( iic = iic + 1 )) zeile=$(echo $zeile | cut -c4-) in_command[$iic]="$zeile" elif [[ "$(echo $zeile | cut -c1-3)" = "OC:" ]] then # ZEILE DEFINIERT OUTPUT-KOMMANDO (( ioc = ioc + 1 )) zeile=$(echo $zeile | cut -c4-) out_command[$ioc]="$zeile" else # ZEILE DEFINIERT DATEIVERBINDUNG. EINLESEN DER DATEIEIGENSCHAFTEN # s2a: in/out - Feld # s2b: loc - Feld (optional) # s2c: tr/ar - Feld (optional) echo $zeile | cut -d" " -f1-2 | read s1 s2 # s1=`echo $zeile | cut -d" " -f1` # s2=`echo $zeile | cut -d" " -s -f2` s2a=$(echo $s2 | cut -d":" -f1) if [[ $(echo $s2 | grep -c ":") = 0 ]] then s2b="" s2c="" else echo $s2 | cut -d":" -f2-3 | sed 's/:/ /g' | read s2b s2c # s2b=`echo $s2 | cut -d":" -f2 | sed 's/:/ /g'` # s2c=`echo $s2 | cut -d":" -s -f3 | sed 's/:/ /g'` fi echo $zeile | cut -d" " -f3-6 | read s3 s4 s5 s6 # s3=`echo $zeile | cut -d" " -f3` # s4=`echo $zeile | cut -d" " -s -f4` # s5=`echo $zeile | cut -d" " -s -f5` # s6=`echo $zeile | cut -d" " -s -f6` # ABSPEICHERN DER DATEIVERBINDUNG, FALLS IN INPUT- ODER OUTPUT-LIST # VERMERKT. VARIABLE S3 KANN AUCH LISTE ENTHALTEN (FELDTRENNER ":") # DATEIVERBINDUNG WIRD DANN NICHT ABGESPEICHERT UND GEPRUEFT, WENN # PROGRAMMLAUF AUF REMOTE-MASCHINE ERFOLGT UND DATEI NUR LOKAL VOR- # HANDEN SEIN MUSS (D.H. s2b = loc) IFSALT="$IFS"; IFS="$IFS:" if [[ "$s2a" = in && ! ( $do_remote = true && ( "$s2b" = loc || "$s2b" = locopt ) ) ]] then found=false for actual in $input_list do for formal in $s3 do [[ $actual = $formal || "$formal" = "-" ]] && found=true done done if [[ $found = true ]] then (( iin = iin + 1 )) localin[$iin]=$s1; transin[$iin]=$s2b; actionin[$iin]=$s2c; typein[$iin]=$s3; pathin[$iin]=$s4; endin[$iin]=$s5; extin[$iin]=$s6 fi elif [[ "$s2a" = out && ! ( $do_remote = true && "$s2b" = loc ) ]] then found=false for actual in $output_list do for formal in $s3 do [[ $actual = $formal || "$formal" = "-" ]] && found=true done done if [[ $found = true ]] then (( iout = iout + 1 )) localout[$iout]=$s1; actionout[$iout]=$s2c; typeout[$iout]=$s3; pathout[$iout]=$s4; endout[$iout]=$s5; extout[$iout]=$s6 fi elif [[ "$s2a" != in && "$s2a" != out ]] then printf "\n +++ I/O-attribute in configuration file $config_file has the invalid" printf "\n value \"$s2\". Only \"in\" and \"out\" are allowed!" locat=connect; exit fi IFS="$IFSALT" fi done < $config_file else # INTERPRETATION DER KONFIGURATIONSDATEI MITTELS FORTRAN 90 - PROGRAMM [[ $silent = false ]] && printf "..." export cond1 cond2 config_file do_remote do_trace input_list localhost output_list export interpreted_config_file=.icf.$RANDOM # case $localhost_realname in # (caurus|twister) interpret_config.hp;; # (bora|breva|elephanta|gallego|gregale|hababai|maestro|orkan|ostria) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/muksoft/packages/intel_ifc/8.1/lib/; interpret_config_9.x;; # (levanto|vorias) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/muksoft/packages/intel/ifort/9.1.037/lib/; interpret_config_9.x_levanto;; # (quanero) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel_fc_80/lib; interpret_config_9.x;; # (*) interpret_config.x;; # esac interpret_config.x # AUSFUEHRUNG DER GENERIERTEN SHELL-KOMMANDOS IN DIESER SHELL chmod u+x $interpreted_config_file export PATH=$PATH:. . $interpreted_config_file rm $interpreted_config_file fi # QUELLTEXTVERZEICHNIS AUF LOKALER MASCHINE AUS KONFIGURATIONSDATEI # BESTIMMEN (WUERDE SONST EVTL. DAS VERZEICHNIS DES JEWEILS UNTER -h # ANGEGEBENEN REMOTE-RECHNERS SEIN) # BEI BATCH-JOBS SIND DIE ZU UEBERSETZENDEN PROGRAMMTEILE SCHON KOMPLETT if [[ "$SOURCES_COMPLETE" = "" ]] then # ZUERST PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD FUER ALLE RECHNER # VEREINBART WURDE source_path="" line="" grep "%source_path" $config_file > tmp_mrun while read line do if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then if [[ "$(echo $line | cut -d" " -f3)" = "" ]] then global_source_path=`echo $line | cut -d" " -f2` fi fi done < tmp_mrun line="" found=false grep " $localhost" $config_file | grep "%source_path" > tmp_mrun while read line do if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then if [[ $found = true ]] then printf "\n\n +++ more than one source path found in configuration file" printf "\n for local host \"$localhost\" " locat=source_path; exit fi source_path=`echo $line | cut -d" " -f2` found=true fi done < tmp_mrun rm tmp_mrun if [[ "$source_path" = "" ]] then if [[ "$global_source_path" != "" ]] then source_path=$global_source_path else printf "\n\n +++ no source path found in configuration file" printf "\n for local host \"$localhost\" " locat=source_path; exit fi fi eval source_path=$source_path if [[ ! -d $source_path ]] then printf "\n\n +++ source path \"$source_path\" on local host" printf "\n \"$localhost\" does not exist" locat=source_path; exit fi fi # NOCHMAL PRUEFEN, OB AUF REMOTE-MASCHINE GERECHNET WERDEN SOLL # (HOST KANN IN KONFIGURATIONSDATEI ANDERS FESTGELEGT WORDEN SEIN) # WERT VON do_remote WIRD FUER DATEIVERBINDUNGEN BENOETIGT. # WENN AUF REMOTE-MASCHINE GERECHNET WIRD, IST GLEICHZEITIG KLAR, # DASS EIN BATCH-JOB GESTARTET WERDEN MUSS if [[ -n $host && "$host" != $localhost ]] then do_batch=true do_remote=true case $host in (ibm|ibmb|ibmh|ibms|ibmy|lctit|nech|neck|unics) true;; (*) printf "\n" printf "\n +++ execution host \"$host\" not admitted for MRUN," printf "\n or no queueing system available on execution host!" locat=nqs; (( iec = 0 )); exit;; esac else host=$localhost fi # PRUEFUNG EINIGER PROZESSORZAHLANGABEN BEI RECHNUNGEN AUF PARALLELRECHNERN if [[ "$cond1" = parallel || "$cond2" = parallel ]] then # PRUEFEN, OB DIE ANZAHL DER ZU VERWENDENDEN PES ANGEGEBEN WURDE if [[ ! -n $numprocs ]] then printf "\n" printf "\n +++ option \"-K parallel\" requires additional specification" printf "\n of the number of processors to be used by" printf "\n mrun-option \"-X\" or by environment-variable" printf "\n \"numprocs\" in the configuration file" locat=numprocs; (( iec = 0 )); exit fi # PRUEFEN, OB DIE PROZESSORANZAHL PRO KNOTEN ANGEGEBEN WURDE (GGF. # DEFAULT-WERT SETZEN) UND OB SIE EIN GANZZAHLIGER TEILER DER # GESAMTPROZESSORANZAHL IST if [[ $host = nech || $host = neck || $host = ibmh || $host = ibmb || $host = ibms ]] then [[ "$tasks_per_node" = "" ]] && tasks_per_node=6 (( ival = $tasks_per_node )) (( pes = numprocs )) # if [[ $(echo $package_list | grep -c dvrp_graphics+1PE) = 1 ]] # then # (( pes = pes - 1 )) # fi (( ii = pes / ival )) if (( pes - ii * ival > 0 )) then printf "\n" printf "\n +++ tasks per node (option \"-T\") must be an integral" printf "\n divisor of the total number of processors (option \"-X\")" printf "\n values of this mrun-call: \"-T $tasks_per_node\" \"-X $numprocs\"" locat=tasks_per_node; (( iec = 0 )); exit fi fi # IBMY HAT NUR EINEN KNOTEN if [[ $host = ibmy ]] then if [[ "$tasks_per_node" != "" && "$tasks_per_node" != "$numprocs" ]] then printf "\n" printf "\n +++ on ibmy, tasks per node (option \"-T\") must be equal to the" printf "\n total number of processors (option \"-X\")" printf "\n values of this mrun-call: \"-T $tasks_per_node\" \"-X $numprocs\"" locat=tasks_per_node; (( iec = 0 )); exit fi fi # FALLS OPENMP PARALLELISIERUNG VERWENDET WERDEN SOLL, ANZAHL VON THREADS # SETZEN UND ZAHL DER TASKS PRO KNOTEN AUF 1 SETZEN if [[ $use_openmp = true ]] then threads_per_task=$tasks_per_node tasks_per_node=1 fi OOPT="-O $threads_per_task" TOPT="-T $tasks_per_node" # GESAMTZAHL DER KNOTEN BESTIMMEN if [[ "$tasks_per_node" != "" ]] then (( nodes = numprocs / ( tasks_per_node * threads_per_task ) )) fi # PRUEFEN, OB NODE USAGE EINEN ERLAUBTEN WERT HAT BZW. DEN DEFAULT # SETZEN if [[ $node_usage = default ]] then if [[ $host = ibms ]] then node_usage=shared else node_usage=not_shared fi fi if [[ $node_usage != shared && $node_usage != not_shared ]] then printf "\n" printf "\n +++ node usage (option \"-n\") is only allowed to be set" printf "\n \"shared\" or \"not_shared\"" locat=tasks_per_node; (( iec = 0 )); exit fi fi # PRUEFEN, OB HOSTFILE EXISTIERT if [[ -n $hostfile ]] then if [[ ! -f $hostfile ]] then printf "\n" printf "\n +++ hostfile \"$hostfile\" does not exist" locat=hostfile; exit fi fi # PRUEFEN, OB RHOSTS DATEI EXISTIERT. GEGEBENENFALLS ANLEGEN BZW. ERWEITERN if [[ $host = ibmy && $do_remote = false ]] then if [[ ! -f $HOME/.rhosts ]] then echo "gfdl5.yonsei.ac.kr" > $HOME/.rhosts printf "\n\n *** file:" printf "\n $HOME/.rhosts" printf "\n was created\n" fi if [[ $(grep -c gfdl5.yonsei.ac.kr $HOME/.rhosts) = 0 ]] then echo "gfdl5.yonsei.ac.kr" >> $HOME/.rhosts printf "\n\n *** file:" printf "\n $HOME/.rhosts" printf "\n was extended by the name of the current host\n" fi fi # DEFAULT-DATEITRANSFER-PROTOKOLL FESTLEGEN if [[ "$filetransfer_protocol" = "" ]] then case $host in (nech|neck|ibm|ibmb|ibmh|ibms|ibmy|lctit) filetransfer_protocol=scp;; (*) filetransfer_protocol=ftp;; esac fi # PRUEFEN, OB ZULAESSIGES DATEITRANSFER-PROTOKOLL GEWAEHLT WURDE if [[ "$filetransfer_protocol" != ftp && "$filetransfer_protocol" != scp ]] then printf "\n" printf "\n +++ illegal value \"$filetransfer_protocol\" for Option -f" printf "\n only \"ftp\" or \"scp\" are allowed" locat=options; exit fi # FALLS NICHT VORGEGEBEN, DEFAULT-QUEUE AUF DER ZIELMASCHINE FESTLEGEN if [[ $queue = none ]] then case $host in (ibmb) if [[ $node_usage = shared ]] then queue=cshare else queue=csolo fi;; (ibmh) if [[ $node_usage = shared ]] then queue=cshare else queue=csolo fi;; (ibmy) queue=parallel;; (lctit) queue=default;; (nech) queue=none;; (neck) queue=P;; (unics) queue=unics;; esac fi # EVTL. NETCDF-UNTERSTUETZUNG SETZEN case $host in (decalpha) netcdf_support=true netcdf_path=/usr/local/netcdf-3.5.1;; (ibmb|ibmh) netcdf_support=true netcdf_path=/aws/dataformats/netcdf-3.6.0-p1/64-32;; (ibms) netcdf_support=true netcdf_path=/applic/lib/NETCDF64;; (ibmy) netcdf_support=true netcdf_path=/usr1/users/raasch/pub/netcdf-3.6.0-p1;; (lcmuk) netcdf_support=true if [[ $scirocco = true ]] then netcdf_path=/opt/netcdf/3.6.2-beta4 else netcdf_path=/muksoft/packages/netcdf/linux fi;; (lctit) netcdf_support=true netcdf_path=/home2/usr5/mkanda/netcdf-3.6.1;; (nech) netcdf_support=true netcdf_path=/pool/SX-6/netcdf/netcdf-3.6.0-p1;; (neck) netcdf_support=true netcdf_path=/home/DSRC/NC/tatuyama/pub/netcdf-3.6.0-p1;; esac # VOLLSTAENDIGE DATEINAMEN DER INPUT-FILES BILDEN, # INPUT-DATEIEN AUF VORHANDENSEIN PRUEFEN UND EVTL. HOECHSTE ZYKLUSNUMMER # ERMITTELN (( i = 0 )) while (( i < iin )) do (( i = i + 1 )) (( maxcycle = 0 )) # NAMENSBILDUNG (EVTL. IST FESTER DATEINAME VORGEGEBEN) if [[ "${actionin[$i]}" = di ]] then remotepathin[$i]=${pathin[$i]}/${endin[$i]} # REMOTE-PFAD ERST AUF # REM-MASCHINE AUSWERTEN eval filename=${pathin[$i]}/${endin[$i]} else remotepathin[$i]=${pathin[$i]}/${afname}${endin[$i]} # REMOTE-PFAD ERST AUF # REM-MASCHINE AUSWERTEN eval filename=${pathin[$i]}/${afname}${endin[$i]} fi # PRUEFEN AUF VORHANDENSEIN if [[ $(ls $filename* 2>&1 | grep -c "not found") = 1 || \ $(ls $filename* 2>&1 | grep -c "No such file") = 1 || \ $(ls $filename* 2>&1 | grep -c "does not exist") = 1 ]] then # DATEIEN MIT EXTENSION (Z.B. NC) MUESSEN NICHT ZWINGEND VORHANDEN # SEIN, DESHALB IN SOLCHEN FAELLEN KEIN ABBRUCH. DIES IST NUR EINE # VORUEBERGEHENDE LOESUNG (OKT 05). NICHT ZWINGEND BENOETIGTE # EINGABEDATEIEN SOLLTEN EINE SPEZIELLE OPTION IN DER DATEI- # VERBINDUNGSANWEISUNG BEKOMMEN (Z.B. inopt?) if [[ "${transin[$i]}" != "locopt" ]] then printf "\n\n +++ INPUT-file: " if [[ "${extin[$i]}" = "" ]] then printf "\n $filename" else printf "\n $filename.${extin[$i]}" fi printf "\n does not exist\n" locat=input; exit else transin[$i]="unavailable" fi else # ZYKLUSNUMMER FESTSTELLEN ls -1 -d $filename > filelist 2>/dev/null ls -1 -d $filename.* >> filelist 2>/dev/null while read zeile do cycle=$(print $zeile | cut -f2 -d".") if [[ "$cycle" = "$zeile" ]] then (( icycle = 0 )) elif [[ "$cycle" = "${extin[$i]}" ]] then (( icycle = 0 )) else (( icycle = $cycle )) fi if (( icycle > maxcycle )) then (( maxcycle = icycle )) file_to_be_used=$zeile fi done 0 )) then if [[ "${extin[$i]}" != " " && "${extin[$i]}" != "" ]] then filename=${filename}.$maxcycle.${extin[$i]} else filename=${filename}.$maxcycle fi else if [[ "${extin[$i]}" != " " && "${extin[$i]}" != "" ]] then filename=${filename}.${extin[$i]} fi fi # DATEINAMEN OHNE PFAD ABER MIT ZYKLUSNUMMER ABSPEICHERN, # DA SPAETER BEI RUECKSPEICHERN VOM ARCHIVSYSTEM EVTL. BENOETIGT absnamein[$i]=$filename if (( maxcycle > 0 )) then if [[ "${actionin[$i]}" = di ]] then frelin[$i]=${endin[$i]}.$maxcycle else frelin[$i]=${afname}${endin[$i]}.$maxcycle fi else if [[ "${actionin[$i]}" = di ]] then frelin[$i]=${endin[$i]} else frelin[$i]=${afname}${endin[$i]} fi fi fi done # VOLLSTAENDIGE DATEINAMEN (OHNE $ ODER ~) DER OUTPUT-FILES BILDEN, # OUTPUT-DATEIEN AUF VORHANDENSEIN PRUEFEN UND EVTL. HOECHSTE ZYKLUSNUMMER # ERMITTELN ODER, FALLS NICHT VORHANDEN, PRUEFEN, OB SIE SICH ANLEGEN LASSEN # DIESE AKTIONEN FINDEN NICHT STATT, WENN PROGRAMM AUF REMOTE-MASCHINE # RECHNET UND DATEI ANSCHLIESSEND TRANSFERIERT WERDEN SOLL! (( i = 0 )) while (( i < iout )) do (( i = i + 1 )) if [[ ! ( $fromhost != $localhost && ( "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ) ) ]] then if [[ "${actionout[$i]}" = tr || "${actionout[$i]}" = trpe ]] then actionout[$i]="" elif [[ "${actionout[$i]}" = tra ]] then actionout[$i]=a fi (( maxcycle = 0 )) eval filename=${pathout[$i]}/${fname}${endout[$i]} eval catalogname=${pathout[$i]} if [[ $(ls $filename* 2>&1 | grep -c "not found") = 1 || \ $(ls $filename* 2>&1 | grep -c "No such file") = 1 || \ $(ls $filename* 2>&1 | grep -c "does not exist") = 1 ]] then # OUTPUT-DATEI NICHT VORHANDEN. PRUEFEN, OB ANLEGEN MOEGLICH. if cat /dev/null > $filename then rm $filename else # PRUEFEN, OB KATALOG VORHANDEN UND EVTL. DIESEN ANLEGEN if [[ ! -d $catalogname ]] then if mkdir -p $catalogname then printf "\n\n *** directory:" printf "\n $catalogname" printf "\n was created\n" else printf "\n\n +++ OUTPUT-file:" printf "\n $filename" printf "\n cannot be created, because directory does not exist" printf "\n and cannot be created either" printf "\n" locat=output ; exit fi 2>/dev/null else printf "\n\n +++ OUTPUT-file:" printf "\n $filename" printf "\n cannot be created, although directory exists" printf "\n" locat=output ; exit fi fi 2>/dev/null else # ZYKLUSNUMMER FESTSTELLEN ls -1 -d $filename > filelist 2>/dev/null ls -1 -d $filename.* >> filelist 2>/dev/null while read zeile do cycle=$(print $zeile | cut -f2 -d".") if [[ "$cycle" = "$zeile" || "$cycle" = ${extout[$i]} ]] then (( icycle = 1 )) else (( icycle = $cycle + 1 )) fi if (( icycle > maxcycle )) then (( maxcycle = icycle )) fi done 0 )) then filename=${filename}.$maxcycle if cat /dev/null > $filename then rm $filename else printf "\n +++ OUTPUT-file:" printf "\n $filename" printf "\n cannot be created" locat=output ; exit fi fi else (( maxcycle = maxcycle - 1 )) if (( maxcycle > 0 )) then filename=${filename}.$maxcycle fi fi # DATEINAMEN OHNE PFAD ABER MIT ZYKLUSNUMMER ABSPEICHERN, # DA SPAETER BEI ABLAGE AUF ARCHIVSYSTEM BZW. FUER # DATEI OUTPUT_FILE_CONNECTIONS EVTL. BENOETIGT pathout[$i]=$filename if (( maxcycle > 0 )) then frelout[$i]=${fname}${endout[$i]}.$maxcycle else frelout[$i]=${fname}${endout[$i]} fi fi done # PRUEFEN, OB ENTWEDER HAUPTPROGRAMM ODER NUR EIN AUSFUEHRBARES # PROGRAMM VEREINBART WURDE (IN DIESEM FALL BRAUCHT IM WEITEREN NICHT # UEBERSETZT ZU WERDEN) if [[ "$mainprog" = "" && "$executable" = "" ]] then printf "\n +++ neither main program nor executable defined" locat=source; exit elif [[ "$mainprog" != "" && "$executable" != "" ]] then printf "\n +++ main program as well as executable defined" locat=source; exit elif [[ "$mainprog" = "" && "$executable" != "" ]] then do_compile=false fi # ALLE ZU UEBERSETZENDEN PROGRAMMTEILE ZUSAMMENSAMMELN # BEI BATCH-JOBS IST DIES NICHT NOETIG, WEIL DIE PROGRAMMTEILE BEREITS DURCH # DEN MRUN-AUFRUF ERMITTELT SIND, DER DEN BATCH-JOB GENERIERT HAT, UND # IM VERZEICHNIS SOURCES_FOR_RUN_... ABGELEGT SIND if [[ $do_compile = true && "$SOURCES_COMPLETE" = "" ]] then [[ "$source_list" = LM ]] && source_list=LOCALLY_MODIFIED [[ "$source_list" = WP ]] && source_list=WRITE_PERMIT if [[ $restart_run != true ]] then rm -rf SOURCES_FOR_RUN_$fname mkdir SOURCES_FOR_RUN_$fname fi # EVTL. ZU UEBERSETZENDE PROGRAMMTEILE DADURCH BESTIMMEN, DASS GEPRUEFT # WIRD, WELCHE DATEIEN WRITE-PERMIT BESITZEN (DATEIEN SOLLTEN DESHALB # UNTER RCS-KONTROLLE STEHEN). MIT DER VARIABLEN EXCLUDE KOENNEN # BESTIMMTE DATEIEN GRUNDSAETZLICH VON DER UEBERSETZUNG AUSGESCHLOSSEN # WERDEN. DIES IST NUR BEI MANUELLEM START VON MRUN DURCH DEN BENUTZER # MOEGLICH, DA BEI AUTOMATISCHEN RESTARTS TEST DURCH DIE TATSAECHLICH # ZU UBERSETZENDEN DATEIEN ERSETZT IST. # ALLE ERMITTELTEN DATEIEN WERDEN IM VERZEICHNIS SOURCES_FOR_RUN_... # GESAMMELT if [[ "$source_list" = WRITE_PERMIT ]] then source_list="" cd $source_path # ALLE MOEGLICHEN QUELLCODEDATEIEN AUFLISTEN Names=$(ls -1 *.f90 2>&1) [[ $(echo $Names | grep -c '*.f90') = 0 ]] && Filenames="$Names" Names=$(ls -1 *.F90 2>&1) [[ $(echo $Names | grep -c '*.F90') = 0 ]] && Filenames="$Filenames $Names" Names=$(ls -1 *.F 2>&1) [[ $(echo $Names | grep -c '*.F') = 0 ]] && Filenames="$Filenames $Names" Names=$(ls -1 *.f 2>&1) [[ $(echo $Names | grep -c '*.f') = 0 ]] && Filenames="$Filenames $Names" Names=$(ls -1 *.c 2>&1) [[ $(echo $Names | grep -c '*.c') = 0 ]] && Filenames="$Filenames $Names" # DATEIEN MIT WRITE-PERMIT NACH SOURCES_FOR_RUN_... KOPIEREN for dateiname in $Filenames do if [[ -w $dateiname ]] then if [[ "$exclude" = "" || $(echo $exclude | grep -c $dateiname) = 0 ]] then cp $dateiname $working_directory/SOURCES_FOR_RUN_$fname source_list=$source_list"$dateiname " fi fi done cd - > /dev/null elif [[ "$source_list" = LOCALLY_MODIFIED ]] then # MODIFIZIERTE DATEIEN DER SVN-ARBEITSKOPIE BESTIMMEN source_list="" cd $source_path # PRUEFEN, OB VERZEICHNIS UEBERHAUPT UNTER SVN-KONTROLLE STEHT if [[ ! -d .svn ]] then printf "\n\n +++ source directory" printf "\n \"$source_path\" " printf "\n is not under control of \"subversion\"." printf "\n Please do not use mrun-option \"-s LOCALLY MODIFIED\"\n" fi # ALLE MODIFIZIERTEN QUELLCODEDATEIEN AUFLISTEN Filenames="" svn status | while read line do firstc=`echo $line | cut -c1` if [[ $firstc = M || $firstc = "?" ]] then Name=`echo "$line" | cut -c8-` extension=`echo $Name | cut -d. -f2` if [[ "$extension" = f90 || "$extension" = F90 || "$extension" = f || "$extension" = F || "$extension" = c ]] then Filenames="$Filenames "$Name fi fi done # DATEIEN NACH SOURCES_FOR_RUN_... KOPIEREN for dateiname in $Filenames do cp $dateiname $working_directory/SOURCES_FOR_RUN_$fname source_list=$source_list"$dateiname " done cd - > /dev/null # MITTELS OPTION -s ANGEGEBENE DATEIEN NACH SOURCES_FOR_RUN_... KOPIEREN # BEI AUTOMATISCHEN FORTSETZUNGSLAEUFEN SIND DORT SCHON ALLE DATEIEN # VORHANDEN elif [[ "$source_list" != "" && $restart_run != true ]] then cd $source_path for filename in $source_list do # QUELLTEXT-DATEI DARF KEINE PFADE BEINHALTEN if [[ $(print $filename | grep -c "/") != 0 ]] then printf "\n +++ source code file: $filename" printf "\n must not contain (\"/\") " locat=source; exit fi if [[ ! -f $filename ]] then printf "\n +++ source code file: $filename" printf "\n does not exist" locat=source; exit else cp $filename $working_directory/SOURCES_FOR_RUN_$fname fi done cd - > /dev/null fi # PRUEFEN, OB ENTWEDER HAUPTPROGRAMM VORHANDEN UND ES EVTL. IN DER # LISTE DER ZU UEBERSETZENDEN PROGRAMMTEILE MIT ENTHALTEN IST (WENN # NICHT, WIRD ES DIESER LISTE HINZUGEFUEGT) if [[ $restart_run != true ]] then if [[ ! -f "$source_path/$mainprog" ]] then printf "\n\n +++ main program: $mainprog" printf "\n does not exist in source directory" printf "\n \"$source_path\"\n" locat=source; exit else if [[ $(echo $source_list | grep -c $mainprog) = 0 ]] then cp $source_path/$mainprog SOURCES_FOR_RUN_$fname source_list=${mainprog}" $source_list" fi fi fi # DATEIEN AUS ZUSAETZLICHEM QUELLVERZEICHNIS HINZUFUEGEN if [[ $restart_run != true && "$add_source_path" != "" ]] then # GIBT ES DAS VERZEICHNIS UEBERHAUPT? if [[ ! -d $add_source_path ]] then printf "\n\n +++ WARNING: additional source code directory" printf "\n \"$add_source_path\" " printf "\n does not exist or is not a directory." printf "\n No source code will be used from this directory!\n" add_source_path="" sleep 3 else cd $add_source_path Names=$(ls -1 *.f90 2>&1) [[ $(echo $Names | grep -c '*.f90') = 0 ]] && AddFilenames="$Names" Names=$(ls -1 *.F90 2>&1) [[ $(echo $Names | grep -c '*.F90') = 0 ]] && AddFilenames="$AddFilenames $Names" Names=$(ls -1 *.F 2>&1) [[ $(echo $Names | grep -c '*.F') = 0 ]] && AddFilenames="$AddFilenames $Names" Names=$(ls -1 *.f 2>&1) [[ $(echo $Names | grep -c '*.f') = 0 ]] && AddFilenames="$AddFilenames $Names" Names=$(ls -1 *.c 2>&1) [[ $(echo $Names | grep -c '*.c') = 0 ]] && AddFilenames="$AddFilenames $Names" cd - > /dev/null cd SOURCES_FOR_RUN_$fname for dateiname in $AddFilenames do if [[ -f $dateiname ]] then printf "\n +++ source code file \"$dateiname\" found in additional" printf "\n source code directory \"$add_source_path\" " printf "\n as well as in directory \"$source_path\"." locat=source; exit fi cp $add_source_path/$dateiname . source_list="$source_list $dateiname" # Default User-Interface von der Liste entfernen, falls Datei # ein User-Interface enthaelt if [[ $( cat $dateiname | grep -c "END SUBROUTINE user_parin" ) != 0 ]] then if [[ $dateiname != user_interface.f90 && -f user_interface.f90 ]] then rm -rf user_interface.f90 source_list=`echo $source_list | sed -e 's/user_interface.f90//'` printf "\n\n *** default \"user_interface.f90\" removed from the files to be translated" printf "\n since a user-interface is found in file" printf "\n \"$add_source_path/$dateiname\" \n" sleep 3 else printf "\n\n *** user-interface file \"$dateiname\" " printf "\n added to the files to be translated \n" sleep 3 fi fi done cd - > /dev/null fi fi # ALLE UNTERPROGRAMME, DIE ZU VEREINBARTEN SOFTWAREPAKETEN GEHOEREN, # DER LISTE DER ZU UEBERSETZENDEN DATEIEN HINZUFUEGEN if [[ $restart_run != true && -n $package_list ]] then cd $source_path for package in $package_list do [[ $package = "dvrp_graphics+1PE" ]] && package=dvrp_graphics # ERMITTELE ALLE DATEIEN, DIE ZUM PAKET GEHOEREN # FEHLERMELDUNGEN WERDEN ABGEFANGEN, DA * AUCH VERZEICHNISSNAMEN # LIEFERT package_source_list=`grep "defined( __$package " * 2>/dev/null | cut -f1 -d:` # FUEGE DIESE DATEIEN DER LISTE DER ZU UEBERSETZENDEN DATEIEN # HINZU, FALLS SIE NOCH NICHT DAZUGEHOEREN for source_list_name in $package_source_list do if [[ $(echo $source_list | grep -c $source_list_name) = 0 ]] then # NUR DATEIEN MIT GUELTIGEN ENDUNGEN VERWENDEN ending=`echo $source_list_name | cut -f2 -d.` if [[ "$ending" = f90 || "$ending" = F90 || "$ending" = f || "$ending" = F || "$ending" = c ]] then cp $source_list_name $working_directory/SOURCES_FOR_RUN_$fname source_list="$source_list $source_list_name" fi fi done done cd - > /dev/null fi # MAKEFILE AUF VORHANDENSEIN PRUEFEN UND KOPIEREN # BEI RESTART-LAEUFEN LIEGT ES SCHON IM VERZEICHNIS SOURCES_FOR_RUN... if [[ "$use_makefile" = true && "$restart_run" != true ]] then [[ "$makefile" = "" ]] && makefile=$source_path/Makefile if [[ ! -f $makefile ]] then printf "\n +++ file \"$makefile\" does not exist" printf "\n provide this file or set \"use_makefile=false\" in configuration file\n" locat=make; exit else cp $makefile SOURCES_FOR_RUN_$fname/Makefile fi fi fi # do_compile=true # FALLS PROGRAMMTEILE UEBERSETZT WERDEN SOLLEN, FOLGEN JETZT EINIGE # UEBERPRUEFUNGEN UND DAS SETZEN DER PRAEPROZESSOR-DIREKTIVEN if [[ $do_compile = true ]] then # PRAEPROZESSOR-DIREKTIVEN ZUM SELEKTIVEN AUSWAEHLEN VON CODETEILEN # ZUSAMMENSETZEN if [[ $(echo $localhost | cut -c1-3) = ibm ]] then PPOPTS=-Dibm=ibm elif [[ $(echo $localhost | cut -c1-3) = nec ]] then PPOPTS=-Dnec else PPOPTS=-D$localhost fi if [[ $(echo $localhost | cut -c1-3) = ibm ]] then [[ -n $cond1 ]] && PPOPTS="$PPOPTS -D$cond1=$cond1" [[ -n $cond2 ]] && PPOPTS="$PPOPTS -D$cond2=$cond2" if [[ $netcdf_support = true ]] then PPOPTS="$PPOPTS -Dnetcdf=netcdf" [[ $localhost != ibms ]] && PPOPTS="$PPOPTS -Dnetcdf_64bit=netcdf_64bit" fi if [[ $localhost = ibmy ]] then PPOPTS="$PPOPTS -Dibmy_special=ibmy_special" fi else [[ -n $cond1 ]] && PPOPTS="$PPOPTS -D$cond1" [[ -n $cond2 ]] && PPOPTS="$PPOPTS -D$cond2" if [[ $netcdf_support = true ]] then PPOPTS="$PPOPTS -Dnetcdf" [[ $localhost != decalpha && $localhost != lctit ]] && PPOPTS="$PPOPTS -Dnetcdf_64bit" fi fi if [[ -n $package_list ]] then for package in $package_list do if [[ $(echo $localhost | cut -c1-3) = ibm ]] then if [[ $package != "dvrp_graphics+1PE" ]] then PPOPTS="$PPOPTS -D$package=$package" else PPOPTS="$PPOPTS -Ddvrp_graphics" export use_seperate_pe_for_dvrp_output=true fi else if [[ $package != "dvrp_graphics+1PE" ]] then PPOPTS="$PPOPTS -D$package" else PPOPTS="$PPOPTS -Ddvrp_graphics" export use_seperate_pe_for_dvrp_output=true fi fi done fi if [[ -n $cpp_opts ]] then for popts in $cpp_opts do PPOPTS="$PPOPTS -D$popts" done fi # -D ARGUMENTEN EINEN DOPPELTEN UNTERSTRICH VORANSTELLEN PPOPTS=`echo " $PPOPTS" | sed 's/ -D/ -D__/g'` # OPTION ZUM EINSCHALTEN DES PRAEPROZESSORS HINZUFUEGEN if [[ $host = decalpha ]] then C_PPOPTS="-cpp -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION $PPOPTS" elif [[ $(echo $host | cut -c1-3) = ibm ]] then # blanks in PPOPTS muessen durch "," ersetzt werden PPOPTS=`echo $PPOPTS | sed 's/ -/,-/g'` C_PPOPTS="-qsuffix=cpp=f90 -WF,-DMPI_REAL=MPI_DOUBLE_PRECISION,$PPOPTS" elif [[ $host = lcmuk ]] then C_PPOPTS="$PPOPTS -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION" elif [[ $host = lctit ]] then C_PPOPTS="$PPOPTS -Mpreprocess -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION" elif [[ $(echo $host | cut -c1-3) = nec ]] then C_PPOPTS="-Ep -DMPI_REAL=MPI_REAL8 -DMPI_2REAL=MPI_2REAL8 -DSCFFT=dzfft -DCSFFT=zdfft $PPOPTS" else C_PPOPTS="$PPOPTS" fi else # BEI LOKALEN RECHNUNGEN PRUEFEN, OB EXECUTABLE VORHANDEN if [[ $do_remote = false ]] then if [[ ! -f $executable ]] then printf "\n +++ executable file: $executable" printf "\n does not exist" locat=executable; exit fi fi fi # JOBMODUS FESTSTELLEN if [[ "$ENVIRONMENT" = BATCH && $localhost != lctit || "$QUEUE" != interactive && $localhost = lctit ]] then jobmo=BATCH else jobmo=INTERACTIVE fi # HOSTSPEZIFISCHE DEFAULT-COMPILER SETZEN, FALLS NICHT BEREITS # DURCH BENUTZER ANDERWEITIG VEREINBART if [[ "$compiler_name" = "" ]] then case $localhost in (unics) compiler_name=f77;; (lcmuk) if [[ "$cond1" = parallel || "$cond2" = parallel ]] then compiler_name=mpif90 else compiler_name=ifc fi;; (lctit) if [[ "$cond1" = parallel || "$cond2" = parallel ]] then compiler_name=mpif90 echo ">>> compiler=mpif90" else compiler_name=pgf95 echo ">>> compiler=pgf95" fi;; (nech) compiler_name=sxmpif90;; (decalpha) compiler_name=f95;; (ibm|ibmb|ibmh|ibms|ibmy) compiler_name=mpxlf95_r;; (*) printf "\n +++ unknown host name: $localhost \n"; locat=localhost; exit;; esac fi # COMPILER AUF NECK UEBERSCHREIBEN [[ $localhost = neck ]] && compiler_name=mpif90 # PRAEPROZESSOR-PFAD BESTIMMEN case $localhost in (decalpha|ibm|ibmb|ibmh|ibms|ibmy|unics) praeproc=cpp;; esac # TEMPORAEREN KATALOGNAMEN BESTIMMEN kennung=$RANDOM if [[ "$tmp_user_catalog" = "" ]] then if [[ $localhost = ibmb || $localhost = ibmh ]] then tmp_user_catalog=$TMPDIR elif [[ $localhost = nech ]] then tmp_user_catalog=$WRKSHR else tmp_user_catalog=/tmp fi fi TEMPDIR=$tmp_user_catalog/${usern}.$kennung # KATALOGNAMEN FUER ZWISCHENSPEICHERUNG VON FORTSETZUNGSLAUFDATEIEN # BESTIMMEN if [[ "$tmp_data_catalog" = "" ]] then if [[ $localhost = ibmb || $localhost = ibmh ]] then tmp_data_catalog=$WORK/mrun_restart_data elif [[ $localhost = nech ]] then tmp_data_catalog=$WRKSHR/mrun_restart_data else tmp_data_catalog=/tmp/mrun_restart_data fi fi # EVENTUELL BEI LOKALEN RECHNUNGEN $-ZEICHEN IN ENVIRONMENT-VARIABLEN # ERSETZEN if [[ $do_remote = false && $do_compile = true ]] then eval fopts=\"$fopts\" eval lopts=\"$lopts\" fi # COMPILE- UND LINK-OPTIONEN BESTIMMEN FOPTS="$fopts" LOPTS="$lopts" ROPTS="$ropts" if [[ ( $(echo $host | cut -c1-3) = nec || $(echo $host | cut -c1-3) = ibm || $host = lctit ) && -n $numprocs ]] then XOPT="-X $numprocs" fi # BEI VERWENDUNG VON DVRP-SOFTWARE MUSS ENTSPECHENDE GRAFIK-BIBLIOTHEK # MIT EINGEBUNDEN WERDEN if [[ -n $package_list ]] then if [[ $(echo $package_list | grep -c dvrp_graphics) != 0 ]] then # DVRP-GRAFIK GIBT ES NUR AUF DER IBM AM HLRN, AUF NECH/NECK UND # DEM NOTEBOOK SCIROCCO if [[ $host != ibmh && $host != nech && $host != neck && $host != lcmuk && "$local_compile" != true ]] then printf "\n" printf "\n +++ option -p with package \"dvrp_graphics\" only allowed on nech and ibmh" locat=parameter; exit fi if [[ $host = ibmh ]] then if [[ $cond1 = debug || $cond2 = debug ]] then FOPTS="-I/home/h/hzazchmi/lib/debug $FOPTS" LOPTS="$LOPTS -L/home/h/hzazchmi/lib/debug -lDVRP2 -lftp" else FOPTS="-I/home/h/nikevita/lib_stable/optimize $FOPTS" LOPTS="$LOPTS -L/home/h/nikevita/lib_stable/optimize -lDVRP2 -lftp" fi elif [[ $host = nech ]] then FOPTS="-I/import/ds9b/ipf2/b/b323014/lib/optimize $FOPTS" LOPTS="$LOPTS -L/import/ds9b/ipf2/b/b323014/lib/optimize -lDVRP2 -lftp" elif [[ $host = neck ]] then FOPTS="-I/home/DSRC/NC/tatuyama/pub/dvrp $FOPTS" LOPTS="$LOPTS -L/home/DSRC/NC/tatuyama/pub/dvrp -lDVRP2 -lftp" elif [[ $host = lcmuk ]] then FOPTS="-I/usr/local/lib/dvrp/optimize $FOPTS" LOPTS="$LOPTS -L/usr/local/lib/dvrp/optimize -lDVRP2 -lftp" fi fi fi # EVTL. EINBINDEN DER NETCDF-BIBLIOTHEK if [[ $netcdf_support = true ]] then case $host in (decalpha) FOPTS="-I${netcdf_path}/include $FOPTS" LOPTS="$LOPTS -L${netcdf_path}/lib -lnetcdf";; (ibmb|ibmh) FOPTS="-I ${netcdf_path}/include-64 $FOPTS" LOPTS="$LOPTS -L${netcdf_path}/lib -lnetcdf";; (ibms) FOPTS="-I /applic/netcdf64/src/f90 $FOPTS" LOPTS="$LOPTS -L${netcdf_path} -lnetcdf";; (ibmy) FOPTS="-I ${netcdf_path}/include $FOPTS" LOPTS="$LOPTS -L${netcdf_path}/lib -lnetcdf";; (lcmuk|nech|neck) FOPTS="-I ${netcdf_path}/include $FOPTS" LOPTS="$LOPTS -L${netcdf_path}/lib -lnetcdf";; (lctit) FOPTS="-I ${netcdf_path}/src/f90 $FOPTS" LOPTS="$LOPTS -L${netcdf_path}/src/libsrc -lnetcdf";; esac fi # PRUEFEN DER CPU-ZEIT. (CPUMAX WIRD ALS ENV-VARIABLE VOM HAUTPRO- # GRAMM BENOETIGT done=false while [[ $done = false ]] do cputime=$cpumax if (( $cputime == 0 )) then printf "\n +++ cpu-time is undefined" printf "\n >>> Please type CPU-time in seconds as INTEGER:" printf "\n >>> " read cputime 1>/dev/null 2>&1 else done=true fi cpumax=$cputime done (( minuten = cputime / 60 )) (( sekunden = cputime - minuten * 60 )) # PRUEFEN DER KERNSPEICHERANFORDERUNG if [[ $do_batch = true ]] then done=false while [[ $done = false ]] do if (( memory == 0 )) then printf "\n +++ memory demand is undefined" printf "\n >>> Please type memory in MByte per process as INTEGER:" printf "\n >>> " read memory 1>/dev/null 2>&1 else done=true fi done fi # PRUEFEN, OB FUER REMOTE-RECHNUNGEN EIN BENUTZERNAME ANGEGEBEN WURDE if [[ $do_remote = true && -z $remote_username ]] then while [[ -z $remote_username ]] do printf "\n +++ username on remote host \"$host\" is undefined" printf "\n >>> Please type username:" printf "\n >>> " read remote_username done mc="$mc -u$remote_username" fi ########################################################################### # HEADER-AUSGABE ########################################################################### calltime=$(date) printf "\n" # [[ $silent = false ]] && clear printf "#--------------------------------------------------------------# \n" printf "| $version$calltime | \n" printf "| | \n" spalte1="called on:"; spalte2=$localhost_realname printf "| $spalte1$spalte2 | \n" if [[ $local_compile = false ]] then if [[ $do_remote = true ]] then spalte1="execution on:"; spalte2="$host (username: $remote_username)" else spalte1="execution on:"; spalte2="$host ($localhost_realname)" fi else spalte1="compiling test only!"; spalte2="" fi printf "| $spalte1$spalte2 | \n" if [[ -n $numprocs ]] then spalte1="number of PEs:"; spalte2=$numprocs printf "| $spalte1$spalte2 | \n" fi if [[ -n $tasks_per_node ]] then spalte1="tasks per node:"; spalte2="$tasks_per_node (number of nodes: $nodes)" printf "| $spalte1$spalte2 | \n" fi if [[ $threads_per_task != 1 ]] then spalte1="threads per task:"; spalte2="$threads_per_task" printf "| $spalte1$spalte2 | \n" fi printf "| | \n" if [[ $do_compile = true ]] then spalte1=cpp-directives:; spalte2=$C_PPOPTS printf "| $spalte1$spalte2 | \n" zeile=$(echo "$C_PPOPTS" | cut -c41-) while [[ "$zeile" != "" ]] do spalte1="" spalte2=$zeile printf "| $spalte1$spalte2 | \n" zeile=$(echo "$zeile" | cut -c41-) done spalte1=compiler-options:; spalte2="$FOPTS $MODULE_OPTIONS" printf "| $spalte1$spalte2 | \n" zeile=$(echo "$FOPTS $MODULE_OPTIONS" | cut -c41-) while [[ "$zeile" != "" ]] do spalte1="" spalte2=$zeile printf "| $spalte1$spalte2 | \n" zeile=$(echo "$zeile" | cut -c41-) done 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="main program":; spalte2=$mainprog printf "| $spalte1$spalte2 | \n" if [[ "$use_makefile" = true ]] then spalte1="using \"make\" for com"; spalte2="piling and linking" printf "| $spalte1$spalte2 | \n" fi # if [[ $vtk_graphics = true ]] # then # spalte1=""; spalte2="wird in C++ - Programm eingebunden (vtk)" # printf "| $spalte1$spalte2 | \n" # fi else spalte1=executable:; spalte2=$executable printf "| $spalte1$spalte2 | \n" fi printf "| | \n" spalte1="base name of files":; spalte2=$fname printf "| $spalte1$spalte2 | \n" if [[ $fname != $afname ]] then spalte1="base name of input files":; spalte2=$afname printf "| $spalte1$spalte2 | \n" fi spalte1="INPUT control list":; spalte2=$input_list printf "| $spalte1$spalte2 | \n" spalte1="OUTPUT control list":; spalte2=$output_list printf "| $spalte1$spalte2 | \n" if [[ $do_batch = true || "$LOADLBATCH" = yes ]] then spalte1="memory demand / PE":; spalte2="$memory MB" printf "| $spalte1$spalte2 | \n" spalte1=CPU-time:; spalte2="$minuten:$sekunden" printf "| $spalte1$spalte2 | \n" fi if [[ $do_compile = true ]] then printf "| | \n" printf "| Files to be compiled: | \n" zeile=$source_list while [[ "$zeile" != "" ]] do spalte3=$zeile printf "| $spalte3 | \n" zeile=$(echo "$zeile" | cut -c61-) done fi printf "#--------------------------------------------------------------#" # BEDINGTE AUSGABE DER DATEIVERBINDUNGEN if [[ $do_trace = true ]] then (( i = 0 )) while (( i < iin )) do (( i = i + 1 )) if (( i == 1 )) then printf "\n\n >>> INPUT-file assignments:\n" fi printf "\n ${localin[$i]} : ${absnamein[$i]}" done (( i = 0 )) while (( i < iout )) do (( i = i + 1 )) if (( i == 1 )) then printf "\n\n >>> OUTPUT-file assignments:\n" fi printf "\n ${localout[$i]} : ${pathout[$i]}" done (( i = 0 )) while (( i < iic )) do (( i = i + 1 )) if (( i == 1 )) then printf "\n\n >>> INPUT-commands:\n" fi printf "\n ${in_command[$i]}" done (( i = 0 )) while (( i < ioc )) do (( i = i + 1 )) if (( i == 1 )) then printf "\n\n >>> OUTPUT-commands:\n" fi printf "\n ${out_command[$i]}" done fi # ABFRAGEN BEI AUFRUF AUF LOKALER MASCHINE if [[ $remotecall = false && $silent = false && $jobmo != BATCH ]] then antwort=dummy printf "\n\n" while [[ "$antwort" != y && "$antwort" != Y && "$antwort" != n && "$antwort" != N ]] do printf " >>> everything o.k. (y/n) ? " read antwort done if [[ $antwort = n || $antwort = N ]] then locat=user_abort; (( iec = 0 )); exit fi if [[ $do_batch = true ]] then printf " >>> batch-job will be created and submitted" else if [[ $local_compile = false ]] then printf " >>> MRUN will now continue to execute on this machine" else printf " >>> a test compilation will now be carried out on this machine" fi fi fi # FALLS AUF DIESER MASCHINE GERECHNET WERDEN SOLL, WERDEN JETZT ENTSPRE- # CHENDE AKTIONEN DURCHGEFUEHRT if [[ $do_batch = false ]] then # TEMPORAEREN KATALOG ERZEUGEN mkdir -p $TEMPDIR chmod go+rx $TEMPDIR tmpcreate=true # SAEMTLICHE QUELLTEXT-DATEIEN BZW. AUSFUEHRBARES PROGRAMM IN # TEMPORAERES VERZEICHNIS KOPIEREN if [[ $do_compile = true ]] then # ON NEC, COMPILATION IS DONE ON HOST CROSS VIA CROSS COMPILING # CREATE A TEMPORARY DIRECTORY ON THAT MACHINE (HOME MOUNTED VIA NFS) if [[ $localhost = nech ]] then TEMPDIR_COMPILE=$HOME/work/${usern}.$kennung if mkdir -p $TEMPDIR_COMPILE then printf "\n *** \"$TEMPDIR_COMPILE\" " printf "\n is generated as temporary directory for cross compiling\n" else printf "\n +++ creating directory \"$TEMPDIR_COMPILE\" " printf "\n needed for cross compilation failed" locat=compile exit fi else TEMPDIR_COMPILE=$TEMPDIR fi if [[ "$use_makefile" = true ]] then # PFADNAMEN FUER DAS MAKE-DEPOSITORY ERMITTELN line="" grep "%depository_path" $config_file | while read line do if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] then global_depository_path=`echo $line | cut -d" " -s -f2` fi fi done line="" grep " $localhost" $config_file | grep "%depository_path" | while read line do if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then local_depository_path=`echo $line | cut -d" " -s -f2` fi done if [[ "$local_depository_path" = "" ]] then if [[ "$global_depository_path" != "" ]] then local_depository_path=$global_depository_path else printf "\n\n +++ no depository path found in configuration file" printf "\n for local host \"$localhost\" " printf "\n please set \"\%depository_path\" in configuration file\n" locat=config_file; exit fi fi eval local_depository_path=$local_depository_path basename=`print $mainprog | cut -f1 -d"."` eval make_depository=${local_depository_path}/${basename}_current_version.tar if [[ ! -f $make_depository ]] then printf "\n" printf "\n *** WARNING: make depository \"$make_depository\" not found" printf "\n \"make\" will fail, if the Makefile or other source files are missing\n" else cp $make_depository $TEMPDIR_COMPILE cd $TEMPDIR_COMPILE tar -xf $make_depository > /dev/null 2>&1 cd - > /dev/null fi cp SOURCES_FOR_RUN_$fname/* $TEMPDIR_COMPILE # FALLS USER-INTERFACE VORHANDEN UND AUF DATEI MIT ANDEREM NAMEN # ALS user_interface.f90 LIEGT, DIESEN GEAENDERTEN NAMEN INS # MAKEFILE EINTRAGEN cd $TEMPDIR_COMPILE interface_file=`grep -l "END SUBROUTINE user_parin" $source_list` if [[ "$interface_file" != "" ]] then interface_file=`echo $interface_file | cut -d"." -f1` mv Makefile Makefile_old sed "s/user_interface/$interface_file/g" Makefile_old > Makefile fi cd - > /dev/null fi else cp $executable ${TEMPDIR}/a.out fi # WECHSEL IN TEMPORAEREN KATALOG cd $TEMPDIR printf "\n *** changed to temporary directory: $TEMPDIR" # OUTPUT-DATEI-VERBINDUNGEN AUF TEMPORAERER DATEI ABLEGEN # DIESE DATEI KANN VON SPAETER AUFZURUFENDEN BENUTZERPROZEDUREN GELESEN # WERDEN, UM ZU LOKALEN DATEINAMEN GEHOERENDE PERMANENTE NAMEN ZU # ERMITTELN (( i = 0 )) while (( i < iout )) do (( i = i + 1 )) if [[ "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ]] then printf "${localout[$i]} ${actionout[$i]}\n${pathout[$i]}\n${localhost}_${fname}${endout[$i]}\n" >> OUTPUT_FILE_CONNECTIONS else printf "${localout[$i]} ${actionout[$i]}\n${pathout[$i]}\n${frelout[$i]}\n" >> OUTPUT_FILE_CONNECTIONS fi done # EVTL. UEBERSETZUNGSAKTIONEN STARTEN if [[ $do_compile = true ]] then # COMPILING WITH MAKE (ON NEC COMPILER IS CALLED ON HOST CROSS) if [[ "$use_makefile" = true ]] then printf "\n\n\n *** compilation starts \n$striche\n" printf " *** compilation with make using following options:\n" printf " compilername: $compiler_name\n" printf " options: $FOPTS\n" printf " preprocessor-directives: $C_PPOPTS \n" printf " linker-options: $LOPTS \n" 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 -f Makefile PROG=a.out F90=$compiler_name COPT=\"$C_PPOPTS\" F90FLAGS=\"$FOPTS\" LDFLAGS=\"$LOPTS\" " cp $TEMPDIR_COMPILE/a.out . [[ $? != 0 ]] && compile_error=true rm -rf $TEMPDIR_COMPILE else make -f Makefile PROG=a.out F90=$compiler_name COPT="$C_PPOPTS" F90FLAGS="$FOPTS" LDFLAGS="$LOPTS" fi # UEBERSETZUNG "VON HAND" (OHNE MAKE) else # UEBERSETZUNG DER QUELLTEXT-DATEIEN UND DES HAUPTPROGRAMMS # $CPPOPTS FUER CPP-PRAEPROZESSOR WURDEN OBEN BESTIMMT printf "\n\n\n *** compilation starts \n$striche\n" # VORWEG EVTL. UEBERSETZUNG VON PROGRAMMTEILEN MIT SPEZIELLEN # COMPILERN UND/ODER COMPILEROPTIONEN. DIESE WERDEN BEI DER SPAETEREN # EIGENTLICHEN UEBERSETZUNG ALS OBJECT-FILES EINGEBUNDEN new_source_list="" for filename in $source_list do basename=`print $filename | cut -f1 -d"."` # EVTL. SPEZIELLEN COMPILER FUER UP BESTIMMEN comp_var=$(eval echo \$comp_$basename) # \$ liefert evtl. fuer source alternativ vereinbarten Compiler comp_opt_var=$(eval echo \$$basename) # \$$ liefert evtl. fuer source vereinbarte Compiler-Environment-Variable if [[ "$comp_var" = "" && "$comp_opt_var" = "" ]] then new_source_list="$new_source_list "$filename else if [[ "$comp_var" = "" ]] then SPECIAL_COMPILER=$compiler_name else SPECIAL_COMPILER=$comp_var fi if [[ "$comp_opt_var" = "" ]] then SPECIAL_FOPTS=$FOPTS else SPECIAL_FOPTS="$parallel_options $(eval echo \$$comp_opt_var)" fi printf " *** compiling of $filename with special compiler call: $SPECIAL_COMPILER $CPPOPTS -c $SPECIAL_FOPTS \n" $SPECIAL_COMPILER $C_PPOPTS -c $SPECIAL_FOPTS $MODULE_OPTIONS $filename if [[ $? != 0 ]] then printf "\n +++ compiling error occured" locat=compile exit fi new_source_list="$new_source_list "${basename}.o fi done source_list="$new_source_list" # EIGENTLICHE UEBERSETZUNG MIT DEN NORMALEN OPTIONEN printf " *** compilation with standard options: $compiler_name $FOPTS $MODULE_OPTIONS \n" printf " preprocessor-directives: $C_PPOPTS \n" printf " linker-options: $LOPTS \n" printf " source code files: $source_list \n" $compiler_name $C_PPOPTS $FOPTS $MODULE_OPTIONS $LOPTS $source_list fi if [[ $? != 0 || "$compile_error" = true || "$module_compile_error" = true ]] then printf "\n +++ error occured while compiling or linking" locat=compile exit else printf "$striche\n *** compilation finished \n" fi fi # FALLS NUR TESTWEISE KOMPILIERT WERDEN SOLLTE, IST MRUN JETZT FERTIG if [[ $local_compile = true ]] then cd $HOME rm -rf $TEMPDIR locat=local_compile; exit fi # BEREITSTELLEN DER INPUT-DATEIEN # SCHLEIFE UEBER ALLE VOM BENUTZER ANGEGEBENEN DATEIEN (( i = 0 )) while (( i < iin )) do (( i = i + 1 )) if (( i == 1 )) then printf "\n\n *** providing INPUT-files:\n$striche" fi # OPTIONALE DATEIEN BEI NICHTVORHANDENSEIN UEBERGEHEN if [[ "${transin[$i]}" = unavailable ]] then if [[ "${extin[$i]}" = "" || "${extin[$i]}" = " " ]] then printf "\n +++ WARNING: input file \"${pathin[$i]}/${afname}${endin[$i]}\" " printf "\n is not available!" else printf "\n +++ WARNING: input file \"${pathin[$i]}/${afname}${endin[$i]}.${extin[$i]}\" " printf "\n is not available!" fi continue fi # PRUEFEN, OB EINZELDATEI ODER DATEI PRO PROZESSOR files_for_pes=false; datentyp=file if [[ "${actionin[$i]}" = pe && -n $numprocs ]] then files_for_pes=true; datentyp=directory actionin[$i]="" elif [[ "${actionin[$i]}" = pe && ! -n $numprocs ]] then actionin[$i]="" elif [[ "${actionin[$i]}" = arpe && -n $numprocs ]] then files_for_pes=true; datentyp=directory actionin[$i]="ar" elif [[ "${actionin[$i]}" = arpe && ! -n $numprocs ]] then actionin[$i]="ar" elif [[ "${actionin[$i]}" = flpe && -n $numprocs ]] then files_for_pes=true; datentyp=directory actionin[$i]="fl" elif [[ "${actionin[$i]}" = flpe && ! -n $numprocs ]] then actionin[$i]="fl" fi if [[ $files_for_pes = true ]] then printf "\n >>> INPUT: ${absnamein[$i]}/.... to ${localin[$i]}" else printf "\n >>> INPUT: ${absnamein[$i]} to ${localin[$i]}" fi # INPUT-DATEI FUER EINEN FORTSETZUNGSLAUF. ES WIRD GEPRUEFT, # OB DIESE DATEI NOCH AUF DEM TEMPORAEREN DATENKATALOG VORHANDEN # IST. FALLS NICHT, WIRD VERSUCHT, SIE ANSCHLIESSEND VOM ARCHIV- # SERVER ZU HOLEN if [[ "${actionin[$i]}" = fl ]] then printf "\n $datentyp will be fetched from temporary directory \"${tmp_data_catalog}\" !" if [[ $files_for_pes = false ]] then if [[ -f "$tmp_data_catalog/${frelin[$i]}" ]] then ln $tmp_data_catalog/${frelin[$i]} ${localin[$i]} got_tmp[$i]=true elif [[ -f "$WORK/${frelin[$i]}" && $ignore_archive_error = true ]] then printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" !" printf "\n *** trying to use backup copy in \"$WORK\" " cp $WORK/${frelin[$i]} ${localin[$i]} else printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" " printf "\n or \"$tmp_data_catalog\" does not exist!" printf "\n *** trying to get copy from archive" actionin[$i]=ar fi else if [[ -d "$tmp_data_catalog/${frelin[$i]}" ]] then mkdir ${localin[$i]} ln $tmp_data_catalog/${frelin[$i]}/* ${localin[$i]} got_tmp[$i]=true elif [[ -d "$WORK/${frelin[$i]}" && $ignore_archive_error = true ]] then printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" !" printf "\n *** trying to use backup copy in \"$WORK\" " cp -r $WORK/${frelin[$i]} ${localin[$i]} else printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" " printf "\n or \"$tmp_data_catalog\" does not exist!" printf "\n *** trying to get copy from archive" actionin[$i]=ar fi fi fi # DATEI LIEGT AUF ARCHIV-SERVER if [[ "${actionin[$i]}" = ar ]] then if [[ $files_for_pes = false ]] then printf "\n file will be restored from archive-system ($archive_system)!" else printf "\n directory will be restored from archive-system ($archive_system)!" fi file_restored=false if [[ $archive_system = asterix ]] then do_stagein=true (( stagein_anz = 0 )) while [[ $do_stagein = true ]] do if [[ $files_for_pes = false ]] then stagein -O ${frelin[$i]} > STAGEIN_OUTPUT else stagein -t -O ${frelin[$i]} > STAGEIN_OUTPUT fi cat STAGEIN_OUTPUT if [[ $(grep -c "st.msg:i24" STAGEIN_OUTPUT) != 0 ]] then file_restored=true do_stagein=false else (( stagein_anz = stagein_anz + 1 )) if (( stagein_anz == 10 )) then printf "\n +++ stagein stoped after 10 tries" locat=stage exit fi printf "\n +++ restoring from archive failed, trying again:" sleep 900 fi done elif [[ $archive_system = DMF ]] then if [[ $files_for_pes = false ]] then printf "\n +++ restoring of single files impossible with $archive_system !\n" locat=DMF exit else find $ARCHIVE/${frelin[$i]} -type m -print | dmget cp -r $ARCHIVE/${frelin[$i]} $PWD file_restored=true fi elif [[ $archive_system = tivoli ]] then if [[ $files_for_pes = false ]] then if [[ $localhost = ibmh ]] then ssh $usern@hdata.hlrn.de "cp $PERM/${frelin[$i]} $PWD" else ssh $usern@bdata.hlrn.de "cp $PERM/${frelin[$i]} $PWD" fi else (( inode = 0 )) while (( inode < nodes )) do if [[ $localhost = ibmh ]] then ssh $usern@hdata.hlrn.de "cd $PWD; tar xf $PERM/${frelin[$i]}/${frelin[$i]}.node_$inode.tar" else ssh $usern@bdata.hlrn.de "cd $PWD; tar xf $PERM/${frelin[$i]}/${frelin[$i]}.node_$inode.tar" fi (( inode = inode + 1 )) done fi file_restored=true elif [[ $archive_system = ut ]] then if [[ $files_for_pes = false ]] then cp $UT/${frelin[$i]} . else (( inode = 0 )) while (( inode < nodes )) do tar xf $UT/${frelin[$i]}/${frelin[$i]}.node_$inode.tar (( inode = inode + 1 )) done fi file_restored=true else printf "\n +++ archive_system=\"$archive_system\" restore impossible!" locat=rearchive exit fi if [[ $file_restored = true ]] then # DATEI AUCH AUF TEMPORAERES DATENVERZEICHNIS LEGEN, DAMIT # SIE BEI WEITEREN ZUGRIFFEN NOCH VORHANDEN IST [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog; chmod g+rx $tmp_data_catalog if [[ $files_for_pes = false ]] then ln -f ${frelin[$i]} $tmp_data_catalog/${frelin[$i]} else mkdir $tmp_data_catalog/${frelin[$i]} ln -f ${frelin[$i]}/* $tmp_data_catalog/${frelin[$i]} fi got_tmp[$i]=true # DATEI UNTER LOKALEM NAMEN ZUR VERFUEGUNG STELLEN mv ${frelin[$i]} ${localin[$i]} fi fi # DATEI LIEGT IM VOM BENUTZER ANGEGEBENEN VERZEICHNIS if [[ "${actionin[$i]}" = "" || "${actionin[$i]}" = "di" || "${actionin[$i]}" = "npe" ]] then if [[ "${actionin[$i]}" = "npe" && -n $numprocs ]] then # DATEI WIRD FUER DIE PROZESSOREN EINES PARALLERECHNERS BEREITGESTELLT printf "\n file will be provided for $numprocs processors" mkdir ${localin[$i]} ival=$numprocs (( ii = 0 )) while (( ii <= ival-1 )) do if (( ii < 10 )) then cp ${absnamein[$i]} ${localin[$i]}/_000$ii elif (( ii < 100 )) then cp ${absnamein[$i]} ${localin[$i]}/_00$ii elif (( ii < 1000 )) then cp ${absnamein[$i]} ${localin[$i]}/_0$ii else cp ${absnamein[$i]} ${localin[$i]}/_$ii fi (( ii = ii + 1 )) done else if [[ $files_for_pes = true ]] then # DIE DEN PROZESSOREN EINES PARALLELRECHNERS ZUGEHOERIGEN # DATEIEN WERDEN BEREITGESTELLT, INDEM ZUERST DER GESAMTE # KATALOGINHALT KOPIERT UND DANN DIE EINZELNEN DATEIEN # PER MOVE UMBENANNT WERDEN printf "\n providing $numprocs files for the respective processors" mkdir ${localin[$i]} cp -r ${absnamein[$i]}/* ${localin[$i]} else # BEREITSTELLUNG AUF EINPROZESSORRECHNERN cp ${absnamein[$i]} ${localin[$i]} fi fi fi done if (( i != 0 )) then printf "\n$striche\n *** all INPUT-files provided \n" fi # NAMELIST-DATEI MIT WERTEN VON ENVIRONMENT-VARIABLEN ERZEUGEN (ZU # LESEN VON PALM) cat > ENVPAR << %%END%% &envpar run_identifier = '$fname', host = '$localhost', write_binary = '$write_binary', tasks_per_node = $tasks_per_node, maximum_cpu_time_allowed = ${cpumax}. / %%END%% # EVENTUELLE INPUT-KOMMANDOS ABARBEITEN (( i = 0 )) while (( i < iic )) do (( i = i + 1 )) if (( i == 1 )) then printf "\n\n *** execution of INPUT-commands:\n$striche" fi printf "\n >>> ${in_command[$i]}" eval ${in_command[$i]} if (( i == iic )) then printf "\n$striche\n" fi done # VERBLEIBENDE CPU-ZEIT BERECHNEN cpurest=${cpumax}. # PROGRAMMSTART printf "\n\n *** execution starts in directory\n \"`pwd`\"\n$striche\n" PATH=$PATH:$TEMPDIR if [[ "$cond1" = debug || "$cond2" = debug ]] then if [[ "$ENVIRONMENT" = BATCH ]] then printf "\n +++ debug is allowed in interactive mode only" locat=debug exit fi if [[ $localhost = decalpha ]] then dxladebug a.out elif [[ $localhost = ibmb || $localhost = ibmh ]] then # SETUP THE IBM MPI ENVIRONMENT export MP_SHARED_MEMORY=yes export AIXTHREADS_SCOPE=S export OMP_NUM_THREADS=$threads_per_task export AUTHSTATE=files export XLFRTEOPTS="nlwidth=132:err_recovery=no" # RECORD-LENGTH OF NAMELIST-OUTPUT # FOLLOWING OPTIONS ARE MANDATORY FOR TOTALVIEW export MP_ADAPTER_USE=shared export MP_CPU_USE=multiple export MP_TIMEOUT=1200 unset MP_TASK_AFFINITY # SO FAR, TOTALVIEW NEEDS HOSTFILE MECHANISM FOR EXECUTION #(( ii = 1 )) #while (( ii <= $numprocs )) #do # echo $localhost_realname >> hostfile # (( ii = ii + 1 )) #done #export MP_HOSTFILE=hostfile if [[ "$LOADLBATCH" = yes ]] then totalview poe a.out $ROPTS else echo totalview poe -a a.out -procs $numprocs -rmpool 0 -nodes 1 $ROPTS export TVDSVRLAUNCHCMD=ssh totalview poe -a a.out -procs $numprocs -rmpool 0 -nodes 1 $ROPTS fi else printf "\n +++ no debug available on \"$localhost\" " printf "\n or not implemented in mrun so far" locat=debug exit fi else if [[ -n $numprocs ]] then # RUNNING THE PROGRAM ON PARALLEL MACHINES if [[ $(echo $host | cut -c1-3) = ibm ]] then # SETUP THE IBM MPI ENVIRONMENT export MP_SHARED_MEMORY=yes export AIXTHREAD_SCOPE=S export OMP_NUM_THREADS=$threads_per_task export XLSMPOPTS="spins=0:yields=0:stack=20000000" export AUTHSTATE=files export XLFRTEOPTS="nlwidth=132:err_recovery=no" # RECORD-LENGTH OF NAMELIST-OUTPUT # export MP_PRINTENV=yes # TUNING-VARIABLEN ZUR VERBESSERUNG DER KOMMUNIKATION # ZEIGEN ABER DERZEIT (SEP 04, FEDERATION) KAUM WIRKUNG export MP_WAIT_MODE=poll [[ $node_usage = not_shared ]] && export MP_SINGLE_THREAD=yes # export MP_EAGER_LIMIT=65535 # # TESTWEISE FUER TURBOMPI (JAN 05) # export MPJ_MTAB=128 # export MPJ_ALLTOALL=1 # export MPJ_ALLTOALLV=1 if [[ "$LOADLBATCH" = yes ]] then printf "\n--- Control: OMP_NUM_THREADS = \"$OMP_NUM_THREADS\" \n" if [[ "$cond1" = hpmcount || "$cond2" = hpmcount ]] then /opt/optibm/HPM_2_4_1/bin/hpmcount a.out $ROPTS > aout_output 2>&1 else poe ./a.out $ROPTS > aout_output 2>&1 fi else if [[ $localhost = ibmb || $localhost = ibmh || $localhost = ibms ]] then poe a.out -procs $numprocs -nodes 1 -rmpool 0 $ROPTS > aout_output 2>&1 elif [[ $localhost = ibmy ]] then if [[ -f $hostfile ]] then cp $hostfile hostfile else (( ii = 1 )) while (( ii <= $numprocs )) do echo $localhost_realname >> hostfile (( ii = ii + 1 )) done fi export MP_HOSTFILE=hostfile ./a.out -procs $tasks_per_node $ROPTS > aout_output 2>&1 else if [[ "$host_file" = "" ]] then printf "\n +++ no hostfile given in configuration file" locat=config_file exit else eval host_file=$host_file fi export MP_HOSTFILE=$host_file poe a.out -procs $numprocs -tasks_per_node $numprocs $ROPTS > aout_output 2>&1 fi fi elif [[ $host = nech || $host = neck ]] then (( ii = nodes )) if [[ $ii = 1 ]] then export F_ERRCNT=0 # acceptable number of errors before program is stopped export MPIPROGINF=YES # export F_TRACE=YES|FMT1|FMT2 # output of ftrace informations to job protocol echo "*** execution on single node with mpirun" mpirun -np $numprocs ./a.out $ROPTS > aout_output 2>&1 else (( i = 0 )) while (( i < ii )) do echo "-h $i -p $tasks_per_node -e ./mpi_exec_shell" >> multinode_config (( i = i + 1 )) done echo "#!/bin/sh" > mpi_exec_shell echo " " >> mpi_exec_shell echo "set -u" >> mpi_exec_shell echo "F_ERRCNT=0" >> mpi_exec_shell echo "MPIPROGINV=YES" >> mpi_exec_shell echo "OMP_NUM_THREADS=$threads_per_task" >> mpi_exec_shell echo "cpurest=$cpurest" >> mpi_exec_shell echo "fname=$fname" >> mpi_exec_shell echo "localhost=$localhost" >> mpi_exec_shell echo "return_addres=$return_addres" >> mpi_exec_shell echo "return_username=$return_username" >> mpi_exec_shell echo "tasks_per_node=$tasks_per_node" >> mpi_exec_shell echo "write_binary=$write_binary" >> mpi_exec_shell echo "use_seperate_pe_for_dvrp_output=$use_seperate_pe_for_dvrp_output" >> mpi_exec_shell echo " " >> mpi_exec_shell echo "export F_ERRCNT" >> mpi_exec_shell echo "export MPIPROGINV" >> mpi_exec_shell echo "export OMP_NUM_THREADS" >> mpi_exec_shell echo "export cpurest" >> mpi_exec_shell echo "export fname" >> mpi_exec_shell echo "export localhost" >> mpi_exec_shell echo "export return_addres" >> mpi_exec_shell echo "export return_username" >> mpi_exec_shell echo "export tasks_per_node" >> mpi_exec_shell echo "export write_binary" >> mpi_exec_shell echo "export use_seperate_pe_for_dvrp_output" >> mpi_exec_shell echo " " >> mpi_exec_shell echo "exec ./a.out > aout_output 2>&1" >> mpi_exec_shell chmod u+x mpi_exec_shell export MPIPROGINF=YES mpirun -f multinode_config & wait fi elif [[ $host = lcmuk ]] then # COPY HOSTFILE FROM SOURCE DIRECTORY OR CREATE IT, IF IT # DOES NOT EXIST if [[ -f $hostfile ]] then cp $hostfile hostfile else (( ii = 1 )) while (( ii <= $numprocs / $threads_per_task )) do echo $localhost_realname >> hostfile (( ii = ii + 1 )) done fi (( ii = $numprocs / $threads_per_task )) eval zeile=\"`head -n $ii hostfile`\" printf "\n *** running on: $zeile" export OMP_NUM_THREADS=$threads_per_task if [[ $threads_per_task != 1 ]] then printf "\n threads per task: $threads_per_task" fi printf "\n\n" if [[ $scirocco = true ]] then mpiexec -machinefile hostfile -n $ii a.out $ROPTS > aout_output 2>&1 else mpirun -machinefile hostfile -np $ii a.out $ROPTS > aout_output 2>&1 fi elif [[ $host = decalpha ]] then dmpirun -np $numprocs a.out $ROPTS > aout_output 2>&1 elif [[ $host = lctit ]] then export runfile=runfile.$kennung echo "cd $PWD" > $runfile echo "export OMP_NUM_THREADS=$OMP_NUM_THREADS" >> $runfile echo "export cpurest=$cpurest" >> $runfile echo "export fname=$fname" >> $runfile echo "export localhost=$localhost" >> $runfile echo "export return_addres=$return_addres" >> $runfile echo "export return_username=$return_username" >> $runfile echo "export tasks_per_node=$tasks_per_node" >> $runfile echo "export write_binary=$write_binary" >> $runfile echo "export use_seperate_pe_for_dvrp_output=$use_seperate_pe_for_dvrp_output" >> $runfile echo "./a.out" >> $runfile chmod u+x $runfile if [[ "$QUEUE" = interactive ]] then mpirun -np $numprocs $runfile $ROPTS > aout_output 2>&1 else n1ge -fore -mpi $numprocs -q $queue $runfile $ROPTS > aout_output 2>&1 fi rm $runfile else mpprun -n $numprocs a.out $ROPTS > aout_output 2>&1 fi [[ $? != 0 ]] && execution_error=true # PERFORMANCE-AUSWERTUNG MIT APPRENTICE if [[ "$cond1" = apprentice || "$cond2" = apprentice ]] then apprentice fi else a.out $ROPTS > aout_output 2>&1 fi fi if [[ $? != 0 || $execution_error = true ]] then # ABBRUCH BEI LAUFZEITFEHLER [[ ! ( "$cond1" = debug || "$cond2" = debug ) ]] && cat aout_output printf "\n +++ runtime error occured" locat=execution exit else [[ ! ( "$cond1" = debug || "$cond2" = debug ) ]] && cat aout_output printf "\n$striche\n *** execution finished \n" fi # EVENTUELLE OUTPUT-KOMMANDOS ABARBEITEN (( i = 0 )) while (( i < ioc )) do (( i = i + 1 )) if (( i == 1 )) then printf "\n\n *** execution of OUTPUT-commands:\n$striche" fi printf "\n >>> ${out_command[$i]}" eval ${out_command[$i]} if (( i == ioc )) then printf "\n$striche\n" fi done # EVTL. INHALT DES AKTUELLEN VERZEICHNISSES AUSGEBEN if [[ $do_trace = true ]] then printf "\n\n" ls -al fi # OUTPUT-DATEIEN AN IHRE ZIELORTE KOPIEREN (( i = 0 )) while (( i < iout )) do (( i = i + 1 )) if (( i == 1 )) then printf "\n\n *** saving OUTPUT-files:\n$striche" fi # PRUEFEN, OB EINZELDATEI ODER DATEI PRO PROZESSOR files_for_pes=false; filetyp=file if [[ "${actionout[$i]}" = pe && -n $numprocs ]] then files_for_pes=true; filetyp=directory actionout[$i]="" elif [[ "${actionout[$i]}" = pe && ! -n $numprocs ]] then actionout[$i]="" elif [[ "${actionout[$i]}" = arpe && -n $numprocs ]] then files_for_pes=true; filetyp=directory actionout[$i]="ar" elif [[ "${actionout[$i]}" = arpe && ! -n $numprocs ]] then actionout[$i]="ar" elif [[ "${actionout[$i]}" = flpe && -n $numprocs ]] then files_for_pes=true; filetyp=directory actionout[$i]="fl" elif [[ "${actionout[$i]}" = flpe && ! -n $numprocs ]] then actionout[$i]="fl" elif [[ "${actionout[$i]}" = trpe && -n $numprocs ]] then files_for_pes=true; filetyp=directory actionout[$i]="tr" elif [[ "${actionout[$i]}" = trpe && ! -n $numprocs ]] then actionout[$i]="tr" fi if [[ ! -f ${localout[$i]} && $files_for_pes = false ]] then printf "\n +++ temporary OUTPUT-file ${localout[$i]} does not exist\n" elif [[ ! -f ${localout[$i]}/_0000 && $files_for_pes = true ]] then printf "\n +++ temporary OUTPUT-file ${localout[$i]}/.... does not exist\n" else # KOPIEREN PER FTP/SCP (IMMER IM BINAERMODUS, -M: FALLS ZIELKATALOG # NICHT VORHANDEN, WIRD VERSUCHT, IHN ANZULEGEN), ABER NUR BEI # REMOTE-RECHNUNGEN if [[ "${actionout[$i]}" = tr ]] then if [[ $localhost != $fromhost ]] then if [[ $files_for_pes = false ]] then cps="" cst="" else cps=-c cst="/" fi if [[ $localhost = ibmh || $localhost = ibmb || $localhost = nech ]] then # TRANSFER IN EIGENSTAENDIGEM JOB # ZUERST KOPIE DER DATEI INS TEMPORAERE DATENVERZEICHNIS [[ ! -d $tmp_data_catalog/TRANSFER ]] && mkdir -p $tmp_data_catalog/TRANSFER file_to_transfer=${fname}_${localout[$i]}_to_transfer_$kennung if [[ $files_for_pes = false ]] then ln -f ${localout[$i]} $tmp_data_catalog/TRANSFER/$file_to_transfer else mkdir $tmp_data_catalog/TRANSFER/$file_to_transfer ln ${localout[$i]}/* $tmp_data_catalog/TRANSFER/$file_to_transfer fi echo "set -x" > transfer_${localout[$i]} echo "cd $tmp_data_catalog/TRANSFER" >> transfer_${localout[$i]} if [[ $filetransfer_protocol = ftp ]] then if [[ $files_for_pes = true ]] then printf "\n +++ WARNING: no transfer of catalogs via ftpcopy\n" fi printf "\n >>> OUTPUT: ${localout[$i]} by FTP in seperate job to" printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}" printf "\n or higher cycle\n" echo "ftpcopy -b -m $return_addres $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]} ${extout[$i]}" >> transfer_${localout[$i]} else printf "\n >>> OUTPUT: ${localout[$i]}$cst by SCP in seperate job to" printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}$cst" printf "\n or higher cycle\n" echo "batch_scp $cps -b -m -u $return_username $return_addres $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]} ${extout[$i]}" >> transfer_${localout[$i]} fi echo "[[ \$? = 0 ]] && rm $file_to_transfer" >> transfer_${localout[$i]} if [[ $localhost = nech ]] then subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 900 -f $filetransfer_protocol transfer_${localout[$i]} else if [[ "$LOGNAME" = b323013 ]] then subjob -v -q c1 -X 0 -m 1000 -t 900 -f $filetransfer_protocol transfer_${localout[$i]} else subjob -d -v -q c1 -X 0 -m 1000 -t 900 -f $filetransfer_protocol transfer_${localout[$i]} fi fi else # TRANSFER INNERHALB DIESES JOBS transfer_failed=false if [[ $filetransfer_protocol = ftp ]] then if [[ $files_for_pes = true ]] then printf "\n +++ WARNING: no transfer of catalogs via ftpcopy\n" fi printf "\n >>> OUTPUT: ${localout[$i]} by FTP to" printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}\n" ftpcopy -b -m $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} [[ $? != 0 ]] && transfer_failed=true else printf "\n >>> OUTPUT: ${localout[$i]}$cst by SCP to" printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}$cst\n" batch_scp $cps -b -m -u $return_username $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} [[ $? != 0 ]] && transfer_failed=true fi # BEI FEHLGESCHLAGENEM TRANSFER SICHERUNGSKOPIE AUF # LOKALER MASCHINE ANLEGEN if [[ $transfer_failed = true ]] then printf " +++ transfer failed. Trying to save a copy on the local host under:\n" printf " ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung\n" # ERSTMAL PRUEFEN, OB VERZEICHNIS EXISTIERT. GEGEBENENFALLS # ANLEGEN. eval local_catalog=${pathout[$i]} if [[ ! -d $local_catalog ]] then printf " *** local directory does not exist. Trying to create:\n" printf " $local_catalog \n" mkdir -p $local_catalog fi eval cp ${localout[$i]} ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung transfer_problems=true fi fi else # WERTZUWEISUNG, SO DASS WEITER UNTEN NUR KOPIERT WIRD actionout[$i]="" fi fi # APPEND PER FTP/SCP (IMMER IM BINAERMODUS, -M: FALLS ZIELKATALOG # NICHT VORHANDEN, WIRD VERSUCHT, IHN ANZULEGEN), ABER NUR BEI # REMOTE-RECHNUNGEN if [[ "${actionout[$i]}" = tra ]] then if [[ $localhost != $fromhost ]] then if [[ $localhost = ibmh || $localhost = ibmb || $localhost = nech ]] then # TRANSFER IN EIGENSTAENDIGEM JOB # ZUERST KOPIE DER DATEI INS TEMPORAERE DATENVERZEICHNIS [[ ! -d $tmp_data_catalog/TRANSFER ]] && mkdir -p $tmp_data_catalog/TRANSFER file_to_transfer=${fname}_${localout[$i]}_to_transfer_$kennung ln -f ${localout[$i]} $tmp_data_catalog/TRANSFER/$file_to_transfer echo "set -x" > transfer_${localout[$i]} echo "cd $tmp_data_catalog/TRANSFER" >> transfer_${localout[$i]} if [[ $filetransfer_protocol = ftp ]] then printf "\n >>> OUTPUT: ${localout[$i]} append by FTP in seperate job to" printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}" printf "\n or higher cycle\n" echo "ftpcopy -A -b -m $return_addres $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]} ${extout[$i]}" >> transfer_${localout[$i]} else printf "\n >>> OUTPUT: ${localout[$i]} append by SCP in seperate job to" printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}" printf "\n or higher cycle\n" echo "batch_scp -A -b -m -u $return_username $return_addres $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]} ${extout[$i]}" >> transfer_${localout[$i]} fi echo "[[ \$? = 0 ]] && rm $file_to_transfer" >> transfer_${localout[$i]} if [[ $localhost = nech ]] then subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 900 -f $filetransfer_protocol transfer_${localout[$i]} else if [[ $LOGNAME = b323013 ]] then subjob -v -q c1 -X 0 -m 1000 -t 900 -f $filetransfer_protocol transfer_${localout[$i]} else subjob -d -v -q c1 -X 0 -m 1000 -t 900 -f $filetransfer_protocol transfer_${localout[$i]} fi fi else # TRANSFER INNERHALB DIESES JOBS transfer_failed=false if [[ $filetransfer_protocol = ftp ]] then printf "\n >>> OUTPUT: ${localout[$i]} append by FTP to" printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}\n" ftpcopy -A -b -m $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} [[ $? != 0 ]] && transfer_failed=true else printf "\n >>> OUTPUT: ${localout[$i]} append by SCP to" printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}\n" batch_scp -A -b -m -u $return_username $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} [[ $? != 0 ]] && transfer_failed=true fi # BEI FEHLGESCHLAGENEM TRANSFER SICHERUNGSKOPIE AUF # LOKALER MASCHINE ANLEGEN if [[ $transfer_failed = true ]] then printf " +++ transfer failed. Trying to save a copy on the local host under:\n" printf " ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung\n" # ERSTMAL PRUEFEN, OB VERZEICHNIS EXISTIERT. GEGEBENENFALLS # ANLEGEN eval local_catalog=${pathout[$i]} if [[ ! -d $local_catalog ]] then printf " *** local directory does not exist. Trying to create:\n" printf " $local_catalog \n" mkdir -p $local_catalog fi eval cp ${localout[$i]} ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung transfer_problems=true fi fi else # WERTZUWEISUNG, SO DASS WEITER UNTEN NUR APPEND AUF # LOKALER MASCHINE DURCHGEFUEHRT WIRD actionout[$i]=a fi fi # OUTPUT-DATEI FUER EINEN FORTSETZUNGSLAUF. DATEI WIRD PER # LINK AUF DEN TEMPORAEREN DATENKATALOG GELEGT. OPTION -f WIRD # VERWENDET, FALLS DORT NOCH EINE DATEI GLEICHEN NAMENS VORHANDEN # SEIN SOLLTE. ANSCHLIESSEND WIRD SEINE ARCHIVIERUNG ANGESTOSSEN if [[ "${actionout[$i]}" = fl ]] then [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog chmod g+rx $tmp_data_catalog if [[ $files_for_pes = false ]] then printf "\n >>> OUTPUT: ${localout[$i]} to" printf "\n $tmp_data_catalog/${frelout[$i]} (temporary data catalog)\n" ln -f ${localout[$i]} $tmp_data_catalog/${frelout[$i]} else printf "\n >>> OUTPUT: ${localout[$i]}/.... to" printf "\n $tmp_data_catalog/${frelout[$i]} (temporary data catalog)\n" mkdir $tmp_data_catalog/${frelout[$i]} ln -f ${localout[$i]}/* $tmp_data_catalog/${frelout[$i]} fi # ARCHIVIERUNGSJOB WIRD ERZEUGT UND ABGESCHICKT if [[ $store_on_archive_system = true ]] then if [[ $archive_system = asterix ]] then echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} if [[ $files_for_pes = false ]] then echo "stageout ${frelout[$i]} > STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} else echo "stageout -t ${frelout[$i]} > STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} fi echo "cat STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} echo "if [[ \$(grep -c \"st.msg:150\" STAGE_OUTPUT${i}_$kennung) != 0 ]]" >> archive_${frelout[$i]} echo "then" >> archive_${frelout[$i]} echo " do_stageout=false" >> archive_${frelout[$i]} echo "else" >> archive_${frelout[$i]} echo " echo \" +++ $filetyp ${frelout[$i]} could not be stored on archive-system\" " >> archive_${frelout[$i]} echo " cat /dev/null > ~/job_queue/ARCHIVE_ERROR_$fname" >> archive_${frelout[$i]} echo " cat STAGE_OUTPUT${i}_$kennung > ~/job_queue/archive_${frelout[$i]}_error" >> archive_${frelout[$i]} echo " echo \" *** $filetyp ${frelout[$i]} will be copied to \$WORK as backup\" " >> archive_${frelout[$i]} if [[ $files_for_pes = false ]] then echo " cp ${frelout[$i]} \$WORK" >> archive_${frelout[$i]} else echo " cp -r ${frelout[$i]} \$WORK/${frelout[$i]}" >> archive_${frelout[$i]} fi echo " echo \" *** $filetyp ${frelout[$i]} saved\" " >> archive_${frelout[$i]} echo "fi" >> archive_${frelout[$i]} echo "rm STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} elif [[ $archive_system = DMF ]] then echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} if [[ $files_for_pes = false ]] then printf "\n +++ archiving of single files impossible with $archive_system !\n" locat=DMF exit else # FUER RECHNER IN JUELICH. DORT KOENNTEN AUCH # EINZELNE DATEIEN GESICHERT WERDEN (SPAETER KORR.) echo "rm -rf \$ARCHIVE/${frelout[$i]}" >> archive_${frelout[$i]} echo "cp -r ${frelout[$i]} \$ARCHIVE" >> archive_${frelout[$i]} fi elif [[ $archive_system = tivoli ]] then echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} if [[ $files_for_pes = false ]] then # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN echo "set -x" >> archive_${frelout[$i]} echo "rm -rf \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} echo "cp ${frelout[$i]} \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} else echo "set -x" >> archive_${frelout[$i]} echo "rm -rf \$PERM/${frelout[$i]}/*" >> archive_${frelout[$i]} echo "[[ ! -d \$PERM/${frelout[$i]} ]] && mkdir $PERM/${frelout[$i]}" >> archive_${frelout[$i]} cd $tmp_data_catalog all_files=`ls -1 ${frelout[$i]}/*` cd - > /dev/null (( inode = 0 )) (( tp1 = tasks_per_node + 1 )) while (( inode < nodes )) do # echo "*** all_files = \"$all_files\" " files=`echo $all_files | cut -d" " -f1-$tasks_per_node` all_files=`echo $all_files | cut -d" " -f$tp1-` # echo "*** tasks_per_node = \"$tasks_per_node\" " # echo "*** files = \"$files\" " # echo "*** all_files = \"$all_files\" " echo "tar cvf \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar $files" >> archive_${frelout[$i]} echo "dsmc incremental \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar" >> archive_${frelout[$i]} echo "dsmmigrate \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar" >> archive_${frelout[$i]} (( inode = inode + 1 )) done # echo "rm -rf \$PERM/${frelout[$i]}.tar" >> archive_${frelout[$i]} # echo "tar cvf \$PERM/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} fi elif [[ $archive_system = ut ]] then echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} if [[ $files_for_pes = false ]] then # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN echo "set -x" >> archive_${frelout[$i]} echo "rm -rf \$UT/${frelout[$i]}" >> archive_${frelout[$i]} echo "cp ${frelout[$i]} \$UT/${frelout[$i]}" >> archive_${frelout[$i]} else echo "set -x" >> archive_${frelout[$i]} echo "rm -rf \$UT/${frelout[$i]}/*" >> archive_${frelout[$i]} echo "[[ ! -d \$UT/${frelout[$i]} ]] && mkdir $UT/${frelout[$i]}" >> archive_${frelout[$i]} cd $tmp_data_catalog all_files=`ls -1 ${frelout[$i]}/*` cd - > /dev/null (( inode = 0 )) (( tp1 = tasks_per_node + 1 )) while (( inode < nodes )) do files=`echo $all_files | cut -d" " -f1-$tasks_per_node` all_files=`echo $all_files | cut -d" " -f$tp1-` echo "tar cvf \$UT/${frelout[$i]}/${frelout[$i]}.node_$inode.tar $files" >> archive_${frelout[$i]} (( inode = inode + 1 )) done fi elif [[ $archive_system = none ]] then printf " +++ archiving on $localhost not available!\n" fi if [[ $archive_system != none ]] then if [[ $localhost = ibmh || $localhost = ibmb ]] then subjob -d -v -q cdata -X 0 -m 1000 -t 7200 -f $filetransfer_protocol archive_${frelout[$i]} elif [[ $localhost = nech ]] then subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 7200 -f $filetransfer_protocol archive_${frelout[$i]} fi printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" fi else printf " +++ caution: option -A is switched on. No archiving on $archive_system!\n" fi # LEERDATEI IM BENUTZERVERZEICHNIS ANLEGEN, DAMIT BEKANNT IST, # WIE DIE HOECHSTE ZYKLUSNUMMER AUF DEM ARCHIV-SYSTEM LAUTET if [[ $files_for_pes = false ]] then cat /dev/null > ${pathout[$i]} else mkdir -p ${pathout[$i]} fi fi # KOPIEREN AUF LOKALER MASCHINE ZUM ARCHIV-SYSTEM # AUSSERDEM MUSS LEERDATEI ANGELEGT WERDEN, DAMIT BEKANNT IST, # WIE DIE HOECHSTE ZYKLUSNUMMER AUF DEM ARCHIV-SYSTEM LAUTET # FALLS IRGENDEINE (VON MEHREREN) ARCHIVIERUNGEN SCHIEF GEHT, # WIRD FLAG GESETZT UND BLEIBT AUCH BEI WEITEREN ORDNUNGS- # GEMAESSEN ARCHIVIERUNGEN GESETZT if [[ "${actionout[$i]}" = ar ]] then if [[ $files_for_pes = false ]] then printf "\n >>> OUTPUT: ${localout[$i]} to" printf "\n ${pathout[$i]}" printf "\n File will be copied to archive-system ($archive_system) !\n" else printf "\n >>> OUTPUT: ${localout[$i]}/_.... to" printf "\n ${pathout[$i]}" printf "\n Directory will be copied to archive-system ($archive_system) !\n" fi mv ${localout[$i]} ${frelout[$i]} file_saved=false if [[ $archive_system = asterix ]] then do_stageout=true (( stageout_anz = 0 )) while [[ $do_stageout = true ]] do if [[ $files_for_pes = false ]] then stageout ${frelout[$i]} > STAGE_OUTPUT else stageout -t ${frelout[$i]} > STAGE_OUTPUT fi cat STAGE_OUTPUT if [[ $(grep -c "st.msg:150" STAGE_OUTPUT) != 0 ]] then file_saved=true do_stageout=false else if [[ $files_for_pes = false ]] then printf "\n +++ file ${frelout[$i]} could not be saved on archive-system" else printf "\n +++ directory ${frelout[$i]} could not be saved on archive-system" fi (( stageout_anz = stageout_anz + 1 )) if (( stageout_anz == 10 )) then printf "\n +++ stoped after 10 unsuccessful tries!" archive_save=false do_stageout=false else printf "\n *** new try to store on archive after 15 min:" sleep 900 fi fi done elif [[ $archive_system = DMF ]] then if [[ $files_for_pes = false ]] then printf "\n +++ archiving of single files impossible on $archive_system!\n" locat=DMF exit else rm -rf $ARCHIVE/${frelout[$i]} cp -r ${frelout[$i]} $ARCHIVE fi file_saved=true elif [[ $archive_system = tivoli ]] then # ARCHIVIERUNG NUR PER BATCH-JOB MOEGLICH # DATEI MUSS ZWISCHENZEITLICH INS TEMPORAERE DATENVERZEICHNIS # GELEGT WERDEN [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog chmod g+rx $tmp_data_catalog if [[ $files_for_pes = false ]] then ln -f ${frelout[$i]} $tmp_data_catalog/${frelout[$i]} else mkdir $tmp_data_catalog/${frelout[$i]} ln -f ${frelout[$i]}/* $tmp_data_catalog/${frelout[$i]} fi # BATCH JOB GENERIEREN UND ABSCHICKEN; DATEI MUSS WIEDER # AUS TEMPORAEREM DATENVERZEICHNIS ENTFERNT WERDEN echo "cd $tmp_data_catalog" > archive_${frelout[$i]} if [[ $files_for_pes = false ]] then # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN echo "rm -rf \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} echo "cp ${frelout[$i]} \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} else echo "rm -rf \$PERM/${frelout[$i]}.tar" >> archive_${frelout[$i]} echo "tar cvf \$PERM/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} fi subjob -v -d -q cdata -X 0 -m 1000 -t 7200 -f $filetransfer_protocol archive_${frelout[$i]} printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" file_saved=true elif [[ $archive_system = ut ]] then # ARCHIVIERUNG NUR PER BATCH-JOB MOEGLICH # DATEI MUSS ZWISCHENZEITLICH INS TEMPORAERE DATENVERZEICHNIS # GELEGT WERDEN [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog chmod g+rx $tmp_data_catalog if [[ $files_for_pes = false ]] then ln -f ${frelout[$i]} $tmp_data_catalog/${frelout[$i]} else mkdir $tmp_data_catalog/${frelout[$i]} ln -f ${frelout[$i]}/* $tmp_data_catalog/${frelout[$i]} fi # BATCH JOB GENERIEREN UND ABSCHICKEN; DATEI MUSS WIEDER # AUS TEMPORAEREM DATENVERZEICHNIS ENTFERNT WERDEN echo "cd $tmp_data_catalog" > archive_${frelout[$i]} if [[ $files_for_pes = false ]] then # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN echo "rm -rf \$UT/${frelout[$i]}" >> archive_${frelout[$i]} echo "cp ${frelout[$i]} \$UT/${frelout[$i]}" >> archive_${frelout[$i]} echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} else echo "rm -rf \$UT/${frelout[$i]}.tar" >> archive_${frelout[$i]} echo "tar cvf \$UT/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} fi subjob -v -c /pf/b/$usern/job_queue -d -q pp -X 0 -m 1000 -t 7200 -f $filetransfer_protocol archive_${frelout[$i]} printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" file_saved=true else printf "\n +++ archive_system=\"$archive_system\" archiving impossible!" archive_save=false fi if [[ $file_saved = true ]] then if [[ $files_for_pes = false ]] then cat /dev/null > ${pathout[$i]} else mkdir -p ${pathout[$i]} fi fi fi # APPEND AUF LOKALER MASCHINE if [[ "${actionout[$i]}" = "a" ]] then printf "\n >>> OUTPUT: ${localout[$i]} append to ${pathout[$i]}\n" cat ${localout[$i]} >> ${pathout[$i]} fi # KOPIEREN AUF LOKALER MASCHINE # ES MUSS KOPIERT WERDEN, DA MOVE NICHT UEBER FILESYSTEM HINAUS MOEGLICH if [[ "${actionout[$i]}" = "" && $files_for_pes = false ]] then # KOPIEREN AUF EINPROZESSORMASCHINE if [[ "${extout[$i]}" != " " && "${extout[$i]}" != "" ]] then printf "\n >>> OUTPUT: ${localout[$i]} to ${pathout[$i]}.${extout[$i]}\n" cp ${localout[$i]} ${pathout[$i]}.${extout[$i]} else printf "\n >>> OUTPUT: ${localout[$i]} to ${pathout[$i]}\n" cp ${localout[$i]} ${pathout[$i]} fi elif [[ "${actionout[$i]}" = "" && $files_for_pes = true ]] then # DIE DEN PROZESSOREN EINES PARALLELRECHNERS ZUGEHOERIGEN # DATEIEN WERDEN ERST IN EINEM KATALOG GESAMMELT UND DIESER # WIRD DANN KOPIERT # PER MOVE UMBENANNT WERDEN printf "\n >>> OUTPUT: ${localout[$i]}/_.... to ${pathout[$i]}\n" cp -r ${localout[$i]} ${pathout[$i]} fi fi done if (( i != 0 )) then if [[ $transfer_problems = true ]] then printf "\n$striche\n *** OUTPUT-files saved" printf "\n +++ WARNING: some data transfers failed! \n" else printf "\n$striche\n *** all OUTPUT-files saved \n" fi fi # EVENTUELL FOLGEJOB STARTEN # DATEI CONTINUE_RUN MUSS VOM BENUTZERPROGRAMM AUS ERZEUGT WERDEN if [[ -f CONTINUE_RUN ]] then if [[ $archive_save = true ]] then # ZUERST IN MRUN-AUFRUF OPTIONEN FUER FORTSETZUNGSLAUF, FUER # STILLES ABARBEITEN (OHNE INTERAKTIVE RUECKFAGEN) UND FUER # BATCH-BETRIEB (NUR WICHTIG, FALLS BATCH AUF LOKALER MASCHINE # DURCHGEFUEHRT WERDEN SOLL) EINFUEGEN, FALLS NICHT BEREITS VOR- # HANDEN [[ $(echo $mc | grep -c "\-C") = 0 ]] && mc="$mc -C" [[ $(echo $mc | grep -c "\-v") = 0 ]] && mc="$mc -v" [[ $(echo $mc | grep -c "\-b") = 0 ]] && mc="$mc -b" if [[ $(echo $mc | grep -c "#") != 0 ]] then mc=`echo $mc | sed 's/#/f/g'` fi # JOB STARTEN printf "\n\n *** initiating restart-run on \"$return_addres\" using command:\n" echo " $mc" printf "\n$striche\n" if [[ $localhost != $fromhost ]] then if [[ $localhost = nech || $localhost = ibmb || $localhost = ibmh || $localhost = ibms || $localhost = lctit ]] then echo "*** ssh will be used to initiate restart-runs!" echo " return_addres=\"$return_addres\" " echo " return_username=\"$return_username\" " if [[ $return_addres = 172.20.25.41 ]] then # WORKAROUND AUF SCIROCCO AM TIT print "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc " | ssh $return_addres -l $return_username else ssh $return_addres -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc " fi else printf "\n +++ no restart mechanism available for host \"$localhost\" " locat=restart; exit fi # WARTEN, DAMIT SICH RESTART JOB IN QUEUE EINREIHEN KANN, BEVOR # DER AKTUELLE JOB ENDET sleep 30 else # BEI RECHNUNGEN AUF LOKALER MASCHINE KANN MRUN DIREKT AUFGE- # RUFEN WERDEN cd $LOCAL_PWD eval $mc # ' MUESSEN AUSGEWERTET WERDEN cd - > /dev/null fi printf "\n$striche\n *** restart-run initiated \n" # EVENTUELL INPUT-DATEIEN, DIE VON TEMPORAEREM DATENVERZEICHNIS # GEHOLT WORDEN SIND, LOESCHEN (( i = 0 )) while (( i < iin )) do (( i = i + 1 )) if [[ "${got_tmp[$i]}" = true && $keep_data_from_previous_run = false ]] then rm -r $tmp_data_catalog/${frelin[$i]} fi done else printf "\n +++ no restart-run possible, since errors occured" printf "\n during the archive process" fi fi # EVTL. EMAIL-BENACHRICHTIGUNG UEBER ABGESCHLOSSENEN LAUF if [[ "$email_notification" != "" ]] then if [[ $localhost != $fromhost ]] then if [[ -f CONTINUE_RUN ]] then echo "PALM restart run necessary" > email_text echo "description header of actual run:" >> email_text cat CONTINUE_RUN >> email_text echo "mrun-command to restart:" >> email_text echo "$mc" >> email_text else echo "PALM run with base filename \"$fname\" on host \"$localhost\" finished" > email_text fi mail $email_notification < email_text printf "\n *** email notification sent to \"$email_notification\" " fi fi # ALLE ARBEITEN BEENDET. TEMPORAERER KATALOG KANN GELOESCHT WERDEN cd $HOME [[ $delete_temporary_catalog = true ]] && rm -rf $TEMPDIR else # FALLS AUF REMOTE-MASCHINE GERECHNET WERDEN SOLL, WERDEN JETZT ENTSPRE- # CHENDE AKTIONEN DURCHGEFUEHRT # MRUN-BEFEHL FUER REMOTE-MASCHINE ZUSAMMENSTELLEN mrun_com="$mrun_script_name -a $afname -c $config_file -d $fname -f $filetransfer_protocol -h $host -H $fromhost -m $memory -t $cpumax -q $queue -R $return_addres -U $return_username -u $remote_username" [[ "$cpp_opts" != "" ]] && mrun_com=${mrun_com}" -D \"$cpp_opts\"" [[ $do_compile = true ]] && mrun_com=${mrun_com}" -s \"$source_list\"" [[ "$input_list" != "" ]] && mrun_com=${mrun_com}" -i \"$input_list\"" [[ $ignore_archive_error = true ]] && mrun_com=${mrun_com}" -I" [[ $keep_data_from_previous_run = true ]] && mrun_com=${mrun_com}" -k" [[ "$additional_conditions" != "" ]] && mrun_com=${mrun_com}" -K \"$additional_conditions\"" # [[ "$makefile" != "$source_path/Makefile" ]] && mrun_com=${mrun_com}" -M \"$makefile\"" [[ "$output_list" != "" ]] && mrun_com=${mrun_com}" -o \"$output_list\"" [[ "$read_from_config" = false ]] && mrun_com=${mrun_com}" -S" [[ $do_trace = true ]] && mrun_com=${mrun_com}" -x" [[ "$numprocs" != "" ]] && mrun_com=${mrun_com}" -X $numprocs" if [[ $use_openmp = true ]] then mrun_com=${mrun_com}" -O" [[ "$tasks_per_node" != "" ]] && mrun_com=${mrun_com}" -T $threads_per_task" else [[ "$tasks_per_node" != "" ]] && mrun_com=${mrun_com}" -T $tasks_per_node" fi [[ $store_on_archive_system = false ]] && mrun_com=${mrun_com}" -A" [[ $package_list != "" ]] && mrun_com=${mrun_com}" -p \"$package_list\"" [[ $return_password != "" ]] && mrun_com=${mrun_com}" -P $return_password" [[ $delete_temporary_catalog = false ]] && mrun_com=${mrun_com}" -B" [[ $node_usage != default ]] && mrun_com=${mrun_com}" -n $node_usage" if [[ $do_remote = true ]] then printf "\n>>>> MRUN-command on execution host:\n>>>> $mrun_com \n" fi # ZUSAMMENSTELLUNG DES JOBSCRIPTS AUF DATEI jobfile jobfile=jobfile.$RANDOM # TEMPORAERES VERZEICHNIS GENERIEREN UND NACH DORT WECHSELN echo "mkdir $TEMPDIR" >> $jobfile echo "cd $TEMPDIR" >> $jobfile # EVENTUELL FEHLERVERFOLGUNG AKTIVIEREN if [[ $do_trace = true ]] then echo "set -x" >> $jobfile else echo "set +vx" >> $jobfile fi # ABSPEICHERN DER QUELLTEXTE (NUR FALLS UEBERSETZT WERDEN SOLL) # SOWIE GEGEBENENFALLS DES MAKEFILES if [[ $do_compile = true ]] then source_catalog=SOURCES_FOR_RUN_$fname # UNTERVERZEICHNIS FUER QUELLTEXTE UND MAKEFILE ANLEGEN # MRUN WIRD DIESES VRZEICHNIS UEBER ENVIRONMENT VARIABLE # MITGETEILT (UEBERSTEUERT ANGABE IN KONFIGURATIONSDATEI) echo "mkdir SOURCES_FOR_RUN_$fname" >> $jobfile echo "export SOURCES_COMPLETE=true" >> $jobfile echo "cd SOURCES_FOR_RUN_$fname" >> $jobfile for filename in $source_list do # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN echo "cat > $filename << \"%END%\"" >> $jobfile cat $source_catalog/$filename >> $jobfile echo " " >> $jobfile echo "%END%" >> $jobfile echo " " >> $jobfile done if [[ "$use_makefile" = true ]] then # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN echo "cat > Makefile << \"%END%\"" >> $jobfile cat $source_catalog/Makefile >> $jobfile echo " " >> $jobfile echo "%END%" >> $jobfile echo " " >> $jobfile fi echo "cd - > /dev/null" >> $jobfile fi # ABSPEICHERN DER KONFIGURATIONSDATEI # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN echo "cat > $config_file << \"%END%\"" >> $jobfile cat $config_file >> $jobfile echo "%END%" >> $jobfile echo " " >> $jobfile # ABSPEICHERN DER AKTUELLEN MRUN-VERSION # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN echo "cat > $mrun_script_name <<\"%END%\"" >> $jobfile cat ${PALM_BIN}/$mrun_script_name >> $jobfile echo "%END%" >> $jobfile if [[ $host = lctit ]] then echo "sed 's/bin\/ksh/home2\/usr5\/mkanda\/pub\/ksh/' < $mrun_script_name > mrun_new" >> $jobfile echo "mv mrun_new $mrun_script_name" >> $jobfile fi echo "chmod u+x $mrun_script_name" >> $jobfile echo "execute_mrun=true" >> $jobfile echo " " >> $jobfile # EVTL. BENOETIGTE INPUT-DATEIEN PER FTP HOLEN ODER DEM JOB DIREKT # MITGEBEN UND AUF DEM REMOTE-RECHNER IM BENUTZERVERZEICHNIS ABLEGEN # FALLS DIESES NICHT EXISTIERT, WIRD VERSUCHT, DAS JEWEILS LETZTE # UNTERVERZEICHNIS DES PFADNAMENS ANZULEGEN if [[ $do_remote = true ]] then (( i = 0 )) while (( i < iin )) do (( i = i + 1 )) echo "[[ ! -d ${pathin[$i]} ]] && mkdir -p ${pathin[$i]}" >> $jobfile if [[ "${transin[$i]}" = job ]] then echo "cat > ${remotepathin[$i]} <<\"%END%\"" >> $jobfile eval cat ${pathin[$i]}/${frelin[$i]} >> $jobfile echo " " >> $jobfile echo "%END%" >> $jobfile else if [[ $filetransfer_protocol = ftp ]] then echo "ftpcopy -b -o -g -s $return_addres ${remotepathin[$i]} \"${pathin[$i]}\" ${frelin[$i]}" >> $jobfile else echo "batch_scp -b -o -g -s -u $return_username $return_addres ${remotepathin[$i]} \"${pathin[$i]}\" ${frelin[$i]}" >> $jobfile fi fi # UEBERPRUEFEN, OB DATEI ANGELEGT WERDEN KONNTE echo "if [[ \$? = 1 ]]" >> $jobfile echo "then" >> $jobfile echo " echo \" \" " >> $jobfile echo " echo \"+++ file ${remotepathin[$i]} could not be created\" " >> $jobfile echo " echo \" please check, if directory exists on $host!\" " >> $jobfile echo " echo \"+++ MRUN will not be continued\" " >> $jobfile echo " execute_mrun=false" >> $jobfile echo "fi" >> $jobfile done fi # ARBEITSKATALOG AUF DER LOKALEN MASCHINE FUER EVENTUELLE # FORTSETZUNGSLAUEFE PER ENV-VARIABLE UEBERGEBEN echo "LOCAL_PWD=$working_directory" >> $jobfile echo "export LOCAL_PWD" >> $jobfile # EBENSO LOKALEN MRUN-KATALOG UEBERGEBEN echo "LOCAL_MRUN_PATH=$PALM_BIN" >> $jobfile echo "export LOCAL_MRUN_PATH" >> $jobfile # echo "for_subjob_to_do=\"rm -rf $TEMPDIR\" " >> $jobfile # MRUN AUF ZIELRECHNER AUFRUFEN echo "set -x" >> $jobfile echo "[[ \$execute_mrun = true ]] && ./$mrun_com" >> $jobfile echo 'ls -al; echo `pwd`' >> $jobfile echo "cd \$HOME" >> $jobfile echo "rm -rf $TEMPDIR" >> $jobfile # JOB PER SUBJOB STARTEN if [[ $silent = false ]] then printf "\n " else printf "\n\n" fi subjob $job_on_file -h $host -u $remote_username -q $queue -m $memory -N $node_usage -t $cpumax $XOPT $TOPT $OOPT -n $fname -f $filetransfer_protocol -v $jobfile rm -rf $jobfile fi # ENDE REMOTE-TEIL # ENDE DER PROZEDUR