commtech: calc lib take 1 argument on command line
This commit is contained in:
parent
7a1610961c
commit
3341546c75
|
@ -14,7 +14,7 @@ PAPIPFMDir="libpfm-3.y/lib"
|
|||
# Param
|
||||
binList="asm_cache_comm c_cache_comm pipe_comm shared_mem_comm shared_mem_opt_comm jikes_barrier_comm fake_comm" # Type de communication
|
||||
nbProdList="1" # Nombre de cores producteurs
|
||||
typeProdList="none matrice" # Methode pour produire les valeurs
|
||||
typeProdList="none matrice useless_loop" # Methode pour produire les valeurs
|
||||
typeCacheList="L2 mem" # Niveau de cache partage
|
||||
|
||||
# Const
|
||||
|
@ -22,7 +22,7 @@ nbIter="5000000" # Nb de lignes produites
|
|||
sizeBuf="1" # En nombre de lignes de cache
|
||||
|
||||
# Nom generique des fichiers de log
|
||||
logFileName="\$perfDirName/cache_\$typeCache-nbProd_\$nbProd-typeProd_\$typeProd-nbIter_\$nbIter-\$bin.log"
|
||||
logFileName="\$perfDirName/cache_\$typeCache-nbProd_\$nbProd-typeProd_\$typeProd-argTypeProd_\$argTypeProd-nbIter_\$nbIter-\$bin.log"
|
||||
expDirName="logs"
|
||||
perfDirName="$expDirName/perfCommMulti-`date +'%F-%Hh%Mm%S'`"
|
||||
|
||||
|
@ -70,7 +70,8 @@ export LD_LIBRARY_PATH
|
|||
function_run () {
|
||||
case $typeProd in
|
||||
"none" ) optTypeProd="" ;;
|
||||
"matrice" ) optTypeProd="-c lib/${calcDir}/libcalc_mat.so" ;;
|
||||
"matrice" ) optTypeProd="-c lib/${calcDir}/libcalc_mat.so 16" ;;
|
||||
"useless_loop" ) optTypeProd="-c lib/${calcDir}/libcalc_useless_loop.so ${nb_useless_loop}" ;;
|
||||
* ) exit 1 ;;
|
||||
esac
|
||||
case $typeCache in
|
||||
|
@ -104,7 +105,20 @@ for nbProd in $nbProdList ; do
|
|||
for typeProd in $typeProdList; do
|
||||
for typeCache in $typeCacheList ; do
|
||||
for bin in $binList ; do
|
||||
function_run
|
||||
if [ "$typeProd" = "useless_loop" ]
|
||||
then
|
||||
case $bin in
|
||||
"jikes_barrier_comm" | "asm_cache_comm" | "c_cache_comm" )
|
||||
for argTypeProd in `seq 1 50 5` ; do
|
||||
function_run ;
|
||||
done ;;
|
||||
* ) argTypeProd=1 ;
|
||||
function_run ;;
|
||||
esac
|
||||
else
|
||||
argTypeProd=1 ;
|
||||
function_run ;
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#define toString(x) doStringification(x)
|
||||
#define doStringification(x) #x
|
||||
#define INIT_CALC_ARG 16
|
||||
#define WORDS_PER_BUF (BUF_SIZE / sizeof(uintptr_t))
|
||||
#define DIV_SEC(secs, div) ((unsigned ) (((unsigned) secs) / (unsigned long) (div)))
|
||||
#define DIV_USEC(nsecs, nusecs, div) ((unsigned) (((unsigned) (nusecs) + 1000000 * \
|
||||
|
@ -37,6 +36,7 @@ pthread_cond_t cond_cons_has_finished = PTHREAD_COND_INITIALIZER;
|
|||
pthread_mutex_t mutex_cons_has_finished = PTHREAD_MUTEX_INITIALIZER;
|
||||
static int consumer_has_finished = 0;
|
||||
static int producers_ended = 0;
|
||||
static int init_calc_arg = 0;
|
||||
|
||||
void usage(char *argv[])
|
||||
{
|
||||
|
@ -105,6 +105,27 @@ int analyse_options(int argc, char *argv[])
|
|||
fprintf(stderr, "A symbol cannot be loaded: %s\n", dlerror());
|
||||
return -1;
|
||||
}
|
||||
if ((optind == argc) || (*argv[optind] == '-'))
|
||||
{
|
||||
fprintf(stderr, "Missing argument for -c option\n");
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
char *inval;
|
||||
init_calc_arg = strtol(argv[optind], &inval, 10);
|
||||
if ((*argv[optind] == '\0') || (*inval != '\0'))
|
||||
{
|
||||
fprintf(stderr, "Option '-c' needs also an integer argument\n");
|
||||
return -1;
|
||||
}
|
||||
if ((init_calc_arg <= 0) || ((init_calc_arg == LONG_MAX) && errno == ERANGE))
|
||||
{
|
||||
fprintf(stderr, "Number of useless loop to be done between 2 send must be"
|
||||
" between 1 and %ld, both inclusive\n", LONG_MAX);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
optind++;
|
||||
}
|
||||
break;
|
||||
case 'h' :
|
||||
|
@ -232,7 +253,7 @@ void *producer(void *unused)
|
|||
return &nb_prod; /* &nb_prod can't be NULL, whatever NULL is bound to */
|
||||
}
|
||||
}
|
||||
if (init_calc(INIT_CALC_ARG))
|
||||
if (init_calc(init_calc_arg))
|
||||
{
|
||||
fprintf(stderr, "Initialization of calculation has failed\n");
|
||||
wait_consumer();
|
||||
|
|
Loading…
Reference in New Issue