Ignore:
Timestamp:
Sep 7, 2017 6:20:11 AM (7 years ago)
Author:
raasch
Message:

PALM_BIN setting removed from new scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palmrun

    r2410 r2420  
    5959 compiler_name_ser=""
    6060 compiler_options=""
    61  config_file=""
    6261 cores=""
    6362 cores_atmos=0
     
    8079 fname=test
    8180 global_revision=""
    82  host="default"
     81 host_identifier="default"
    8382 hostfile=""
    8483 hp=""
     
    157156
    158157
    159     # CHECK IF THE PATH FOR THE PALM BINARIES (SCRIPTS+UTILITY-PROGRAMS) HAS
    160     # BEEN SET
    161  if [[ "$PALM_BIN" = "" ]]
    162  then
    163     printf "\n  +++ environment variable PALM_BIN has not been set"
    164     printf "\n      please set it to the directory where the PALM scripts are located"
    165     locat=palm_bin; exit
    166  fi
    167  export PATH=$PALM_BIN:$PATH
    168 
    169 
    170 
    171158    # READ SHELLSCRIPT-OPTIONS AND REBUILD THE PALMRUN-COMMAND STRING (prc),
    172159    # WHICH WILL BE USED TO START RESTART-JOBS
    173  while  getopts  :a:bBc:Cd:FG:h:jkm:M:O:q:r:R:s:t:T:u:U:vw:xX:yY:Z option
     160 while  getopts  :a:bBCd:FG:h:jkm:M:O:q:r:R:s:t:T:u:U:vw:xX:yY:Z option
    174161 do
    175162   case  $option  in
     
    177164       (b)   create_batch_job=true; prc="$prc -b";;
    178165       (B)   delete_temporary_catalog=false; prc="$prc -B";;
    179        (c)   config_file=$OPTARG; prc="$prc -c$OPTARG";;
    180166       (C)   restart_run=true; prc="$prc -C";;
    181167       (d)   fname=$OPTARG; prc="$prc -d$OPTARG";;
    182168       (F)   create_jobfile_only=true;;
    183169       (G)   global_revision=$OPTARG; prc="$prc -G'$OPTARG'";;
    184        (h)   host=$OPTARG; prc="$prc -h$OPTARG";;
     170       (h)   host_identifier=$OPTARG; prc="$prc -h$OPTARG";;
    185171       (j)   running_in_batch_mode=true;;
    186172       (k)   keep_data_from_previous_run=true; prc="$prc -k";;
     
    223209    printf "\n        -b    batch-job on local machine               ---"
    224210    printf "\n        -B    do not delete temporary directory at end ---"
    225     printf "\n        -c    configuration file                       .palm.config.default"
    226211    printf "\n        -d    base name of files attached to program   test"
    227212    printf "\n        -F    create batch job file only               ---"
    228     printf "\n        -h    execution host                           \"default\" "
     213    printf "\n        -h    host identifier                          \"default\" "
    229214    printf "\n        -k    keep data from previous run"
    230215    printf "\n        -m    memory demand in MB (batch-jobs)         0 MB"
     
    268253
    269254    # BUILD THE CONFIGURATION-FILE NAME
    270  if [[ "$config_file" = "" ]]
    271  then
    272     config_file=.palm.config.$host
    273  fi
     255 config_file=.palm.config.$host_identifier
    274256
    275257
     
    462444       # BATCH MODE AND ...
    463445    running_on_remote=true
    464     host_name=$remote_hostname
    465446 
    466447 else
     
    474455
    475456     fi
    476      host_name=$local_hostname
    477457     running_on_remote=false
    478458 fi
     
    12131193       fi
    12141194    done
     1195    cpumax=$cputime
    12151196
    12161197       # CHECK THE MEMORY DEMAND
     
    12341215       while [[ -z $remote_username ]]
    12351216       do
    1236           printf "\n  +++ username on remote host \"$remote_ip\" is undefined"
     1217          printf "\n  +++ username on remote host with IP \"$remote_ip\" is undefined"
    12371218          printf "\n  >>> Please type username:"
    12381219          printf "\n  >>> "
     
    12431224 else
    12441225
    1245     cputime=10000000  # NO LIMT FOR INTERACTIVE RUNS
    1246 
    1247  fi
    1248  cpumax=$cputime
     1226    if [[ $running_in_batch_mode = false ]]
     1227    then
     1228       cputime=10000000  # NO LIMT FOR INTERACTIVE RUNS
     1229       cpumax=$cputime
     1230    else
     1231       cputime=$cpumax
     1232    fi
     1233
     1234 fi
    12491235
    12501236
     
    12671253 if [[ $create_remote_batch_job = true ]]
    12681254 then
    1269     column1="execution on:"; column2="$remote_hostname (username: $remote_username)"
     1255    column1="execution on:"; column2="$host_identifier (username: $remote_username)"
    12701256 else
    12711257    if [[ $running_on_remote = true ]]
    12721258    then
    1273        column1="execution on:"; column2="$remote_hostname"
     1259       column1="execution on:"; column2="$host_identifier (IP:$remote_ip)"
    12741260    else
    1275        column1="execution on:"; column2="$local_hostname"
     1261       column1="execution on:"; column2="$host_identifier (IP:$local_ip)"
    12761262    fi
    12771263 fi
     
    15251511    fi
    15261512
    1527     palmbuild  -v  -h $host  -d $fname
    1528     rm -rf  SOURCES_FOR_RUN_$fname
     1513    palmbuild  -v  -h $host_identifier  -d $fname
    15291514
    15301515    if [[ $? != 0 ]]
     
    15341519       printf "\n  +++ error while creating executable and/or other sources"
    15351520       locat=execution
     1521       rm -rf  SOURCES_FOR_RUN_$fname
    15361522       exit
    15371523
     
    15391525
    15401526       printf "\n$dashes\n  *** executable and other sources created\n"
     1527       rm -rf  SOURCES_FOR_RUN_$fname
    15411528
    15421529    fi
     
    17661753       # (FILE ENVPAR WILL BE READ BY PALM)
    17671754    cat  >  ENVPAR  <<  EOF
    1768  &envpar  run_identifier = '$fname', host = '$host',
     1755 &envpar  run_identifier = '$fname', host = '$host_identifier',
    17691756          write_binary = .${write_binary}., tasks_per_node = $tasks_per_node,
    17701757          maximum_parallel_io_streams = $maximum_parallel_io_streams,
     
    20342021                transfer_failed=false
    20352022                printf "\n  >>> OUTPUT: ${localout[$i]}$catalog_string  $append_string by SCP to"
    2036                 printf "\n              ${pathout[$i]}/${remote_hostname}_${fname}${endout[$i]}$catalog_string\n"
     2023                printf "\n              ${pathout[$i]}/${host_identifier}_${fname}${endout[$i]}$catalog_string\n"
    20372024
    20382025                   # TRANSFER VIA SCP
    20392026                if [[ "$remote_loginnode" != "" ]]
    20402027                then
    2041                    echo "cd $TEMPDIR; ${fast_io_catalog}/SOURCES_FOR_RUN_${fname}/batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${remote_hostname}_${fname}${endout[$i]}  ${extout[$i]}"  |  ssh -q $remote_username@$remote_loginnode
     2028                   echo "cd $TEMPDIR; ${fast_io_catalog}/SOURCES_FOR_RUN_${fname}/batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${host_identifier}_${fname}${endout[$i]}  ${extout[$i]}"  |  ssh -q $remote_username@$remote_loginnode
    20422029                else
    2043                    batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address  ${localout[$i]} "${pathout[$i]}" ${remote_hostname}_${fname}${endout[$i]}  ${extout[$i]}
     2030                   batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address  ${localout[$i]} "${pathout[$i]}" ${host_identifier}_${fname}${endout[$i]}  ${extout[$i]}
    20442031                fi
    20452032                [[ $? != 0 ]]  &&  transfer_failed=true
     
    20502037                then
    20512038                   printf "  +++ transfer failed. Trying to save a copy on this host under:\n"
    2052                    printf "      ${pathout[$i]}/${remote_hostname}_${fname}${endout[$i]}_$run_id\n"
     2039                   printf "      ${pathout[$i]}/${host_identifier}_${fname}${endout[$i]}_$run_id\n"
    20532040
    20542041                      # FIRST CHECK, IF DIRECTORY EXISTS, AND CREATE IT, IF NECESSARY
     
    20602047                      mkdir -p  $local_catalog
    20612048                   fi
    2062                    eval  cp  ${localout[$i]}  ${pathout[$i]}/${remote_hostname}_${fname}${endout[$i]}_$run_id
     2049                   eval  cp  ${localout[$i]}  ${pathout[$i]}/${host_identifier}_${fname}${endout[$i]}_$run_id
    20632050                   transfer_problems=true
    20642051                fi
     
    22212208          if [[ "$remote_loginnode" != "" ]]
    22222209          then
    2223              echo "echo \" PATH=\\\$PATH:$LOCAL_PALMRUN_PATH; export PALM_BIN=$LOCAL_PALMRUN_PATH; cd $LOCAL_PWD; $prc\" |  ssh -q $SSH_PORTOPT  $local_username@$return_address  " |  ssh -q $remote_username@$remote_loginnode
     2210             echo "echo \" PATH=\\\$PATH:$LOCAL_PALMRUN_PATH; cd $LOCAL_PWD; $prc\" |  ssh -q $SSH_PORTOPT  $local_username@$return_address  " |  ssh -q $remote_username@$remote_loginnode
    22242211          else
    2225              echo \" PATH=\\\$PATH:$LOCAL_PALMRUN_PATH; export PALM_BIN=$LOCAL_PALMRUN_PATH; cd $LOCAL_PWD; $prc\" |  ssh -q $SSH_PORTOPT  $local_username@$return_address
     2212             echo \" PATH=\\\$PATH:$LOCAL_PALMRUN_PATH; cd $LOCAL_PWD; $prc\" |  ssh -q $SSH_PORTOPT  $local_username@$return_address
    22262213          fi
    22272214
     
    22682255
    22692256       # BUILD THE PALMRUN-COMMAND TO BE CALLED IN THE BATCH-JOB
    2270     palmrun_com="$palmrun_script_name -c $config_file -d $fname -h $host -m $memory -t $cpumax -q $queue -r $run_id -U $local_username"
     2257    palmrun_com="$palmrun_script_name -d $fname -h $host_identifier -m $memory -t $cpumax -q $queue -r $run_id -U $local_username"
    22712258    [[ "$activation_string_list" != "" ]]  &&  palmrun_com=${palmrun_com}" -a \"$activation_string_list\""
    22722259    [[ "$global_revision" != "" ]]  &&  palmrun_com=${palmrun_com}" -G \"$global_revision\""
     
    22842271    then
    22852272       palmrun_com=${palmrun_com}" -j -u $remote_username -R $local_ip"
    2286        printf "\n *** PALMRUN-command on remote host:\n     $palmrun_com \n"
     2273       if [[ $do_trace = true ]]
     2274       then
     2275          printf "\n *** PALMRUN-command on remote host:\n     $palmrun_com \n"
     2276       fi
    22872277    elif [[ $create_batch_job = true ]]
    22882278    then
    22892279       palmrun_com=${palmrun_com}" -j"
    2290        printf "\n *** PALMRUN-command on local host:\n     $palmrun_com \n"
     2280       if [[ $do_trace = true ]]
     2281       then
     2282          printf "\n *** PALMRUN-command on local host:\n     $palmrun_com \n"
     2283       fi
    22912284    fi
    22922285
     
    22942287       # DETERMINE THE FULL PATHS FOR THE JOB PROTOCOL FILES ON THE LOCAL AND
    22952288       # REMOTE HOST
    2296     job_protocol_file_local=${local_jobcatalog}/${host}_${job_id}
     2289    job_protocol_file_local=${local_jobcatalog}/${host_identifier}_${job_id}
    22972290    job_protocol_file=$job_protocol_file_local
    22982291    if [[ $create_remote_batch_job = true ]]
    22992292    then
    2300        job_protocol_file_remote=${remote_jobcatalog}/${host}_${job_id}
     2293       job_protocol_file_remote=${remote_jobcatalog}/${host_identifier}_${job_id}
    23012294       job_protocol_file=$job_protocol_file_remote
    23022295       job_transfer_protocol_file=${remote_jobcatalog}/last_job_transfer_protocol
     
    23142307    do
    23152308       (( i = i + 1 ))
    2316        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/{{LOCAL_HOSTNAME}}/${local_hostname}/g' | sed 's/{{HOST}}/${host}/g' | sed 's/{{FNAME}}/$fname/g' | sed 's/{{QUEUE}}/$queue/g' | sed 's/{{MEMORY}}/$memory/g'`
     2309       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_IDENTIFIER}}/${host_identifier}/g' | sed 's/{{FNAME}}/$fname/g' | sed 's/{{QUEUE}}/$queue/g' | sed 's/{{MEMORY}}/$memory/g'`
    23172310       eval line=\"$line\"
    23182311       echo  "$line"                               >>  $jobfile
     
    23362329       do
    23372330          (( i = i + 1 ))
    2338           line=`echo  "${batch_directive_transfer[$i]}" | sed 's/{{JOB_ID}}/$job_id/g' | sed 's/{{JOBFILE}}/$job_protocol_file/g' | sed 's/{{JOB_TRANSFER_PROTOCOL_FILE}}/$job_transfer_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/{{TASKS_PER_NODE}}/$tasks_per_node/g' | sed 's/{{LOCAL_HOSTNAME}}/${local_hostname}/g' | sed 's/{{HOST}}/${host}/g' | sed 's/{{FNAME}}/$fname/g'`
     2331          line=`echo  "${batch_directive_transfer[$i]}" | sed 's/{{JOB_ID}}/$job_id/g' | sed 's/{{JOBFILE}}/$job_protocol_file/g' | sed 's/{{JOB_TRANSFER_PROTOCOL_FILE}}/$job_transfer_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/{{TASKS_PER_NODE}}/$tasks_per_node/g' | sed 's/{{HOST_IDENTIFIER}}/${host_identifier}/g' | sed 's/{{FNAME}}/$fname/g'`
    23392332          eval line=\"$line\"
    23402333          echo  "$line"                            >>  $jobfile
     
    23432336
    23442337       echo "set -x"                               >>  $jobfile
    2345        echo "${fast_io_catalog}/SOURCES_FOR_RUN_${fname}/batch_scp  $PORTOPT  -d  -w 10  -u $local_username $local_ip  $job_protocol_file_remote  \"$local_jobcatalog\"  ${host}_${fname}"  >>  $jobfile
     2338       echo "${fast_io_catalog}/SOURCES_FOR_RUN_${fname}/batch_scp  $PORTOPT  -d  -w 10  -u $local_username $local_ip  $job_protocol_file_remote  \"$local_jobcatalog\"  ${host_identifier}_${fname}"  >>  $jobfile
    23462339       echo "%%END%%"                              >>  $jobfile
    23472340       echo "echo \" *** submitting job for transfering the job protocol file to $local_ip\" "  >>  $jobfile
     
    24082401          echo  "   echo \" \" "                      >>  $jobfile
    24092402          echo  "   echo \"+++ file ${remotepathin[$i]} could not be created\" "   >>  $jobfile
    2410           echo  "   echo \"    please check, if directory exists on $host!\" "  >>  $jobfile
     2403          echo  "   echo \"    please check, if directory exists on $host_identifier!\" "  >>  $jobfile
    24112404          echo  "   echo \"+++ PALMRUN will not be continued\" "  >>  $jobfile
    24122405          echo  "   execute_palmrun=false"            >>  $jobfile
     
    24242417
    24252418       # PROVIDE THE PATH OF THE LOCAL PALMRUN-SCRIPT FOR THE SAME REASON
    2426     echo  "LOCAL_PALMRUN_PATH=$PALM_BIN"                   >>  $jobfile
     2419    echo  "LOCAL_PALMRUN_PATH=${source_path}/../SCRIPTS"   >>  $jobfile
    24272420    echo  "export LOCAL_PALMRUN_PATH"                      >>  $jobfile
    24282421
     
    24412434       then
    24422435
    2443           echo " *** transfer of job to remote host via scp"
    2444           echo "     scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${host}_${job_id}"
    2445           scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${host}_${job_id}
    2446 
     2436          echo " "
     2437          echo "  *** transfer of job to remote host via scp"
     2438          if [[ $do_trace = true ]]
     2439          then
     2440             echo "     scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${host_identifier}_${job_id}"
     2441          fi
     2442          scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${host_identifier}_${job_id}
     2443
     2444          echo " "
     2445          echo "  *** submit the job (output of submit command, e.g. the job-id, may follow)"
     2446          if [[ $do_trace = true ]]
     2447          then
     2448             echo "     cd $remote_jobcatalog; $submit_command ${host_identifier}_${job_id}; rm ${host_identifier}_${job_id}  |  ssh  -q  $ssh_key $SSH_PORTOPT  ${remote_username}@${remote_ip}  2>&1"
     2449          fi
     2450          echo "cd $remote_jobcatalog; $submit_command ${host_identifier}_${job_id}; rm ${host_identifier}_${job_id}"  |  ssh  -q  $ssh_key $SSH_PORTOPT  ${remote_username}@${remote_ip}  2>&1
     2451
     2452       elif [[ $create_batch_job = true ]]
     2453       then
     2454
     2455          eval  local_jobcatalog=$local_jobcatalog
     2456          cp  $jobfile  ${local_jobcatalog}/${host_identifier}_${job_id}
     2457          cd $local_jobcatalog
    24472458          echo " "
    24482459          echo " *** submit the job"
    2449           echo "     cd $remote_jobcatalog; $submit_command ${host}_${job_id}; rm ${host}_${job_id}  |  ssh  -q  $ssh_key $SSH_PORTOPT  ${remote_username}@${remote_ip}  2>&1"
    2450           echo "cd $remote_jobcatalog; $submit_command ${host}_${job_id}; rm ${host}_${job_id}"  |  ssh  -q  $ssh_key $SSH_PORTOPT  ${remote_username}@${remote_ip}  2>&1
    2451 
    2452        elif [[ $create_batch_job = true ]]
    2453        then
    2454 
    2455           eval  local_jobcatalog=$local_jobcatalog
    2456           cp  $jobfile  ${local_jobcatalog}/${host}_${job_id}
    2457           cd $local_jobcatalog
    2458           echo " "
    2459           echo "--- submit the job"
    2460           echo "$submit_command ${host}_${job_id}"
    2461           $submit_command ${host}_${job_id}
    2462           rm ${host}_${job_id}
     2460          if [[ $do_trace = true ]]
     2461          then
     2462             echo "$submit_command ${host_identifier}_${job_id}"
     2463          fi
     2464          $submit_command ${host_identifier}_${job_id}
     2465          rm ${host_identifier}_${job_id}
    24632466          cd -  > /dev/null
    24642467
Note: See TracChangeset for help on using the changeset viewer.