1f08c3bdfSopenharmony_ci#! /bin/bash
2f08c3bdfSopenharmony_ci
3f08c3bdfSopenharmony_ciif [ ! $SCRIPTS_DIR ]; then
4f08c3bdfSopenharmony_ci	# assume we're running standalone
5f08c3bdfSopenharmony_ci	export SCRIPTS_DIR=../../scripts/
6f08c3bdfSopenharmony_cifi
7f08c3bdfSopenharmony_ci
8f08c3bdfSopenharmony_cisource $SCRIPTS_DIR/setenv.sh
9f08c3bdfSopenharmony_ciLOG_FILE="$LOG_DIR/$LOG_FORMAT-pthread_cond_many.log"
10f08c3bdfSopenharmony_ci
11f08c3bdfSopenharmony_ciecho "Logging to: " | tee -a $LOG_FILE
12f08c3bdfSopenharmony_ciecho "$LOG_FILE " | tee -a $LOG_FILE
13f08c3bdfSopenharmony_ciecho "and to local individual .out files " | tee -a $LOG_FILE
14f08c3bdfSopenharmony_ci
15f08c3bdfSopenharmony_ci#
16f08c3bdfSopenharmony_ci# make will eventually go away from here, as will the above echoes
17f08c3bdfSopenharmony_ci#
18f08c3bdfSopenharmony_cimake
19f08c3bdfSopenharmony_ci
20f08c3bdfSopenharmony_ci#
21f08c3bdfSopenharmony_ci# Test lots of threads.  Specify "--realtime" if you want the first
22f08c3bdfSopenharmony_ci# process to run realtime.  The remainder of the processes (if any)
23f08c3bdfSopenharmony_ci# will run non-realtime in any case.
24f08c3bdfSopenharmony_ci
25f08c3bdfSopenharmony_cinthread=5000
26f08c3bdfSopenharmony_ciiter=400
27f08c3bdfSopenharmony_cinproc=5
28f08c3bdfSopenharmony_ci
29f08c3bdfSopenharmony_ciecho "pthread_cond_many configuration:" | tee -a $LOG_FILE
30f08c3bdfSopenharmony_ciecho "number of threads = $nthread " | tee -a $LOG_FILE
31f08c3bdfSopenharmony_ciecho "number of iterations = $iter " | tee -a $LOG_FILE
32f08c3bdfSopenharmony_ciecho "number of processes = $nproc " | tee -a $LOG_FILE
33f08c3bdfSopenharmony_ci
34f08c3bdfSopenharmony_ci# Remove any existing local log files
35f08c3bdfSopenharmony_cirm -f $nthread.$iter.$nproc.*.out
36f08c3bdfSopenharmony_ci
37f08c3bdfSopenharmony_cii=0
38f08c3bdfSopenharmony_ci./pthread_cond_many --realtime --broadcast -i $iter -n $nthread > $nthread.$iter.$nproc.$i.out &
39f08c3bdfSopenharmony_cii=1
40f08c3bdfSopenharmony_ciwhile test $i -lt $nproc
41f08c3bdfSopenharmony_cido
42f08c3bdfSopenharmony_ci        ./pthread_cond_many --broadcast -i $iter -n $nthread > $nthread.$iter.$nproc.$i.out &
43f08c3bdfSopenharmony_ci        i=`expr $i + 1`
44f08c3bdfSopenharmony_cidone
45f08c3bdfSopenharmony_ciwait
46