Ignore:
Timestamp:
Jun 17, 2009, 2:11:25 PM (15 years ago)
Author:
rosiere
Message:

1) Add test and configuration
2) Fix Bug
3) Add log file in load store unit
4) Fix Bug in environment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Script/execute.sh

    r112 r124  
    2828function execute_usage ()
    2929{
    30     echo "Usage     : ${0} work_dir file_cmd file_cpt file_cpu";
     30    echo "Usage     : ${0} path_work file_cmd file_cpt file_cpu id";
    3131    echo "Arguments : ";
    32     echo " * work_dir   : directory to execute command";
     32    echo " * path_work  : directory to execute command";
    3333    echo " * file_cmd   : list of command";
    3434    echo " * file_cpt   : file with the index of next command to execute";
    3535    echo " * file_cpu   : tmp file to stock the current index";
     36    echo " * id         : identification";
    3637    exit;
    3738}
     
    4041function execute_test_usage ()
    4142{
    42     if test ${#} -ne 4; then
     43    if test ${#} -ne 5; then
    4344        execute_usage;
    4445    fi;
     
    5859    local -i CPT_OLD;
    5960    local -i CPT;
    60     local    WORK_DIR=${1};
     61    local    PATH_WORK=${1};
    6162    local    FILE_CMD=${2};
    6263    local    FILE_CPT=${3};
    6364    local    FILE_CPU=${4};
    64     local    LOCK_CPT="${WORK_DIR}/.lock-cpt";
    65     local    LOCK_CPU="${WORK_DIR}/.lock-cpu";
    66     local    FILE_CMD="distexe.command";
    67     local    FILE_OUT="distexe.output";
     65    local    ID=${5};
     66    local    LOCK_CPT="${PATH_WORK}/.lock-cpt";
     67    local    LOCK_CPU="${PATH_WORK}/.lock-cpu";
     68    local    OUTPUT_FILE_INFO="distexe.info";
     69    local    OUTPUT_FILE_CMD="distexe.command";
     70    local    OUTPUT_FILE_OUT="distexe.output";
    6871
     72#   echo "  * {"$(my_date)"} <${ID}> pid is $$";
    6973
    7074    # Init CPT if this thread is the first
    7175    lock   ${LOCK_CPT};
    7276    if test ! -s ${FILE_CPT}; then
     77        echo "  * {"$(my_date)"} <${ID}> create counter file ${FILE_CPT}";
    7378        echo "0" > ${FILE_CPT};
    7479    fi;
     
    8388    done < ${FILE_CMD};
    8489
    85     echo "  * <${HOSTNAME}-$$> {"$(my_date)"} is ready";
     90    echo "  * {"$(my_date)"} <${ID}> is ready";
    8691
    8792    # infinite loop
     
    99104        unlock ${LOCK_CPT};
    100105
    101         # test if this number is valid
     106        # test if this number is valid
    102107        if test ${CPT} -ge ${#COMMAND[*]}; then
    103108            CPT=${#COMMAND[*]};
     
    110115#       while test ${CPT}_SYNC -lt ${CPT}; do
    111116#           if test -z "${COMMAND[${CPT}_SYNC]}"; then
    112 #               echo "  * <${HOSTNAME}-$$> {"$(my_date)"} synchronisation [${CPT}_SYNC]";
     117#               echo "  * {"$(my_date)"} <${ID}> synchronisation [${CPT}_SYNC]";
    113118#           fi;
    114119#           CPT_SYNC=$((${CPT}_SYNC+1));
     
    122127        # Test if command is empty !
    123128        if test ! -z "${COMMAND[${CPT}]}"; then
    124             local CURREN_DIR=${PWD};
    125             cd    ${WORK_DIR}         &> /dev/null;
     129            local PATH_CURRENT=${PWD};
     130            cd    ${PATH_WORK}        &> /dev/null;
    126131            mkdir "Task_${CPT}"       &> /dev/null;
    127132            cd    "Task_${CPT}"       &> /dev/null;
    128             echo "  * <${HOSTNAME}-$$> {"$(my_date)"} execute command [${CPT}] : ${COMMAND[${CPT}]}";
    129             echo "${COMMAND[${CPT}]}"  >  ${FILE_CMD};
    130 #           chmod +x                      ${FILE_CMD};
    131             eval "${COMMAND[${CPT}]}" &>  ${FILE_OUT};
    132             cd    ${CURREN_DIR}       &> /dev/null;
     133#           echo "  * {"$(my_date)"} <${ID}> execute command [${CPT}] : ${COMMAND[${CPT}]}";
     134            echo "  * {"$(my_date)"} <${ID}> execute command [${CPT}]";
     135            echo "id   : ${ID}"        >  ${OUTPUT_FILE_INFO};
     136            echo "host : ${HOSTNAME}" >>  ${OUTPUT_FILE_INFO};
     137            echo "pid  : $$"          >>  ${OUTPUT_FILE_INFO};
     138            echo "date : "$(my_date)  >>  ${OUTPUT_FILE_INFO};
     139            echo "#!/bin/bash"         >  ${OUTPUT_FILE_CMD};
     140            echo 'source ${HOME}/.bashrc;' >>  ${OUTPUT_FILE_CMD};
     141            echo "${COMMAND[${CPT}]}" >>  ${OUTPUT_FILE_CMD};
     142            chmod +x                      ${OUTPUT_FILE_CMD};
     143            ./${OUTPUT_FILE_CMD}      &>  ${OUTPUT_FILE_OUT};
     144            cd    ${PATH_CURRENT}     &> /dev/null;
    133145        fi;
    134146    done;
    135147
    136     echo "  * <${HOSTNAME}-$$> {"$(my_date)"} is done";
     148    echo "  * {"$(my_date)"} <${ID}> is done";
    137149
    138150    lock   ${LOCK_CPU};
     
    143155   
    144156    if test ${CPT} -eq 0; then
    145         echo "  * <${HOSTNAME}-$$> {"$(my_date)"} All task is executed";
     157        echo "  * {"$(my_date)"} <${ID}> All task is executed on this host";
    146158        rm ${FILE_CPU};
    147159    fi;
Note: See TracChangeset for help on using the changeset viewer.