Here is another example bash script for running a set of row-wise
and column-size
experiments on a several input files which specify the grid size and
number of iterations (I've given my files names which include the size
and the number of iterations so that the script output helps me
easily identify the different results). This is just one example that
demonstrates how to iterate over a set of values for number of threads
and over a set of GOL init files (you likely will want to make multiple
run scripts that test certain things, and you may find the non-file init
command line args more useful for run scripts):
cat testrun.sh
#!/bin/bash
for f in infile_100_100.txt infile_500_500.txt infile_1000_1000.txt
do
for ((t=1; t <= 64; t*=2))
do
echo ""
echo "$f $t row"
for((i=0; i < 5; i+=1))
do
time ./gol -t $t -f $f -x
done
echo ""
echo "$f $t column"
for((i=0; i < 5; i+=1))
do
time ./gol -t $t -f $f -x -c
done
done
done
To run, make sure the script file is executable:
ls -l # lists its permisions
chomd 700 testrun.sh # sets rwx permission for file owner
To run:
./testrun.sh
It is often useful to redirect the output from these runs to a file.
For, example to redirect stdout and stderr to a file named "resultfile":
./testrun.sh &> resultfile