| 1 | #!/bin/bash | 
|---|
| 2 |  | 
|---|
| 3 | #               archi1  archi2  archi3       archi4  archi5  | 
|---|
| 4 | archi_name=(    "min"   "tsar"  "full_assoc" "2k"    "4k"   ); | 
|---|
| 5 | iways=(         "1"     "4"     "16"         "4"     "4"    ); | 
|---|
| 6 | isets=(         "8"     "64"    "1"          "8"     "16"   ); | 
|---|
| 7 | iwords=(        "16"    "16"    "16"         "16"    "16"   ); | 
|---|
| 8 | dways=(         "1"     "4"     "16"         "4"     "4"    ); | 
|---|
| 9 | dsets=(         "8"     "64"    "1"          "8"     "16"   ); | 
|---|
| 10 | dwords=(        "16"    "16"    "16"         "16"    "16"   ); | 
|---|
| 11 | memc_nways=(    "4"     "16"    "8"          "2"     "16"   ); | 
|---|
| 12 | memc_nsets=(    "4"     "256"   "64"         "32"    "64"   ); | 
|---|
| 13 | memc_words=(    "16"    "16"    "16"         "16"    "16"   ); | 
|---|
| 14 | memc_heap_size=("4096"  "4096"  "4096"       "4096"  "4096" ); | 
|---|
| 15 |  | 
|---|
| 16 | nb_proc=(        "1" "15"   "+1" "4"); | 
|---|
| 17 | nb_cpu_by_cache=("1" "15"   "*2" "1"); | 
|---|
| 18 | nb_cache=(       "1" "16"   "*2" "1"); | 
|---|
| 19 | #wnwords=(        "1" "16"   "*2" "4"); | 
|---|
| 20 | #wnlines=(        "1" "8"    "*2" "8"); | 
|---|
| 21 |  | 
|---|
| 22 | wnwords=(        "4"  "4"  "*2" "4"); | 
|---|
| 23 | wnlines=(        "8"  "8"  "*2" "8"); | 
|---|
| 24 |  | 
|---|
| 25 | archi_default="1"; | 
|---|
| 26 | gen_cfg=0; | 
|---|
| 27 |  | 
|---|
| 28 | function gen_file () | 
|---|
| 29 | { | 
|---|
| 30 |         filename=$(printf "archi_%s-x%.2d_%.2d_%.2d-wbuf_%.2d_%.2d_%.4d.cfg" ${archi_name[${4}]} ${1} ${2} ${3} ${5} ${6}); | 
|---|
| 31 |  | 
|---|
| 32 |         echo ${filename}; | 
|---|
| 33 |  | 
|---|
| 34 |         echo "${1}" >  ${filename}; | 
|---|
| 35 |         echo "${2} ${3}" >> ${filename}; | 
|---|
| 36 |         echo "${iways[${4}]} ${isets[${4}]} ${iwords[${4}]}" >> ${filename}; | 
|---|
| 37 |         echo "${dways[${4}]} ${dsets[${4}]} ${dwords[${4}]}" >> ${filename}; | 
|---|
| 38 |         echo "${5} ${6}" >> ${filename}; | 
|---|
| 39 |         echo "${memc_nways[${4}]} ${memc_nsets[${4}]} ${memc_words[${4}]} ${memc_heap_size[${4}]}" >> ${filename}; | 
|---|
| 40 | } | 
|---|
| 41 |  | 
|---|
| 42 | function gen_default () | 
|---|
| 43 | { | 
|---|
| 44 |         filename="default.cfg"; | 
|---|
| 45 |         archi=${1}; | 
|---|
| 46 |  | 
|---|
| 47 |         echo ${filename}; | 
|---|
| 48 |  | 
|---|
| 49 |         echo "${nb_proc[3]}"  >  ${filename}; | 
|---|
| 50 |         echo "${nb_cpu_by_cache[3]} ${nb_cache[3]}" >> ${filename}; | 
|---|
| 51 |         echo "${iways[${archi}]} ${isets[${archi}]} ${iwords[${archi}]}" >> ${filename}; | 
|---|
| 52 |         echo "${dways[${archi}]} ${dsets[${archi}]} ${dwords[${archi}]}" >> ${filename}; | 
|---|
| 53 |         echo "${wnwords[3]} ${wnlines[3]}" >> ${filename}; | 
|---|
| 54 |         echo "${memc_nways[${archi}]} ${memc_nsets[${archi}]} ${memc_words[${archi}]} ${memc_heap_size[${archi}]}" >> ${filename}; | 
|---|
| 55 | } | 
|---|
| 56 |  | 
|---|
| 57 | gen_default ${archi_default}; | 
|---|
| 58 |  | 
|---|
| 59 | if test ${gen_cfg} -ne 0; then | 
|---|
| 60 |     nb_archi=${#iways[*]}; | 
|---|
| 61 |      | 
|---|
| 62 |     num_archi=0; | 
|---|
| 63 |     while test ${num_archi} -lt ${nb_archi}; do | 
|---|
| 64 |         num_proc=${nb_proc[0]}; | 
|---|
| 65 |         while test ${num_proc} -le ${nb_proc[1]}; do | 
|---|
| 66 |             num_cpu_by_cache=${nb_cpu_by_cache[0]}; | 
|---|
| 67 |             while test ${num_cpu_by_cache} -le ${nb_cpu_by_cache[1]}; do | 
|---|
| 68 |  | 
|---|
| 69 |                 if test $((${num_proc} * ${num_cpu_by_cache})) -le ${nb_cpu_by_cache[1]}; then | 
|---|
| 70 |  | 
|---|
| 71 |                 num_cache=${nb_cache[0]}; | 
|---|
| 72 |                 while test ${num_cache} -le ${nb_cache[1]}; do | 
|---|
| 73 |                  | 
|---|
| 74 |                     if test ${num_cache} -ge ${num_cpu_by_cache}; then | 
|---|
| 75 |                     if test ${num_cpu_by_cache} -ne 1 -o ${num_cache} -eq 1; then | 
|---|
| 76 |  | 
|---|
| 77 |                     num_words=${wnwords[0]}; | 
|---|
| 78 |                     while test ${num_words} -le ${wnwords[1]}; do | 
|---|
| 79 |                         num_lines=${wnlines[0]}; | 
|---|
| 80 |                         while test ${num_lines} -le ${wnlines[1]}; do | 
|---|
| 81 |                              | 
|---|
| 82 |                             gen_file ${num_proc} ${num_cpu_by_cache} ${num_cache} ${num_archi} ${num_words} ${num_lines}; | 
|---|
| 83 |  | 
|---|
| 84 |                             num_lines=$((${num_lines} ${wnlines[2]})); | 
|---|
| 85 |                         done; | 
|---|
| 86 |                         num_words=$((${num_words} ${wnwords[2]})); | 
|---|
| 87 |                     done; | 
|---|
| 88 |                     fi; | 
|---|
| 89 |                     fi; | 
|---|
| 90 |                     num_cache=$((${num_cache} ${nb_cache[2]})); | 
|---|
| 91 |                 done; | 
|---|
| 92 |                 fi; | 
|---|
| 93 |                 num_cpu_by_cache=$((${num_cpu_by_cache} ${nb_cpu_by_cache[2]})); | 
|---|
| 94 |             done; | 
|---|
| 95 |             num_proc=$((${num_proc} ${nb_proc[2]})); | 
|---|
| 96 |         done; | 
|---|
| 97 |         num_archi=$((${num_archi}+1)); | 
|---|
| 98 |     done; | 
|---|
| 99 | fi; | 
|---|
| 100 |  | 
|---|