Created
October 29, 2020 17:49
-
-
Save robobenklein/7ac0b6895833412240b74d0b1fd46a12 to your computer and use it in GitHub Desktop.
CS462 dat file generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/zsh | |
params="${1}" | |
typeset -i algo=${2} | |
typeset -i threads=${3} | |
{ [[ -z $params ]] || [[ -z ${2} ]] || (( algo < 0 || algo >= 10 )) } && { | |
echo "Please supply the <parameters file> <algorithm number> [thread count?]" | |
exit 1 | |
} | |
(( threads < 1 )) && threads=1 | |
typeset -A algoname | |
algoname[0]="JACOBI" | |
algoname[1]="TEMPLATE" | |
algoname[2]="PTHREADS" | |
algoname[3]="MPI_BLOCKING" | |
algoname[4]="MPI_NONBLOCK" | |
algoname[5]="MPI_RMA" | |
algoname[6]="MPI_COLLECTIVE" | |
algoname[7]="OSHMEM" | |
algoname[8]="OPENMP" | |
algoname[9]="CUDA" | |
printf "gendat.zsh: using algorithm %d: %s, %d threads\n" $algo $algoname[$algo] ${threads} >&2 | |
typeset -A paramsets | |
paramsets[small]="iter 1000 | |
alg ${algo} | |
resolution 256 | |
threads ${threads} | |
vis_res 256 | |
vis_step 25 | |
numsrc 2 | |
num_proc_p 2 | |
0 0 0.5 200.25 | |
1 1 0.5 100.25 | |
" | |
paramsets[tiny]="iter 2 | |
alg ${algo} | |
resolution 16 | |
threads ${threads} | |
vis_res 16 | |
vis_step 1 | |
numsrc 2 | |
num_proc_p 1 | |
0 0 0.5 60.8 | |
1.2 0.8 0.5 90.2 | |
" | |
paramsets[large]="num_proc_p 1 | |
iter 100000 | |
alg ${algo} | |
resolution 2560 | |
threads ${threads} | |
vis_res 256 | |
vis_step 250 | |
numsrc 4 | |
0 0 0.5 200.25 | |
0 1 0.5 50.25 | |
1 0 0.5 20.25 | |
1 1 0.5 100.25 | |
" | |
paramsets[medium]="num_proc_p 1 | |
iter 5000 | |
alg ${algo} | |
resolution 2560 | |
threads ${threads} | |
vis_res 256 | |
vis_step 250 | |
numsrc 4 | |
0 0 0.5 200.25 | |
0 1 0.5 50.25 | |
1 0 0.5 20.25 | |
1 1 0.5 100.25 | |
" | |
dat=$paramsets[$params] | |
[[ -z $dat ]] && { | |
echo "Data for ${params} not found." | |
exit 1 | |
} | |
fname="/tmp/cs462_gendat_${USER}_${params}_${algo}_${threads}t.dat" | |
echo $dat > $fname | |
echo $fname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment