Ignore:
Timestamp:
Mar 18, 2009, 11:36:26 PM (15 years ago)
Author:
rosiere
Message:

1) Stat_list : fix retire old and new register bug
2) Stat_list : remove read_counter and valid flag, because validation of destination is in retire step (not in commit step)
3) Model : add class Model (cf Morpheo.sim)
4) Allocation : alloc_interface_begin and alloc_interface_end to delete temporary array.
5) Script : add distexe.sh
6) Add Comparator, Multiplier, Divider. But this component are not implemented
7) Software : add Dhrystone

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

Legend:

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

    r110 r112  
    2020    "Behavioural/Custom"
    2121
     22    "Behavioural/Generic/Comparator"
    2223    "Behavioural/Generic/Counter"
     24    "Behavioural/Generic/Divider"
     25    "Behavioural/Generic/Multiplier"
    2326    "Behavioural/Generic/Priority"
    2427    "Behavioural/Generic/Queue_Control"                                 
  • trunk/IPs/systemC/processor/Morpheo/Script/execute.sh

    r85 r112  
    55#-----------------------------------------------------------
    66
    7 declare -a COMMAND;
    8 declare -i CPT_OLD;
    9 declare -i CPT;
    10 declare    FILE_CMD=;
    11 declare    FILE_CPT=;
    12 declare    FILE_CPU=;
    13 declare    LOCK_CPT="${HOME}/.lock-cpt";
    14 declare    LOCK_CPU="${HOME}/.lock-cpu";
     7#-----[ global variable ]-----------------------------------
    158
    169#-----[ lock ]----------------------------------------------
    1710function lock ()
    1811{
    19     lockfile -1 $1;
     12    lockfile -1 ${1};
    2013}
    2114
     
    2316function unlock ()
    2417{
    25     rm -f $1;
     18    rm -f ${1};
    2619}
    2720
    28 #-----[ main ]----------------------------------------------
    29 function main ()
     21#-----[ my_date ]-------------------------------------------
     22function my_date ()
    3023{
    31     # no test, because the script execute_n have make all test
    32     FILE_CMD=$1;
    33     FILE_CPT=$2;
    34     FILE_CPU=$3;
     24    date +"%F %T";
     25}
    3526
    36     lock   $LOCK_CPT;
    37     if test ! -s $FILE_CPT; then
    38         echo "0" > $FILE_CPT;
     27#-----[ execute_usage ]-------------------------------------
     28function execute_usage ()
     29{
     30    echo "Usage     : ${0} work_dir file_cmd file_cpt file_cpu";
     31    echo "Arguments : ";
     32    echo " * work_dir   : directory to execute command";
     33    echo " * file_cmd   : list of command";
     34    echo " * file_cpt   : file with the index of next command to execute";
     35    echo " * file_cpu   : tmp file to stock the current index";
     36    exit;
     37}
     38
     39#-----[ execute_test_usage ]--------------------------------
     40function execute_test_usage ()
     41{
     42    if test ${#} -ne 4; then
     43        execute_usage;
    3944    fi;
    40     unlock $LOCK_CPT;
    4145
    42     # lit les fichiers ligne par ligne et le place dans un tableau
     46    if test ! -d ${1}; then
     47        echo "Directory ${1} is invalid";
     48    fi;
     49}
     50
     51#-----[ execute ]-------------------------------------------
     52function execute ()
     53{
     54    # test_usage
     55    execute_test_usage ${*};
     56
     57    local -a COMMAND;
     58    local -i CPT_OLD;
     59    local -i CPT;
     60    local    WORK_DIR=${1};
     61    local    FILE_CMD=${2};
     62    local    FILE_CPT=${3};
     63    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";
     68
     69
     70    # Init CPT if this thread is the first
     71    lock   ${LOCK_CPT};
     72    if test ! -s ${FILE_CPT}; then
     73        echo "0" > ${FILE_CPT};
     74    fi;
     75    unlock ${LOCK_CPT};
     76
     77    # read, line by line, the command file and write in array
    4378    CPT=0;
    4479
    4580    while read line; do
    46         COMMAND[$CPT]="$line";
    47         CPT=$(($CPT+1));
    48     done < $1;
     81        COMMAND[${CPT}]="${line}";
     82        CPT=$((${CPT}+1));
     83    done < ${FILE_CMD};
    4984
    50     echo "  * <$$> {"`date +"%F %T"`"} is ready";
     85    echo "  * <${HOSTNAME}-$$> {"$(my_date)"} is ready";
    5186
    5287    # infinite loop
     
    5691    while test 1; do
    5792        # Take a number
    58         CPT_OLD=$CPT;
     93        CPT_OLD=${CPT};
    5994
    60         lock   $LOCK_CPT;
    61         CPT=`cat $FILE_CPT`;            # read  the      index
    62         echo "$(($CPT+1))" > $FILE_CPT; # write the next index
    63         unlock $LOCK_CPT;
     95        # Read the index, and increase
     96        lock   ${LOCK_CPT};
     97        CPT=$(cat ${FILE_CPT});
     98        echo "$((${CPT}+1))" > ${FILE_CPT};
     99        unlock ${LOCK_CPT};
    64100
    65101        # test if this number is valid
    66         if test $CPT -ge ${#COMMAND[*]}; then
     102        if test ${CPT} -ge ${#COMMAND[*]}; then
    67103            CPT=${#COMMAND[*]};
    68104        fi;
     
    70106        # test if between the cpt_old and cpt, there are a synchronisation command
    71107
    72 #       local -i CPT_SYNC=$CPT_OLD;
     108#       local -i CPT_SYNC=${CPT}_OLD;
    73109#
    74 #       while test $CPT_SYNC -lt $CPT; do
    75 #           if test -z "${COMMAND[$CPT_SYNC]}"; then
    76 #               echo "  * <$$> {"`date +"%F %T"`"} synchronisation [$CPT_SYNC]";
     110#       while test ${CPT}_SYNC -lt ${CPT}; do
     111#           if test -z "${COMMAND[${CPT}_SYNC]}"; then
     112#               echo "  * <${HOSTNAME}-$$> {"$(my_date)"} synchronisation [${CPT}_SYNC]";
    77113#           fi;
    78 #           CPT_SYNC=$(($CPT_SYNC+1));
     114#           CPT_SYNC=$((${CPT}_SYNC+1));
    79115#       done;
    80116
    81117        # test if this number is valid
    82         if test $CPT -eq ${#COMMAND[*]}; then
     118        if test ${CPT} -eq ${#COMMAND[*]}; then
    83119            break;
    84120        fi;
    85121
    86122        # Test if command is empty !
    87         if test ! -z "${COMMAND[$CPT]}"; then
    88             local CUR_DIR=$PWD;
    89 
    90             mkdir "Task_$CPT"       &> /dev/null;
    91             cd    "Task_$CPT"       &> /dev/null;
    92             echo "  * <$$> {"`date +"%F %T"`"} execute command [$CPT] : ${COMMAND[$CPT]}";
    93             echo "${COMMAND[$CPT]}"  >  "command";
    94             chmod +x                    "command";
    95             eval "${COMMAND[$CPT]}" &>  "output";
    96             cd    $CUR_DIR          &> /dev/null;
     123        if test ! -z "${COMMAND[${CPT}]}"; then
     124            local CURREN_DIR=${PWD};
     125            cd    ${WORK_DIR}         &> /dev/null;
     126            mkdir "Task_${CPT}"       &> /dev/null;
     127            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;
    97133        fi;
    98134    done;
    99135
    100     echo "  * <$$> {"`date +"%F %T"`"} is done";
     136    echo "  * <${HOSTNAME}-$$> {"$(my_date)"} is done";
    101137
    102     lock   $LOCK_CPU;
    103     CPT=`cat $FILE_CPU`;     # read  the      index
    104     CPT=$(($CPT-1));
    105     echo "$CPT" > $FILE_CPU; # write the next index
    106     unlock $LOCK_CPU;
     138    lock   ${LOCK_CPU};
     139    CPT=$(cat ${FILE_CPU});    # read  the      index
     140    CPT=$((${CPT}-1));
     141    echo "${CPT}" > ${FILE_CPU}; # write the next index
     142    unlock ${LOCK_CPU};
    107143   
    108     if test $CPT -eq 0; then
    109         echo "  * <$$> {"`date +"%F %T"`"} All task is executed";
    110         rm $FILE_CPU;
     144    if test ${CPT} -eq 0; then
     145        echo "  * <${HOSTNAME}-$$> {"$(my_date)"} All task is executed";
     146        rm ${FILE_CPU};
    111147    fi;
    112148}
    113149
    114150#-----[ Corps ]---------------------------------------------
    115 main $*;
     151execute ${*};
  • trunk/IPs/systemC/processor/Morpheo/Script/execute_n.sh

    r85 r112  
    55#-----------------------------------------------------------
    66
    7 #-----[ variable ]------------------------------------------
    8 declare -a COMMAND;
    9 declare -i NB_PROCESS;
    10 declare -i CPT;
    11 declare    FILE_CMD;
    12 declare    FILE_CPT;
    13 declare    FILE_CPU;
    14 declare    ID="cpu-${HOSTNAME}-$$"
     7#-----[ global variable ]-----------------------------------
    158
    16 #-----[ usage ]---------------------------------------------
    17 function usage ()
     9#-----[ nb_cpu ]--------------------------------------------
     10function nb_cpu ()
    1811{
    19     echo "Usage     : $0 file [ nb_process ]";
     12    local FILE_CPUINFO=/proc/cpuinfo;
     13    if test ! -f ${FILE_CPUINFO}; then
     14        echo "\"${FILE_CPUINFO}\" don't exist."
     15        usage;
     16    fi;
     17
     18    #eval "${1}=`grep -c \"processor\" ${FILE_CPUINFO}`";
     19    grep -c "processor" ${FILE_CPUINFO};
     20}
     21
     22#-----[ execute_n_usage ]-----------------------------------
     23function execute_n_usage ()
     24{
     25    echo "Usage     : ${0} word_dir file [ nb_process ]";
    2026    echo "Arguments : ";
     27    echo " * work_dir   : directory to execute command";
    2128    echo " * file       : list of command";
    2229    echo " * nb_process : number of process (default (and maximum) is the number of processor)";
     
    2532    echo " * This script, for each command, create a directory : Task_X (X is the number of command), and execute the command in this directory.";
    2633    echo " * Two file is generate : \"output\" is the output of the execution, and \"command\" is the command lunch.";
    27     echo " * A command empty (no command on a line of file) is a synchronisation with all process"
    28     echo " * Don't forgot the final end of line (else the last command is not executed";
     34#   echo " * A command empty (no command on a line of file) is a synchronisation with all process"
     35    echo " * Don't forgot the final end of line (else the last command is not executed)";
    2936    echo "";
    3037    exit;
    3138}
    3239
    33 #-----[ nb_cpu ]--------------------------------------------
    34 function nb_cpu ()
     40#-----[ execute_n_test_usage ]------------------------------
     41function execute_n_test_usage ()
    3542{
    36     local FILE_CPUINFO=/proc/cpuinfo;
    37     if test ! -f $FILE_CPUINFO; then
    38         echo "\"${FILE_CPUINFO}\" don't exist."
    39         usage;
     43    if test ${#} -ne 2 -a ${#} -ne 3; then
     44        execute_n_usage;
    4045    fi;
    4146
    42     eval "$1=`grep -c \"processor\" ${FILE_CPUINFO}`";
    43 }
    44 
    45 #-----[ test_usage ]----------------------------------------
    46 function test_usage ()
    47 {
    48     if test $# -ne 1 -a $# -ne 2; then
    49         usage;
     47    if test ! -d ${1}; then
     48        echo "Directory ${1} is invalid";
    5049    fi;
    5150
    52     if test ! -f $1; then
    53         echo "File \"$1\" don't exist";
    54         usage;
     51    if test -z "${MORPHEO_SCRIPT}"; then
     52        echo "Environment variable MORPHEO_SCRIPT is not set";
     53        distexe_usage;
    5554    fi;
    5655
    57     if test ! -s $1; then
    58         echo "File \"$1\" is empty";
    59         usage;
     56    if test ! -f ${2}; then
     57        echo "File \"${2}\" don't exist";
     58        execute_n_usage;
     59    fi;
     60
     61    if test ! -s ${2}; then
     62        echo "File \"${2}\" is empty";
     63        execute_n_usage;
    6064    fi;
    6165}
    6266
    63 #-----[ main ]----------------------------------------------
    64 function main ()
     67#-----[ execute_n_main ]------------------------------------
     68function execute_n ()
    6569{
    66     nb_cpu NB_PROCESS;
     70    local -i NB_PROCESS=$(nb_cpu);
     71    local -i CPT;
     72    local    WORK_DIR=${1};
     73    local    FILE_CMD=${2};
     74    local    FILE_CPT;
     75    local    FILE_CPU;
     76    local    ID="cpu-${HOSTNAME}-$$"
    6777
    68     test_usage $*;
     78    execute_n_test_usage ${*};
    6979
    70     if test $# -eq 2; then
    71         if test $2 -lt $NB_PROCESS; then
    72             NB_PROCESS=$2;
     80    if test ${#} -eq 2; then
     81        if test ${3} -lt ${NB_PROCESS}; then
     82            NB_PROCESS=${3};
    7383        fi;
    7484    fi;
    7585
    76     FILE_CMD=$1;
    77     FILE_CPT="$HOME/control-"`basename $1`;
    78     FILE_CPU="$HOME/$ID";
     86    FILE_CPT="${WORK_DIR}/control-"$(basename ${FILE_CMD});
     87    FILE_CPU="${WORK_DIR}/${ID}";
    7988
    80     echo "<$0>"                                         ;
    81     echo "  * Initialisation ...."                      ;
    82     echo "    - host name                : $HOSTNAME"   ;
    83     echo "    - number of process        : $NB_PROCESS" ;
     89    echo "  * <${HOSTNAME}> ${NB_PROCESS} process";
    8490
    8591    local -i IT_NB_PROCESS=1;
    8692    local -i PID=$$;
    8793
    88     echo "$NB_PROCESS" > $FILE_CPU;
     94    echo "${NB_PROCESS}" > ${FILE_CPU};
    8995
    9096    # create the same number of thread that processor
    91     while test $IT_NB_PROCESS -le $NB_PROCESS; do
    92         execute.sh $FILE_CMD $FILE_CPT $FILE_CPU &
    93         IT_NB_PROCESS=$(($IT_NB_PROCESS+1));
     97    while test ${IT_NB_PROCESS} -le ${NB_PROCESS}; do
     98        ${MORPHEO_SCRIPT}/execute.sh ${WORK_DIR} ${FILE_CMD} ${FILE_CPT} ${FILE_CPU} &
     99        IT_NB_PROCESS=$((${IT_NB_PROCESS}+1));
    94100
    95         if test "$$" -ne $PID; then
     101        if test "$$" -ne ${PID}; then
    96102            break;
    97103        fi;
     
    100106
    101107#-----[ Corps ]---------------------------------------------
    102 main $*;
     108execute_n ${*};
Note: See TracChangeset for help on using the changeset viewer.