Changeset 2566


Ignore:
Timestamp:
Oct 20, 2017 8:50:47 AM (7 years ago)
Author:
raasch
Message:

palmrun adjusted for grid engine batch systems, informative messages reduced and reformatted

Location:
palm/trunk/SCRIPTS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palmbuild

    r2506 r2566  
    2727# -----------------
    2828# $Id$
     29# informative messages switched of almost completely in silent mode
     30# two header blocks merged into one
     31#
     32# 2506 2017-09-29 08:30:37Z raasch
    2933# option -V added to check for an existing SOURCES_FOR_RUN_... folder
    3034# host configuration added to SOURCES_FOR_RUN_... folder name
     
    8286          exit 1
    8387       else
    84           printf "\n\n *** palmbuild finished \n\n"
     88          if [[ $silent = false ]]
     89          then
     90             printf "\n\n *** palmbuild finished \n\n"
     91          fi
    8592          exit 0
    8693       fi
     
    295302
    296303    # HEADER-OUTPUT (PART1: MESSAGES CONCERNING THE LOCAL HOST)
    297  calltime=$(date)
    298  printf "\n"
    299  printf "#------------------------------------------------------------------------# \n"
    300  printf "| %-40s%30s | \n" "$version" "$calltime"
    301  printf "|                                                                        | \n"
    302  printf "| %-13s%-57s | \n" "called on:" "$(hostname) (IP:$local_ip)"
    303  column2=$(echo $config_file | cut -c1-57 )
    304  printf "| %-13s%-57s | \n" "config file:" "$column2"
    305  line=$(echo "$config_file" | cut -c58-)
    306  while [[ "$line" != "" ]]
    307  do
    308     column1=""
    309     column2=$(echo $line | cut -c1-57 )
    310     printf "| %-13s%-57s | \n" "$column1" "$column2"
    311     line=$(echo "$line" | cut -c58-)
    312  done
    313  column2=$(echo $makefile | cut -c1-57 )
    314  printf "| %-13s%-57s | \n" "makefile:" "$column2"
    315  line=$(echo "$makefile" | cut -c58-)
    316  while [[ "$line" != "" ]]
    317  do
    318     column1=""
    319     column2=$(echo $line | cut -c1-57 )
    320     printf "| %-13s%-57s | \n" "$column1" "$column2"
    321     line=$(echo "$line" | cut -c58-)
    322  done
    323  column2=$(echo $source_path | cut -c1-57 )
    324  printf "| %-13s%-57s | \n" "source path:" "$column2"
    325  line=$(echo "$source_path" | cut -c58-)
    326  while [[ "$line" != "" ]]
    327  do
    328     column1=""
    329     column2=$(echo $line | cut -c1-57 )
    330     printf "| %-13s%-57s | \n" "$column1" "$column2"
    331     line=$(echo "$line" | cut -c58-)
    332  done
    333  printf "#------------------------------------------------------------------------# \n"
    334 
    335 
    336 
    337     # TAR THE SOURCES AND MAKEFILES
    338     # UTILITIES ARE TEMPORARILY COPIED TO THE SOURCE DIRECTORY IN ORDER TO TAR
    339     # THEM TOO
    340  cd  $source_path
    341  printf "\n\n  *** tar of makefile and source files in"
    342  printf "\n      $source_path"
    343  cp -p  ../UTIL/combine_plot_fields.f90  .
    344  cp -p  ../UTIL/compare_palm_logs.f90  .
    345  cp -p  ../UTIL/Makefile_utilities  .
    346  tar -cf  ${program_name}_sources.tar  Makefile*  *.$suf
    347  rm  combine_plot_fields.f90  compare_palm_logs.f90  Makefile_utilities
    348  printf "\n"
    349 
    350 
    351 
    352     # GET CONFIRMATION TO CONTINUE
    353  printf "\n  *** update will be made for host configuration \"$host_configuration\" "
    354 
    355 
    356304 if [[ $silent = false ]]
    357305 then
    358     answer=dummy
    359     printf "\n\n"
    360     while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
     306    calltime=$(date)
     307    printf "\n"
     308    printf "#------------------------------------------------------------------------# \n"
     309    printf "| %-40s%30s | \n" "$version" "$calltime"
     310    printf "|                                                                        | \n"
     311    printf "| %-13s%-57s | \n" "called on:" "$(hostname) (IP:$local_ip)"
     312    column2=$(echo $config_file | cut -c1-57 )
     313    printf "| %-13s%-57s | \n" "config file:" "$column2"
     314    line=$(echo "$config_file" | cut -c58-)
     315    while [[ "$line" != "" ]]
    361316    do
    362        printf " >>> continue (y/n) ?  "
    363        read  answer
     317       column1=""
     318       column2=$(echo $line | cut -c1-57 )
     319       printf "| %-13s%-57s | \n" "$column1" "$column2"
     320       line=$(echo "$line" | cut -c58-)
    364321    done
    365     if [[ $answer = n  ||  $answer = N ]]
    366     then
    367        locat=user_abort; exit
    368     fi
    369  fi
    370 
    371 
    372 
    373 
    374     printf "\n\n#------------------------------------------------------------------------# \n"
    375 
     322    column2=$(echo $makefile | cut -c1-57 )
     323    printf "| %-13s%-57s | \n" "makefile:" "$column2"
     324    line=$(echo "$makefile" | cut -c58-)
     325    while [[ "$line" != "" ]]
     326    do
     327       column1=""
     328       column2=$(echo $line | cut -c1-57 )
     329       printf "| %-13s%-57s | \n" "$column1" "$column2"
     330       line=$(echo "$line" | cut -c58-)
     331    done
     332    column2=$(echo $source_path | cut -c1-57 )
     333    printf "| %-13s%-57s | \n" "source path:" "$column2"
     334    line=$(echo "$source_path" | cut -c58-)
     335    while [[ "$line" != "" ]]
     336    do
     337       column1=""
     338       column2=$(echo $line | cut -c1-57 )
     339       printf "| %-13s%-57s | \n" "$column1" "$column2"
     340       line=$(echo "$line" | cut -c58-)
     341    done
     342    printf "|                                                                        | \n"
     343   
    376344    if [[ "$remote_ip" != "" ]]
    377345    then
    378346       column2="$host_configuration"
    379        printf "| %-20s%-50s | \n" "host identifier:" "$column2"
    380        printf "|                                                                        | \n"
     347       printf "| %-20s%-50s | \n" "host configuration:" "$column2"
    381348       column2=$(echo "$make_depository" | cut -c1-50 )
    382349       printf "| %-20s%-50s | \n" "remote depository:" "$column2"
     
    384351       column2="$host_configuration"
    385352       printf "| %-20s%-50s | \n" "host identifier:" "$column2"
    386        printf "|                                                                        | \n"
    387353       column2=$(echo "$make_depository" | cut -c1-50 )
    388354       printf "| %-20s%-50s | \n" "local depository:" "$column2"
     
    396362       line=$(echo "$line" | cut -c51-)
    397363    done
    398 
     364   
    399365    if [[ "$remote_ip" != "" ]]
    400366    then
     
    405371       printf "| %-20s%-50s | \n" "address:" "$local_ip"
    406372    fi
    407 
     373   
    408374    printf "| %-20s%-50s | \n" "compiler:" "$compiler_name"
    409375    printf "| %-20s%-50s | \n" "serial compiler:" "$compiler_name_ser"
    410 
     376   
    411377    if [[ "$make_options" != "" ]]
    412378    then
     
    471437    printf "#------------------------------------------------------------------------# \n"
    472438
    473     if [[ $silent = false ]]
    474     then
    475        answer=dummy
    476        printf "\n\n"
    477        while [[ "$answer" != y  &&  "$answer" != Y  && "$answer" != c  &&  "$answer" != C  && "$answer" != s  &&  "$answer" != S  &&  "$answer" != a  &&  "$answer" != A ]]
    478        do
    479           printf " >>> continue (y(es)/c(ontinue)/a(bort)) ?  "
    480           read  answer
    481        done
    482        if [[ $answer = a  ||  $answer = A ]]
    483        then
    484           locat=user_abort; exit
    485        fi
    486        if [[ $answer = c  ||  $answer = C ]]
    487        then
    488           silent=true
    489        fi
    490     fi
    491 
    492 
    493        # MAKE ON REMOTE HOST
    494     if [[ "$remote_ip" != "" ]]
    495     then
    496 
    497           # NEXT IS THE BRANCH FOR CREATING THE MAKE_DEPOSITORY_...
    498        if [[ "$fname" = "" ]]
    499        then
    500 
    501              # COPY CURRENT SOURCE CODE TO SOURCE-CODE DIRECTORY ON THE REMOTE HOST
    502              # CREATE THIS DIRECTORY, IF IT DOES NOT EXIST
     439    answer=dummy
     440    printf "\n"
     441    while [[ "$answer" != y  &&  "$answer" != Y  && "$answer" != c  &&  "$answer" != C  && "$answer" != s  &&  "$answer" != S  &&  "$answer" != a  &&  "$answer" != A ]]
     442    do
     443       printf " >>> continue (y(es)/c(ontinue)/a(bort)) ?  "
     444       read  answer
     445    done
     446    if [[ $answer = a  ||  $answer = A ]]
     447    then
     448       locat=user_abort; exit
     449    fi
     450    if [[ $answer = c  ||  $answer = C ]]
     451    then
     452       silent=true
     453    fi
     454 fi
     455
     456
     457    # TAR THE SOURCES AND MAKEFILES
     458    # UTILITIES ARE TEMPORARILY COPIED TO THE SOURCE DIRECTORY IN ORDER TO TAR
     459    # THEM TOO
     460 if [[ $silent = false ]]
     461 then
     462    printf "\n\n  *** tar of makefile and source files in"
     463    printf "\n      $source_path\n"
     464 fi
     465 cd  $source_path
     466 cp -p  ../UTIL/combine_plot_fields.f90  .
     467 cp -p  ../UTIL/compare_palm_logs.f90  .
     468 cp -p  ../UTIL/Makefile_utilities  .
     469 tar -cf  ${program_name}_sources.tar  Makefile*  *.$suf
     470 rm  combine_plot_fields.f90  compare_palm_logs.f90  Makefile_utilities
     471
     472
     473    # MAKE ON REMOTE HOST
     474 if [[ "$remote_ip" != "" ]]
     475 then
     476
     477       # NEXT IS THE BRANCH FOR CREATING THE MAKE_DEPOSITORY_...
     478    if [[ "$fname" = "" ]]
     479    then
     480
     481          # COPY CURRENT SOURCE CODE TO SOURCE-CODE DIRECTORY ON THE REMOTE HOST
     482          # CREATE THIS DIRECTORY, IF IT DOES NOT EXIST
     483       if [[ $silent = false ]]
     484       then
     485          echo " "
    503486          echo "  *** copying \"${program_name}_sources.tar\" to \"${remote_ip}:${make_depository}/\" "
    504487          echo "[[ ! -d ${make_depository} ]]  &&  (echo \"  *** ${make_depository} will be created\"; mkdir -p  ${make_depository})"  |  ssh  -q  $ssh_key ${remote_username}@${remote_ip}  2>&1
    505 
    506488          scp  $ssh_key ${source_path}/${program_name}_sources.tar  ${remote_username}@${remote_ip}:${make_depository}/${program_name}_sources.tar
    507 
    508 
    509 
    510              # UNTAR PREVIOUS UPDATE ON REMOTE HOST, IF EXISTING
     489       else
     490          echo "[[ ! -d ${make_depository} ]]  &&  mkdir -p  ${make_depository}"  |  ssh  -q  $ssh_key ${remote_username}@${remote_ip}  2>&1
     491          scp  $ssh_key ${source_path}/${program_name}_sources.tar  ${remote_username}@${remote_ip}:${make_depository}/${program_name}_sources.tar  >  /dev/null
     492       fi
     493
     494
     495
     496
     497          # UNTAR PREVIOUS UPDATE ON REMOTE HOST, IF EXISTING
     498       if [[ $silent = false ]]
     499       then
    511500          echo "  *** untar previous update on remote host, if existing"
    512           echo "cd ${make_depository}; [[ -f ${program_name}_current_version.tar ]]  &&  tar -xf  ${program_name}_current_version.tar"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
    513 
    514 
    515              # UNTAR CURRENT SOURCES ON REMOTE HOST
     501       fi
     502       echo "cd ${make_depository}; [[ -f ${program_name}_current_version.tar ]]  &&  tar -xf  ${program_name}_current_version.tar"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
     503
     504
     505          # UNTAR CURRENT SOURCES ON REMOTE HOST
     506       if [[ $silent = false ]]
     507       then
    516508          echo "  *** untar current sources on remote host"
    517           echo  "cd ${make_depository}; tar -xf  ${program_name}_sources.tar"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
    518 
    519 
    520              # CREATE INIT AND MODULE COAMMNDS
     509       fi
     510       echo  "cd ${make_depository}; tar -xf  ${program_name}_sources.tar"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
     511
     512
     513          # CREATE INIT AND MODULE COAMMNDS
     514       [[ "$login_init_cmd" != "" ]]   &&  login_init_cmd=${login_init_cmd}";"
     515       [[ "$module_commands" != "" ]]  &&  module_commands=${module_commands}";"
     516
     517
     518          # FIRST CREATE EXECUTABLES FOR THE UTILITY ROUTINES
     519       if [[ $silent = false ]]
     520       then
     521          echo " "
     522          echo "  *** creating utilities on remote host"
     523       fi
     524       make_call_string="make  -f Makefile_utilities  $make_options  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$linker_options\" "
     525       echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${host_configuration}_last_make_protocol
     526
     527       if [[ $(grep -c MAKE_ERROR ${host_configuration}_last_make_protocol) != 0 ]]
     528       then
     529          printf "\a\n  +++ error(s) occurred during compiling or linking of utilities"
     530          printf "\n      for host configuration \"$host_configuration\" "
     531          if [[ $silent = false ]]
     532          then
     533             answer=dummy
     534             printf "\n"
     535             while [[ "$answer" != c  &&  "$answer" != k ]]
     536             do
     537                printf "  >>> continue / list errors / kill palmbuild (c/l/k) ? "
     538                read  answer
     539                if [[ "$answer" = l ]]
     540                then
     541                   more ${host_configuration}_last_make_protocol
     542                fi
     543             done
     544             if [[ $answer = k ]]
     545             then
     546                locat=user_abort; exit
     547             fi
     548          else
     549                # ABORT ANYWAY
     550             locat=user_abort; exit
     551          fi
     552       fi
     553
     554
     555          # NOW COMPILE THE PALM CODE
     556          # COMMANDS WILL BE COMMUNICATED TO SSH VIA PIPE, SINCE THIS WAY THE SYSTEM- AND
     557          # USER-PROFILES OF THE SHELL ARE COMPLETELY EXECUTED (OTHERWISE, MAKE
     558          # MAY E.G. MISS THE COMPILER-PATHS)
     559       if [[ $silent = false ]]
     560       then
     561          echo " "
     562          echo "  *** compile PALM sources on remote host"
     563       fi
     564       make_call_string="make  $make_options  PROG=$program_name  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$linker_options\" "
     565       echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${host_configuration}_last_make_protocol
     566
     567       if [[ $(grep -c MAKE_ERROR ${host_configuration}_last_make_protocol) != 0 ]]
     568       then
     569          printf "\a\n  +++ error(s) occurred during compiling or linking for host configuration \"$host_configuration\" "
     570          if [[ $silent = false ]]
     571          then
     572             answer=dummy
     573             printf "\n"
     574             while [[ "$answer" != c  &&  "$answer" != k ]]
     575             do
     576                printf "  >>> continue / list errors / kill palmbuild (c/l/k) ? "
     577                read  answer
     578                if [[ "$answer" = l ]]
     579                then
     580                   more ${host_configuration}_last_make_protocol
     581                fi
     582             done
     583             if [[ $answer = k ]]
     584             then
     585                locat=user_abort; exit
     586             fi
     587          else
     588                # ABORT ANYWAY
     589             locat=user_abort; exit
     590          fi
     591       fi
     592
     593          # TAR UPDATED VERSION ON THE REMOTE HOST
     594       if [[ $silent = false ]]
     595       then
     596          printf "\n  *** tar update on remote host ..."
     597       fi
     598       echo  "cd ${make_depository}; chmod u+w *; tar -cf  ${program_name}_current_version.tar  ${program_name}  *.f90 *.o *.mod *.x"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
     599
     600
     601       # NOW COMES THE BRANCH FOR CREATING THE EXECUTABLE FOR THE CURRENT RUN
     602       # INCLUDING E.G. USER-INTERFACE ROUTINES. ALSO ADD OTHER UTILITY EXECUTABLES. EVERYTHING IS
     603       # COLLECTED IN DIRECTORY SOURCES_FOR_RUN_...
     604    elif [[ "$fname" != "" ]]
     605    then
     606
     607          # FIRST CHECK, IF COMPILED SOURCES FOR THIS RUN IDENTIFIER EXISTS
     608          # AND ASK, IF THEY SHALL BE USED
     609       echo  "[[ -d ${fast_io_catalog}/${sources_for_run_catalog} ]]  &&  echo sources for run found" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1  >  ${host_configuration}_last_make_protocol
     610       if [[ $(grep -c "sources for run found" ${host_configuration}_last_make_protocol) != 0  &&  $use_existing_sources_folder = true ]]
     611       then
     612          printf "\a\n  *** compiled sources for run \"$fname\" found on remote host in folder"
     613          printf "\n      ${fast_io_catalog}/${sources_for_run_catalog}"
     614          printf "\n      will be used!"
     615          exit
     616       fi
     617
     618          # COPY MAKE DEPOSITORY ON REMOTE MACHINE TO SOURCES_FOR_RUN_...
     619       if [[ $silent = false ]]
     620       then
     621          printf "\n  *** copy MAKE_DEPOSITORY_${host_configuration} on remote host to $sources_for_run_catalog \n"
     622       fi
     623       echo  "rm -rf ${fast_io_catalog}/${sources_for_run_catalog}; mkdir -p ${fast_io_catalog}/${sources_for_run_catalog}; cp ${make_depository}/${program_name}_current_version.tar  ${fast_io_catalog}/${sources_for_run_catalog}; cd ${fast_io_catalog}/${sources_for_run_catalog}; tar xf ${program_name}_current_version.tar"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
     624
     625
     626          # COPY CONTENTS OF SOURCES_FOR_RUN_... TO SOURCES_FOR_RUN_... ON THE REMOTE MACHINE
     627       if [[ $silent = false ]]
     628       then
     629          printf "\n  *** copy ${base_directory}/${sources_for_run_catalog}"
     630          printf "\n      to $sources_for_run_catalog on remote host \n"
     631       fi
     632       scp  -q  $ssh_key  ${base_directory}/${sources_for_run_catalog}/{*,.[!.]*}  ${remote_username}@${remote_ip}:${fast_io_catalog}/${sources_for_run_catalog}
     633
     634
     635          # CREATE EXECUTABLE FROM THE NEW/MODIFIED SOURCE FILES, IF THERE ARE ANY
     636       if [[ $(ls -1 ${base_directory}/${sources_for_run_catalog}/ | grep -c .$suf) != 0 ]]
     637       then
     638
     639          make_call_string="make  $make_options  PROG=$program_name  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$linker_options\" "
    521640          [[ "$login_init_cmd" != "" ]]   &&  login_init_cmd=${login_init_cmd}";"
    522641          [[ "$module_commands" != "" ]]  &&  module_commands=${module_commands}";"
    523 
    524 
    525              # FIRST CREATE EXECUTABLES FOR THE UTILITY ROUTINES
    526           echo " "
    527           echo "  *** creating utilities on remote host"
    528           make_call_string="make  -f Makefile_utilities  $make_options  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$linker_options\" "
    529           echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${host_configuration}_last_make_protocol
    530 
    531           if [[ $(grep -c MAKE_ERROR ${host_configuration}_last_make_protocol) != 0 ]]
    532           then
    533              printf "\a\n  +++ error(s) occurred during compiling or linking of utilities"
    534              printf "\n      for host configuration \"$host_configuration\" "
    535              if [[ $silent = false ]]
    536              then
    537                 answer=dummy
    538                 printf "\n"
    539                 while [[ "$answer" != c  &&  "$answer" != k ]]
    540                 do
    541                    printf "  >>> continue / list errors / kill palmbuild (c/l/k) ? "
    542                    read  answer
    543                    if [[ "$answer" = l ]]
    544                    then
    545                       more ${host_configuration}_last_make_protocol
    546                    fi
    547                 done
    548                 if [[ $answer = k ]]
    549                 then
    550                    locat=user_abort; exit
    551                 fi
    552              else
    553                    # ABORT ANYWAY
    554                 locat=user_abort; exit
    555              fi
    556           fi
    557 
    558 
    559              # NOW COMPILE THE PALM CODE
    560              # COMMANDS WILL BE COMMUNICATED TO SSH VIA PIPE, SINCE THIS WAY THE SYSTEM- AND
    561              # USER-PROFILES OF THE SHELL ARE COMPLETELY EXECUTED (OTHERWISE, MAKE
    562              # MAY E.G. MISS THE COMPILER-PATHS)
    563           echo " "
    564           echo "  *** compile PALM sources on remote host"
    565           make_call_string="make  $make_options  PROG=$program_name  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$linker_options\" "
    566           echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${host_configuration}_last_make_protocol
     642          if [[ $silent = false ]]
     643          then
     644             echo "  *** execute \"make\" on remote host"
     645          fi
     646          echo "$login_init_cmd $module_commands cd ${fast_io_catalog}/${sources_for_run_catalog}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${host_configuration}_last_make_protocol
    567647
    568648          if [[ $(grep -c MAKE_ERROR ${host_configuration}_last_make_protocol) != 0 ]]
     
    584664                if [[ $answer = k ]]
    585665                then
     666                   echo "rm -rf ${fast_io_catalog}/${sources_for_run_catalog}" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1
    586667                   locat=user_abort; exit
    587668                fi
    588669             else
    589670                   # ABORT ANYWAY
     671                echo "rm -rf ${fast_io_catalog}/${sources_for_run_catalog}" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1
    590672                locat=user_abort; exit
    591673             fi
    592674          fi
    593675
    594              # TAR UPDATED VERSION ON THE REMOTE HOST
    595           printf "\n  *** tar update on remote host ..."
    596           echo  "cd ${make_depository}; chmod u+w *; tar -cf  ${program_name}_current_version.tar  ${program_name}  *.f90 *.o *.mod *.x"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
    597 
    598 
    599           # NOW COMES THE BRANCH FOR CREATING THE EXECUTABLE FOR THE CURRENT RUN
    600           # INCLUDING E.G. USER-INTERFACE ROUTINES. ALSO ADD OTHER UTILITY EXECUTABLES. EVERYTHING IS
    601           # COLLECTED IN DIRECTORY SOURCES_FOR_RUN_...
    602        elif [[ "$fname" != "" ]]
    603        then
    604 
    605              # FIRST CHECK, IF COMPILED SOURCES FOR THIS RUN IDENTIFIER EXISTS
    606              # AND ASK, IF THEY SHALL BE USED
    607           echo  "[[ -d ${fast_io_catalog}/${sources_for_run_catalog} ]]  &&  echo sources for run found" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1  >  ${host_configuration}_last_make_protocol
    608           if [[ $(grep -c "sources for run found" ${host_configuration}_last_make_protocol) != 0  &&  $use_existing_sources_folder = true ]]
    609           then
    610              printf "\a\n  *** compiled sources for run \"$fname\" found on remote host in folder"
    611              printf "\n      ${fast_io_catalog}/${sources_for_run_catalog}"
    612              printf "\n      will be used!"
    613              exit
    614           fi
    615 
    616              # COPY MAKE DEPOSITORY ON REMOTE MACHINE TO SOURCES_FOR_RUN_...
    617           printf "\n  *** copy MAKE_DEPOSITORY_${host_configuration} on remote host to $sources_for_run_catalog \n"
    618           echo  "rm -rf ${fast_io_catalog}/${sources_for_run_catalog}; mkdir -p ${fast_io_catalog}/${sources_for_run_catalog}; cp ${make_depository}/${program_name}_current_version.tar  ${fast_io_catalog}/${sources_for_run_catalog}; cd ${fast_io_catalog}/${sources_for_run_catalog}; tar xf ${program_name}_current_version.tar"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
    619 
    620 
    621              # COPY CONTENTS OF SOURCES_FOR_RUN_... TO SOURCES_FOR_RUN_... ON THE REMOTE MACHINE
    622           printf "\n  *** copy ${base_directory}/${sources_for_run_catalog}"
    623           printf "\n      to $sources_for_run_catalog on remote host \n"
    624           scp  -q  $ssh_key  ${base_directory}/${sources_for_run_catalog}/{*,.[!.]*}  ${remote_username}@${remote_ip}:${fast_io_catalog}/${sources_for_run_catalog}
    625 
    626 
    627              # CREATE EXECUTABLE FROM THE NEW/MODIFIED SOURCE FILES, IF THERE ARE ANY
    628           if [[ $(ls -1 ${base_directory}/${sources_for_run_catalog}/ | grep -c .$suf) != 0 ]]
    629           then
    630 
    631              make_call_string="make  $make_options  PROG=$program_name  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$linker_options\" "
    632              [[ "$login_init_cmd" != "" ]]   &&  login_init_cmd=${login_init_cmd}";"
    633              [[ "$module_commands" != "" ]]  &&  module_commands=${module_commands}";"
    634              echo "  *** execute \"make\" on remote host"
    635              echo "$login_init_cmd $module_commands cd ${fast_io_catalog}/${sources_for_run_catalog}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${host_configuration}_last_make_protocol
    636 
    637              if [[ $(grep -c MAKE_ERROR ${host_configuration}_last_make_protocol) != 0 ]]
    638              then
    639                 printf "\a\n  +++ error(s) occurred during compiling or linking for host configuration \"$host_configuration\" "
    640                 if [[ $silent = false ]]
    641                 then
    642                    answer=dummy
    643                    printf "\n"
    644                    while [[ "$answer" != c  &&  "$answer" != k ]]
    645                    do
    646                       printf "  >>> continue / list errors / kill palmbuild (c/l/k) ? "
    647                       read  answer
    648                       if [[ "$answer" = l ]]
    649                       then
    650                          more ${host_configuration}_last_make_protocol
    651                       fi
    652                    done
    653                    if [[ $answer = k ]]
    654                    then
    655                       echo "rm -rf ${fast_io_catalog}/${sources_for_run_catalog}" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1
    656                       locat=user_abort; exit
    657                    fi
    658                 else
    659                       # ABORT ANYWAY
    660                    echo "rm -rf ${fast_io_catalog}/${sources_for_run_catalog}" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1
    661                    locat=user_abort; exit
    662                 fi
    663              fi
    664 
    665           else
    666 
    667              echo "  *** nothing to compile for this run"
    668 
    669           fi
    670 
    671        fi
    672 
    673        rm -rf  ${source_path}/${host_configuration}_last_make_protocol
    674 
    675 
    676        # MAKE ON LOCAL HOST
    677     else
    678 
    679 
    680           # NEXT IS THE BRANCH FOR CREATING THE MAKE_DEPOSITORY_... ON THE
    681           # LOCAL HOST
    682        if [[ "$fname" = "" ]]
    683        then
    684 
    685              # SET THE ENVIRONMENT (EXECUTE INIT AND MODULE COMMANDS)
    686           if [[ "$login_init_cmd" != "" ]]
    687           then
    688              $login_init_cmd
    689           fi
    690 
    691           if [[ "$module_commands" != "" ]]
    692           then
    693              $module_commands
    694           fi
    695 
    696 
    697              # CREATE MAKE-DEPOSITORY, IF IT DOES NOT EXIST
    698           eval make_depository=$make_depository
    699           if [[ ! -d $make_depository ]]
    700           then
    701              if  mkdir -p $make_depository
     676       else
     677
     678          echo "  *** nothing to compile for this run"
     679
     680       fi
     681
     682    fi
     683
     684    rm -rf  ${source_path}/${host_configuration}_last_make_protocol
     685
     686
     687    # MAKE ON LOCAL HOST
     688 else
     689
     690
     691       # NEXT IS THE BRANCH FOR CREATING THE MAKE_DEPOSITORY_... ON THE
     692       # LOCAL HOST
     693    if [[ "$fname" = "" ]]
     694    then
     695
     696          # SET THE ENVIRONMENT (EXECUTE INIT AND MODULE COMMANDS)
     697       if [[ "$login_init_cmd" != "" ]]
     698       then
     699          $login_init_cmd
     700       fi
     701
     702       if [[ "$module_commands" != "" ]]
     703       then
     704          $module_commands
     705       fi
     706
     707
     708          # CREATE MAKE-DEPOSITORY, IF IT DOES NOT EXIST
     709       eval make_depository=$make_depository
     710       if [[ ! -d $make_depository ]]
     711       then
     712          if  mkdir -p $make_depository
     713          then
     714             if [[ $silent = false ]]
    702715             then
    703716                printf "\n\n  *** directory for local make depository:"
    704717                printf "\n           $make_depository"
    705718                printf "\n      was created\n"
    706              else
    707                 printf "\n  +++ directory for local make depository:"
    708                 printf "\n           $make_depository"
    709                 printf "\n      cannot be created"
    710                 locat=local_depository; exit
    711719             fi
    712           fi
    713 
    714              # COPY SOURCE-CODE FROM REPOSITORY TO MAKE-DEPOSITORY
     720          else
     721             printf "\n  +++ directory for local make depository:"
     722             printf "\n           $make_depository"
     723             printf "\n      cannot be created"
     724             locat=local_depository; exit
     725          fi
     726       fi
     727
     728          # COPY SOURCE-CODE FROM REPOSITORY TO MAKE-DEPOSITORY
     729       if [[ $silent = false ]]
     730       then
    715731          echo " "
    716732          echo "  *** untar current source sources on local host in"
    717733          echo "      $make_depository"
    718           cd  $make_depository
    719           cp  $source_path/${program_name}_sources.tar  .
    720           tar xf  ${program_name}_sources.tar
    721 
    722 
    723              # FIRST CREATE EXECUTABLES FOR THE UTILITY ROUTINES
     734       fi
     735       cd  $make_depository
     736       cp  $source_path/${program_name}_sources.tar  .
     737       tar xf  ${program_name}_sources.tar
     738
     739
     740          # FIRST CREATE EXECUTABLES FOR THE UTILITY ROUTINES
     741       if [[ $silent = false ]]
     742       then
    724743          echo " "
    725744          echo "  *** creating utilities on local host"
    726           make  -f Makefile_utilities  $make_options  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$linker_options"
    727 
    728 
    729              # CALL MAKE ON LOCAL HOST USING THE  OPTIONS DETERMINED FURTHER ABOVE
     745       fi
     746       make  -f Makefile_utilities  $make_options  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$linker_options"
     747
     748
     749          # CALL MAKE ON LOCAL HOST USING THE  OPTIONS DETERMINED FURTHER ABOVE
     750       if [[ $silent = false ]]
     751       then
    730752          echo " "
    731753          echo "  *** compile PALM sources on local host"
    732 
    733           make  $make_options  PROG=$program_name  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$linker_options"  2>&1 | tee ${host_configuration}_last_make_protocol
     754       fi
     755
     756       make  $make_options  PROG=$program_name  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$linker_options"  2>&1 | tee ${host_configuration}_last_make_protocol
     757
     758       if [[ $? != 0 ]]
     759       then
     760          printf "\a\n  +++ error(s) occurred during compiling or linking for host configuration \"$host_configuration\" "
     761          if [[ $silent = false ]]
     762          then
     763             answer=dummy
     764             printf "\n"
     765             while [[ "$answer" != c  &&  "$answer" != k ]]
     766             do
     767                printf "  >>> continue / list errors / kill palmbuild (c/l/k) ? "
     768                read  answer
     769                if [[ "$answer" = l ]]
     770                then
     771                   more ${host_configuration}_last_make_protocol
     772                fi
     773             done
     774             if [[ $answer = k ]]
     775             then
     776                locat=user_abort; exit
     777             fi
     778          else
     779                # ABORT ANYWAY
     780             locat=user_abort; exit
     781          fi
     782       fi
     783
     784
     785          # TAR NEW VERSION ON LOCAL HOST
     786       if [[ $silent = false ]]
     787       then
     788          printf "\n  *** tar update on local host ..."
     789       fi
     790       tar -cf  ${program_name}_current_version.tar  ${program_name} *.$suf *.o *.mod *.x
     791
     792    else
     793
     794          # NOW COMES THE BRANCH FOR CREATING THE EXECUTABLE FOR THE CURRENT RUN
     795          # INCLUDING E.G. USER-INTERFACE ROUTINES. ALSO ADD OTHER UTILITY EXECUTABLES. EVERYTHING IS
     796          # COLLECTED IN DIRECTORY SOURCES_FOR_RUN_...
     797
     798          # FIRST CHECK, IF COMPILED SOURCES FOR THIS RUN IDENTIFIER EXISTS
     799          # AND ASK, IF THEY SHALL BE USED
     800       if [[ -d ${fast_io_catalog}/${sources_for_run_catalog}  &&  $use_existing_sources_folder = true ]]
     801       then
     802          printf "\a\n  *** compiled sources for run \"$fname\" found on local host in folder"
     803          printf "\n      ${fast_io_catalog}/${sources_for_run_catalog}"
     804          printf "\n      will be used!"
     805          exit
     806       fi
     807
     808          # SECOND CHECK, IF A DEPOSITORY EXISTS ON THE LOCAL MACHINE
     809       if [[ ! -d ${make_depository} ]]
     810       then
     811          printf "\n  +++ directory for local make depository:"
     812          printf "\n           $make_depository"
     813          printf "\n      not found. Please run \"palmbuild -h $host_configuration\" "
     814          locat=make_depository; exit
     815       fi
     816
     817
     818          # COPY MAKE DEPOSITORY ON LOCAL MACHINE TO SOURCES_FOR_RUN_...
     819       if [[ $silent = false ]]
     820       then
     821          printf "\n  *** copy MAKE_DEPOSITORY_${host_configuration} on local host to "
     822          printf "\n      ${fast_io_catalog}/${sources_for_run_catalog} \n"
     823       fi
     824       rm -rf ${fast_io_catalog}/${sources_for_run_catalog}
     825       mkdir -p ${fast_io_catalog}/${sources_for_run_catalog}
     826       cp ${make_depository}/${program_name}_current_version.tar  ${fast_io_catalog}/${sources_for_run_catalog}
     827       cd $fast_io_catalog/${sources_for_run_catalog}
     828       tar xf ${program_name}_current_version.tar
     829
     830
     831          # COPY CONTENTS OF SOURCES_FOR_RUN_... TO SOURCES_FOR_RUN_...
     832          # IN THE FAST_IO_CATALOG ON THE LOCAL MACHINE
     833       if [[ $silent = false ]]
     834       then
     835          printf "\n  *** copy ${base_directory}/${sources_for_run_catalog} to"
     836          printf "\n      ${fast_io_catalog}/${sources_for_run_catalog} on local host \n"
     837       fi
     838       cp  ${base_directory}/${sources_for_run_catalog}/{*,.[!.]*}  ${fast_io_catalog}/${sources_for_run_catalog}
     839
     840
     841          # CREATE EXECUTABLE FROM THE NEW/MODIFIED SOURCE FILES, IF THERE ARE ANY
     842       if [[ $(ls -1 ${base_directory}/${sources_for_run_catalog}/ | grep -c .$suf) != 0 ]]
     843       then
     844
     845          if [[ $silent = false ]]
     846          then
     847             echo "  *** execute \"make\" on local host"
     848          fi
     849          [[ "$login_init_cmd" != "" ]]   &&  $login_init_cmd
     850          [[ "$module_commands" != "" ]]  &&  $module_commands
     851
     852          make  $make_options  PROG=$program_name  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$linker_options"
    734853
    735854          if [[ $? != 0 ]]
    736855          then
     856
    737857             printf "\a\n  +++ error(s) occurred during compiling or linking for host configuration \"$host_configuration\" "
    738858             if [[ $silent = false ]]
     
    742862                while [[ "$answer" != c  &&  "$answer" != k ]]
    743863                do
    744                    printf "  >>> continue / list errors / kill palmbuild (c/l/k) ? "
     864                   printf "  >>> continue / kill palmbuild (c/k) ? "
    745865                   read  answer
    746                    if [[ "$answer" = l ]]
    747                    then
    748                       more ${host_configuration}_last_make_protocol
    749                    fi
    750866                done
    751867                if [[ $answer = k ]]
    752868                then
     869                   rm -rf ${fast_io_catalog}/${sources_for_run_catalog}
    753870                   locat=user_abort; exit
    754871                fi
    755872             else
    756873                   # ABORT ANYWAY
     874                rm -rf ${fast_io_catalog}/${sources_for_run_catalog}
    757875                locat=user_abort; exit
    758876             fi
    759877          fi
    760878
    761 
    762              # TAR NEW VERSION ON LOCAL HOST
    763           printf "\n  *** tar update on local host ..."
    764           tar -cf  ${program_name}_current_version.tar  ${program_name} *.$suf *.o *.mod *.x
    765 
    766879       else
    767880
    768              # NOW COMES THE BRANCH FOR CREATING THE EXECUTABLE FOR THE CURRENT RUN
    769              # INCLUDING E.G. USER-INTERFACE ROUTINES. ALSO ADD OTHER UTILITY EXECUTABLES. EVERYTHING IS
    770              # COLLECTED IN DIRECTORY SOURCES_FOR_RUN_...
    771 
    772              # FIRST CHECK, IF COMPILED SOURCES FOR THIS RUN IDENTIFIER EXISTS
    773              # AND ASK, IF THEY SHALL BE USED
    774           if [[ -d ${fast_io_catalog}/${sources_for_run_catalog}  &&  $use_existing_sources_folder = true ]]
    775           then
    776              printf "\a\n  *** compiled sources for run \"$fname\" found on local host in folder"
    777              printf "\n      ${fast_io_catalog}/${sources_for_run_catalog}"
    778              printf "\n      will be used!"
    779              exit
    780           fi
    781 
    782              # SECOND CHECK, IF A DEPOSITORY EXISTS ON THE LOCAL MACHINE
    783           if [[ ! -d ${make_depository} ]]
    784           then
    785              printf "\n  +++ directory for local make depository:"
    786              printf "\n           $make_depository"
    787              printf "\n      not found. Please run \"palmbuild -h $host_configuration\" "
    788              locat=make_depository; exit
    789           fi
    790 
    791 
    792              # COPY MAKE DEPOSITORY ON LOCAL MACHINE TO SOURCES_FOR_RUN_...
    793           printf "\n  *** copy MAKE_DEPOSITORY_${host_configuration} on local host to "
    794           printf "\n      ${fast_io_catalog}/${sources_for_run_catalog} \n"
    795           rm -rf ${fast_io_catalog}/${sources_for_run_catalog}
    796           mkdir -p ${fast_io_catalog}/${sources_for_run_catalog}
    797           cp ${make_depository}/${program_name}_current_version.tar  ${fast_io_catalog}/${sources_for_run_catalog}
    798           cd $fast_io_catalog/${sources_for_run_catalog}
    799           tar xf ${program_name}_current_version.tar
    800 
    801 
    802              # COPY CONTENTS OF SOURCES_FOR_RUN_... TO SOURCES_FOR_RUN_...
    803              # IN THE FAST_IO_CATALOG ON THE LOCAL MACHINE
    804           printf "\n  *** copy ${base_directory}/${sources_for_run_catalog} to"
    805           printf "\n      ${fast_io_catalog}/${sources_for_run_catalog} on local host \n"
    806           cp  ${base_directory}/${sources_for_run_catalog}/{*,.[!.]*}  ${fast_io_catalog}/${sources_for_run_catalog}
    807 
    808 
    809              # CREATE EXECUTABLE FROM THE NEW/MODIFIED SOURCE FILES, IF THERE ARE ANY
    810           if [[ $(ls -1 ${base_directory}/${sources_for_run_catalog}/ | grep -c .$suf) != 0 ]]
    811           then
    812 
    813              echo "  *** execute \"make\" on local host"
    814              [[ "$login_init_cmd" != "" ]]   &&  $login_init_cmd
    815              [[ "$module_commands" != "" ]]  &&  $module_commands
    816 
    817              make  $make_options  PROG=$program_name  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$linker_options"
    818 
    819              if [[ $? != 0 ]]
    820              then
    821 
    822                 printf "\a\n  +++ error(s) occurred during compiling or linking for host configuration \"$host_configuration\" "
    823                 if [[ $silent = false ]]
    824                 then
    825                    answer=dummy
    826                    printf "\n"
    827                    while [[ "$answer" != c  &&  "$answer" != k ]]
    828                    do
    829                       printf "  >>> continue / kill palmbuild (c/k) ? "
    830                       read  answer
    831                    done
    832                    if [[ $answer = k ]]
    833                    then
    834                       rm -rf ${fast_io_catalog}/${sources_for_run_catalog}
    835                       locat=user_abort; exit
    836                    fi
    837                 else
    838                       # ABORT ANYWAY
    839                    rm -rf ${fast_io_catalog}/${sources_for_run_catalog}
    840                    locat=user_abort; exit
    841                 fi
    842              fi
    843 
    844           else
    845 
    846              echo "  *** nothing to compile for this run"
    847 
    848           fi
    849 
    850        fi
    851     fi
     881          echo "  *** nothing to compile for this run"
     882
     883       fi
     884
     885    fi
     886 fi
  • palm/trunk/SCRIPTS/palmrun

    r2551 r2566  
    2727# -----------------
    2828# $Id$
     29# execute command for combine_plot_fields added
     30# "TEMPDIR" renamed "tempdir"
     31# temporary working directory for local batch jobs is created immediately within
     32# the user's palmrun call, due to a requirement of the "grid engine" batch
     33# system, where the working directory is given with batch directive -wd and must
     34# already exist when the job is submitted,
     35# informative messages in non-trace mode reduced and partly reformatted
     36#
     37# 2551 2017-10-18 07:25:11Z raasch
    2938# TEMPDIR added as replacement string to be used in batch directives
    3039#
     
    137146 tasks_per_node=0
    138147 threads_per_task=1
    139  tmpcreate=false
    140148 transfer_problems=false
    141149 user_source_path=""
     
    161169             eval  ${err_command[$i]}
    162170          done
    163           [[ $delete_temporary_catalog = true ]]  &&  (cd; rm -rf $TEMPDIR)
     171          [[ $delete_temporary_catalog = true ]]  &&  (cd; rm -rf $tempdir)
    164172          printf "\n\n+++ palmrun killed \n\n"
    165173       elif [[ $locat != control_c ]]
    166174       then
    167           printf "\n\n --> palmrun finished\n\n"
    168           if [[ $running_on_remote = true ]]
    169           then
    170              printf "     Bye, bye $remote_username !!\n\n"
    171           else
    172              printf "     Bye, bye $local_username !!\n\n"
    173           fi
     175          printf "\n --> palmrun finished\n\n"
    174176       fi' exit
    175177
    176178
    177179    # ACTIONS IN CASE OF TERMINAL-BREAK (CONTROL-C):
    178  trap 'cd; rm -rf $TEMPDIR
     180 trap 'cd; rm -rf $tempdir
    179181       printf "\n+++ palmrun killed by \"^C\" \n\n"
    180182       locat=control_c
     
    11891191    job_id=${fname}.$run_id
    11901192
    1191     TEMPDIR=$fast_io_catalog/$job_id
     1193    tempdir=$fast_io_catalog/$job_id
    11921194 fi
    11931195
     
    15231525    if [[ $create_batch_job = true  ||  $create_remote_batch_job = true ]]
    15241526    then
    1525        printf " ***  batch-job will be created and submitted"
     1527       printf "\n ***  batch-job will be created and submitted"
    15261528    else
    1527        printf " ***  PALMRUN will now continue to execute on this machine"
     1529       printf "\n ***  PALMRUN will now continue to execute on this machine"
    15281530    fi
    15291531 fi
     
    15371539    if [[ $create_batch_job = true  ||  $create_remote_batch_job  = true ]]
    15381540    then
    1539        printf "\n\n  *** creating executable and other sources for the remote host"
     1541       printf "\n\n  *** creating executable and other sources for the remote host\n"
    15401542    else
    1541        printf "\n\n  *** creating executable and other sources for the local host"
     1543       printf "\n\n  *** creating executable and other sources for the local host\n"
    15421544    fi
    15431545
     
    15931595       fi
    15941596
    1595        palmbuild  -v  -h $host_configuration
     1597       if [[ $do_trace = true ]]
     1598       then
     1599          palmbuild  -h $host_configuration
     1600       else
     1601          palmbuild  -v  -h $host_configuration
     1602       fi
    15961603
    15971604       if [[ $? != 0 ]]
     
    16081615    fi
    16091616
     1617       # NOW CREATE THE SOURCES_FOR_RUN FOLDER
    16101618    palmbuild  -v  $use_existing_sources_folder  -h $host_configuration  -d $fname
    16111619
     
    16211629    else
    16221630
    1623        printf "\n$dashes\n  *** executable and other sources created\n"
     1631       printf "  *** executable and other sources created\n"
    16241632       rm -rf  $sources_for_run_catalog
    16251633
     
    16391647          # CREATE THE DIRECTORY AND COPY FILES FROM SOURCES_FOR_RUN_... TO THAT
    16401648          # FOLDER
    1641        mkdir -p  $TEMPDIR
    1642        chmod  go+rx  $TEMPDIR
    1643        tmpcreate=true
    1644        cd  $TEMPDIR
    1645        cp  ${fast_io_catalog}/${sources_for_run_catalog}/{*,.[!.]*}  $TEMPDIR
    1646        printf "\n  *** changed to temporary directory: $TEMPDIR"
     1649       mkdir -p  $tempdir
     1650       chmod  go+rx  $tempdir
     1651       cd  $tempdir
     1652       cp  ${fast_io_catalog}/${sources_for_run_catalog}/{*,.[!.]*}  $tempdir
     1653       printf "\n  *** changed to temporary directory: $tempdir"
    16471654
    16481655    else
    16491656
    16501657          # IN BATCH MODE PALMRUN IS CALLED FROM TEMPDIR
    1651        printf "\n  *** running in temporary directory: $TEMPDIR"
     1658       printf "\n  *** running in temporary directory: $tempdir"
    16521659
    16531660    fi
     
    17241731                for file in $(ls *)
    17251732                do
    1726                    ln $file $TEMPDIR/${localin[$i]}
     1733                   ln $file $tempdir/${localin[$i]}
    17271734                done >|/dev/null 2>&1
    1728                 cd $TEMPDIR
     1735                cd $tempdir
    17291736             fi
    17301737
     
    17881795                                    ln -f $file  ${localin[$i]}
    17891796                                 done
    1790                                  cd $TEMPDIR
     1797                                 cd $tempdir
    17911798                              fi
    17921799
     
    18621869       # STARTING THE EXECUTABLE
    18631870    printf "\n\n  *** execution starts in directory\n      \"`pwd`\"\n$dashes\n"
    1864     PATH=$PATH:$TEMPDIR
     1871    PATH=$PATH:$tempdir
    18651872
    18661873
     
    18731880
    18741881       # EXECUTION COMMAND FOR COMBINE_PLOT_FIELDS
    1875     eval line2=\"$line2\"
    1876     execute_command_for_combine="$line2"
     1882    if [[ "$execute_command_for_combine" = "" ]]
     1883    then
     1884       eval line2=\"$line2\"
     1885       execute_command_for_combine="$line2"
     1886    fi
     1887   
    18771888
    18781889
     
    19932004    done
    19942005
    1995 
    1996        # IN TRACE-MODE PRINT CONTENTS OF THE CURRENT (TEMPORARY) WORKING DIRECTORY
    1997     if [[ $do_trace = true ]]
    1998     then
    1999        printf "\n\n"
    2000        ls -al
    2001     fi
    2002    
    20032006
    20042007       # COPY LOCAL OUTPUT-FILES TO THEIR PERMANENT DESTINATIONS
     
    21232126                if [[ "$remote_loginnode" != "" ]]
    21242127                then
    2125                    echo "cd $TEMPDIR; ${fast_io_catalog}/${sources_for_run_catalog}/batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${host_configuration}_${fname}${endout[$i]}  ${extout[$i]}"  |  ssh -q $remote_username@$remote_loginnode
     2128                   echo "cd $tempdir; ${fast_io_catalog}/${sources_for_run_catalog}/batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${host_configuration}_${fname}${endout[$i]}  ${extout[$i]}"  |  ssh -q $remote_username@$remote_loginnode
    21262129                else
    21272130                   batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address  ${localout[$i]} "${pathout[$i]}" ${host_configuration}_${fname}${endout[$i]}  ${extout[$i]}
     
    22412244                                 ln -f $file  ${pathout[$i]}
    22422245                              done >|/dev/null 2>&1
    2243                               cd $TEMPDIR
     2246                              cd $tempdir
    22442247                    fi
    22452248
     
    23422345       # ALL ACTIONS FINISHED, TEMPORARY WORKING-DIRECTORY CAN BE DELETED
    23432346    cd  $HOME
    2344     [[ $delete_temporary_catalog = true ]]  &&  rm -rf $TEMPDIR
     2347    [[ $delete_temporary_catalog = true ]]  &&  rm -rf $tempdir
    23452348
    23462349
     
    24052408    do
    24062409       (( i = i + 1 ))
    2407        line=`echo  "${batch_directive[$i]}" | sed 's/{{JOB_ID}}/$job_id/g' | sed 's/{{JOBFILE}}/$job_protocol_file/g' | sed 's/{{CPU_HOURS}}/$cpu_hours/g' | sed 's/{{CPU_MINUTES}}/$cpu_minutes/g' | sed 's/{{CPU_SECONDS}}/$cpu_seconds/g' | sed 's/{{NODES}}/$nodes/g' | sed 's/{{CORES}}/$cores/g' | sed 's/{{TASKS_PER_NODE}}/$tasks_per_node/g' | sed 's/{{HOST_CONFIGURATION}}/${host_configuration}/g' | sed 's/{{FNAME}}/$fname/g' | sed 's/{{QUEUE}}/$queue/g' | sed 's/{{MEMORY}}/$memory/g' | sed 's/{{PROJECT_ACCOUNT}}/$project_account/g' | sed 's/{{PREVIOUS_JOB}}/$previous_job/g' | sed 's/{{TEMPDIR}}/$TEMPDIR/g'`
     2410       line=`echo  "${batch_directive[$i]}" | sed 's/{{JOB_ID}}/$job_id/g' | sed 's/{{JOBFILE}}/$job_protocol_file/g' | sed 's/{{CPU_HOURS}}/$cpu_hours/g' | sed 's/{{CPU_MINUTES}}/$cpu_minutes/g' | sed 's/{{CPU_SECONDS}}/$cpu_seconds/g' | sed 's/{{NODES}}/$nodes/g' | sed 's/{{CORES}}/$cores/g' | sed 's/{{TASKS_PER_NODE}}/$tasks_per_node/g' | sed 's/{{HOST_CONFIGURATION}}/${host_configuration}/g' | sed 's/{{FNAME}}/$fname/g' | sed 's/{{QUEUE}}/$queue/g' | sed 's/{{MEMORY}}/$memory/g' | sed 's/{{PROJECT_ACCOUNT}}/$project_account/g' | sed 's/{{PREVIOUS_JOB}}/$previous_job/g' | sed 's/{{TEMPDIR}}/$tempdir/g'`
    24082411       eval line=\"$line\"
    24092412       echo  "$line"                               >>  $jobfile
     
    24662469
    24672470       # CREATE TEMPORARY DIRECTORY AND SWITCH TO IT
    2468     echo  "mkdir  $TEMPDIR"              >>  $jobfile
    2469     echo  "cd  $TEMPDIR"                 >>  $jobfile
    2470     echo  "export TEMPDIR=$TEMPDIR"      >>  $jobfile
     2471    if [[ $create_remote_batch_job = true ]]
     2472    then
     2473       echo  "mkdir  $tempdir"           >>  $jobfile
     2474       echo  "chmod  go+rx  $tempdir"    >>  $jobfile
     2475    else
     2476          # DIRECTORY FOR LOCAL BATCH JOBS IS CREATED NOW, DUE TO A
     2477          # REQUIREMENT OF THE GRID ENGINE BATCH SYSTEM (WORKING DIR IS GIVEN IN
     2478          # BATCH DIRECTIVE -wd AND MUST ALREADY EXIST WHEN THE JOB IS SUBMITTED)
     2479       mkdir  $tempdir
     2480       chmod  go+rx  $tempdir
     2481    fi
     2482    echo  "cd  $tempdir"                 >>  $jobfile
     2483    echo  "export tempdir=$tempdir"      >>  $jobfile
    24712484    echo  "cp  ${fast_io_catalog}/${sources_for_run_catalog}/{*,.[!.]*}  ."  >>  $jobfile
    24722485    echo  "export PATH=.:\$PATH"         >>  $jobfile
     
    25332546
    25342547          echo " "
    2535           echo "  *** transfer of job to remote host via scp"
     2548          echo " *** transfer of job to remote host via scp"
    25362549          if [[ $do_trace = true ]]
    25372550          then
    25382551             echo "     scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${host_configuration}_${job_id}"
    25392552          fi
    2540           scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${host_configuration}_${job_id}
    2541 
    2542           echo " "
    2543           echo "  *** submit the job (output of submit command, e.g. the job-id, may follow)"
     2553          scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${host_configuration}_${job_id}  >  /dev/null
     2554
     2555          printf " *** submit the job (output of submit command, e.g. the job-id, may follow)"
    25442556          if [[ $do_trace = true ]]
    25452557          then
Note: See TracChangeset for help on using the changeset viewer.