Ignore:
Timestamp:
Jun 17, 2009, 2:11:25 PM (16 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

Location:
trunk/IPs/systemC/processor/Morpheo/Script
Files:
3 edited

Legend:

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

    r112 r124  
    44# $Id$
    55#-----------------------------------------------------------
     6
     7VERSION="1.0"
    68
    79# Need : test, echo, cd, dirname, basename, ssh
     
    3941}
    4042
     43#-----[ my_date ]-------------------------------------------
     44function my_date ()
     45{
     46    date +"%F %T";
     47}
     48
    4149#-----[ distexe_test_usage ]--------------------------------
    4250function distexe_test_usage ()
     
    6775        fi;
    6876    fi;
     77}
    6978
     79#-----[ header ]--------------------------------------------
     80function header ()
     81{
     82    echo "distexe ${VERSION}";
    7083}
    7184
     
    8093    cd -;
    8194
    82     # Absoulte path of work directory
    83     local    DIR_EXE;
     95    # Absolute path of work directory
     96    local    PATH_EXE;
    8497    if test ${#} -eq 2; then
    85         cd ${2};
    86         DIR_EXE=${PWD};
    87         cd -;
     98        cd ${2} &> /dev/null;
     99        PATH_EXE=${PWD};
     100        cd -  &> /dev/null;
    88101    else
    89         DIR_EXE=${PWD};
     102        PATH_EXE=${PWD};
    90103    fi;
     104
     105    header;
     106    echo "  * {"$(my_date)"} <${HOSTNAME}> file : ${FILE_CMD}";
     107    echo "  * {"$(my_date)"} <${HOSTNAME}> path : ${PATH_EXE}";
    91108
    92109    local hosts="${DISTEXE_HOSTS}";
     
    96113        local -i nb_process=$(echo ${line} | cut -d/ -f2);
    97114
    98         echo " * station : ${host} (${nb_process}) ... ";
     115        echo "  * {"$(my_date)"} <${HOSTNAME}> station : ${host} (${nb_process}) ... ";
    99116
    100117        # lunch service
    101         local cmd="export MORPHEO_SCRIPT=${MORPHEO_SCRIPT};${MORPHEO_SCRIPT}/execute_n.sh ${DIR_EXE} ${FILE_CMD} ${nb_process};";
     118        local cmd="export MORPHEO_SCRIPT=${MORPHEO_SCRIPT};${MORPHEO_SCRIPT}/execute_n.sh ${PATH_EXE} ${FILE_CMD} ${nb_process};";
    102119        ssh ${host} ${cmd} &
    103120    done;
     121
     122    echo "  * {"$(my_date)"} <${HOSTNAME}> all hosts working";
     123
    104124}
    105125
  • 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;
  • trunk/IPs/systemC/processor/Morpheo/Script/execute_n.sh

    r112 r124  
    55#-----------------------------------------------------------
    66
    7 #-----[ global variable ]-----------------------------------
     7#-----[ my_date ]-------------------------------------------
     8function my_date ()
     9{
     10    date +"%F %T";
     11}
    812
    913#-----[ nb_cpu ]--------------------------------------------
     
    2327function execute_n_usage ()
    2428{
    25     echo "Usage     : ${0} word_dir file [ nb_process ]";
     29    echo "Usage     : ${0} path_word file [ nb_process ]";
    2630    echo "Arguments : ";
    27     echo " * work_dir   : directory to execute command";
     31    echo " * path_work  : directory to execute command";
    2832    echo " * file       : list of command";
    2933    echo " * nb_process : number of process (default (and maximum) is the number of processor)";
     
    5155    if test -z "${MORPHEO_SCRIPT}"; then
    5256        echo "Environment variable MORPHEO_SCRIPT is not set";
    53         distexe_usage;
     57        execute_n_usage;
    5458    fi;
    5559
     
    7074    local -i NB_PROCESS=$(nb_cpu);
    7175    local -i CPT;
    72     local    WORK_DIR=${1};
     76    local    PATH_WORK=${1};
    7377    local    FILE_CMD=${2};
    7478    local    FILE_CPT;
     
    7882    execute_n_test_usage ${*};
    7983
    80     if test ${#} -eq 2; then
     84    if test ${#} -eq 3; then
    8185        if test ${3} -lt ${NB_PROCESS}; then
    8286            NB_PROCESS=${3};
    83         fi;
     87        fi;   
    8488    fi;
    8589
    86     FILE_CPT="${WORK_DIR}/control-"$(basename ${FILE_CMD});
    87     FILE_CPU="${WORK_DIR}/${ID}";
     90    FILE_CPT="${PATH_WORK}/control-"$(basename ${FILE_CMD});
     91    FILE_CPU="${PATH_WORK}/${ID}";
    8892
    89     echo "  * <${HOSTNAME}> ${NB_PROCESS} process";
     93    echo "  * {"$(my_date)"} <${HOSTNAME}> ${NB_PROCESS} process";
    9094
    9195    local -i IT_NB_PROCESS=1;
     
    96100    # create the same number of thread that processor
    97101    while test ${IT_NB_PROCESS} -le ${NB_PROCESS}; do
    98         ${MORPHEO_SCRIPT}/execute.sh ${WORK_DIR} ${FILE_CMD} ${FILE_CPT} ${FILE_CPU} &
     102        ${MORPHEO_SCRIPT}/execute.sh ${PATH_WORK} ${FILE_CMD} ${FILE_CPT} ${FILE_CPU} "${HOSTNAME}-${IT_NB_PROCESS}" &
    99103        IT_NB_PROCESS=$((${IT_NB_PROCESS}+1));
    100104
     
    103107        fi;
    104108    done
     109
     110    echo "  * {"$(my_date)"} <${HOSTNAME}> all process working";
    105111}
    106112
Note: See TracChangeset for help on using the changeset viewer.