Skip to content

Commit

Permalink
Add scripts for QC
Browse files Browse the repository at this point in the history
  • Loading branch information
pghysels committed May 29, 2024
1 parent 5374cd9 commit 95c5f73
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 0 deletions.
109 changes: 109 additions & 0 deletions experiments/pp_qc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/bin/bash

out=out_qc
comp=stable

# for k in 10000 20000 40000; do
# for tol in 1e-2 1e-4 1e-6; do
# rm -rf tmp*
# for nnz in 1 2 4 8; do
# grep "errors:" ${out}/out_dim_k${k}*tol${tol}*${comp}_sjlt_nnz${nnz} | awk '{print $2}' > tmp_err_med_nnz${nnz}
# grep "errors:" ${out}/out_dim_k${k}*tol${tol}*${comp}_sjlt_nnz${nnz} | awk '{print $3}' > tmp_err_min_nnz${nnz}
# grep "errors:" ${out}/out_dim_k${k}*tol${tol}*${comp}_sjlt_nnz${nnz} | awk '{print $4}' > tmp_err_max_nnz${nnz}
# done
# grep "errors:" ${out}/out_dim_k${k}*tol${tol}*${comp}_gaussian | awk '{print $2}' >> tmp_err_med_gaussian
# grep "errors:" ${out}/out_dim_k${k}*tol${tol}*${comp}_gaussian | awk '{print $3}' >> tmp_err_min_gaussian
# grep "errors:" ${out}/out_dim_k${k}*tol${tol}*${comp}_gaussian | awk '{print $4}' >> tmp_err_max_gaussian
# case $tol in
# 1e-2)
# color='red'
# mark='';;
# 1e-4)
# color='green'
# mark='square';;
# 1e-6)
# color='blue'
# mark='triangle';;
# esac
# printf '\t\\addplot[color=%s, mark=%s*, only marks, mark size=2pt, error bars/.cd, y dir=both,y explicit]\n' $color $mark
# printf '\tcoordinates { %% %s, %s\n' $tol $k
# printf '\t\t(G, %s) -= (0, %s) += (0, %s)\n' `cat tmp_err_med_gaussian` `cat tmp_err_min_gaussian` `cat tmp_err_max_gaussian`
# printf '\t\t(S1, %s) -= (0, %s) += (0, %s)\n' `cat tmp_err_med_nnz1` `cat tmp_err_min_nnz1` `cat tmp_err_max_nnz1`
# printf '\t\t(S2, %s) -= (0, %s) += (0, %s)\n' `cat tmp_err_med_nnz2` `cat tmp_err_min_nnz2` `cat tmp_err_max_nnz2`
# printf '\t\t(S4, %s) -= (0, %s) += (0, %s)\n' `cat tmp_err_med_nnz4` `cat tmp_err_min_nnz4` `cat tmp_err_max_nnz4`
# printf '\t\t(S8, %s) -= (0, %s) += (0, %s)\n' `cat tmp_err_med_nnz8` `cat tmp_err_min_nnz8` `cat tmp_err_max_nnz8`
# printf '\t};\n'
# echo ""
# done
# done


# for k in 10000 20000 40000; do
# for tol in 1e-2 1e-4 1e-6; do
# rm -rf tmp*
# for nnz in 1 2 4 8; do
# grep "ranks:" ${out}/out_dim_k${k}*tol${tol}*${comp}_sjlt_nnz${nnz} | awk '{print $2}' > tmp_ranks_med_nnz${nnz}
# grep "ranks:" ${out}/out_dim_k${k}*tol${tol}*${comp}_sjlt_nnz${nnz} | awk '{print $3}' > tmp_ranks_min_nnz${nnz}
# grep "ranks:" ${out}/out_dim_k${k}*tol${tol}*${comp}_sjlt_nnz${nnz} | awk '{print $4}' > tmp_ranks_max_nnz${nnz}
# done
# grep "ranks:" ${out}/out_dim_k${k}*tol${tol}*${comp}_gaussian | awk '{print $2}' >> tmp_ranks_med_gaussian
# grep "ranks:" ${out}/out_dim_k${k}*tol${tol}*${comp}_gaussian | awk '{print $3}' >> tmp_ranks_min_gaussian
# grep "ranks:" ${out}/out_dim_k${k}*tol${tol}*${comp}_gaussian | awk '{print $4}' >> tmp_ranks_max_gaussian
# case $tol in
# 1e-2)
# color='red'
# mark='';;
# 1e-4)
# color='green'
# mark='square';;
# 1e-6)
# color='blue'
# mark='triangle';;
# esac
# # case $k in
# # 10000) mark='';;
# # 20000) mark='square';;
# # 40000) mark='triangle';;
# # esac
# # case $tol in
# # 1e-2) color='red';;
# # 1e-4) color='green';;
# # 1e-6) color='blue';;
# # esac
# printf '\t\\addplot[color=%s, mark=%s*, only marks, mark size=2pt, error bars/.cd, y dir=both,y explicit]\n' $color $mark
# printf '\tcoordinates { %% %s, %s\n' $tol $k
# printf '\t\t(G, %s) -= (0, %s) += (0, %s)\n' `cat tmp_ranks_med_gaussian` `cat tmp_ranks_min_gaussian` `cat tmp_ranks_max_gaussian`
# printf '\t\t(S1, %s) -= (0, %s) += (0, %s)\n' `cat tmp_ranks_med_nnz1` `cat tmp_ranks_min_nnz1` `cat tmp_ranks_max_nnz1`
# printf '\t\t(S2, %s) -= (0, %s) += (0, %s)\n' `cat tmp_ranks_med_nnz2` `cat tmp_ranks_min_nnz2` `cat tmp_ranks_max_nnz2`
# printf '\t\t(S4, %s) -= (0, %s) += (0, %s)\n' `cat tmp_ranks_med_nnz4` `cat tmp_ranks_min_nnz4` `cat tmp_ranks_max_nnz4`
# printf '\t\t(S8, %s) -= (0, %s) += (0, %s)\n' `cat tmp_ranks_med_nnz8` `cat tmp_ranks_min_nnz8` `cat tmp_ranks_max_nnz8`
# printf '\t};\n'
# echo ""

# done
# done


for tol in 1e-2 1e-4 1e-6; do
echo $tol
for k in 10000 20000 40000; do
rm -rf tmp*
for nnz in 1 2 4 8; do
grep "A\*S time\|AT\*S time" ${out}/out_dim_k${k}*tol${tol}*${comp}_SJLT_nnz${nnz} | awk '{sum+=$5} END {print sum/5}' > tmp_sample_nnz${nnz}
grep "times:" ${out}/out_dim_k${k}*tol${tol}*${comp}_SJLT_nnz${nnz} | awk '{print $2}' > tmp_constr_nnz${nnz}
done

grep "A\*S time\|AT\*S time" ${out}/out_dim_k${k}*tol${tol}*${comp}_Gaussian | awk '{sum+=$5} END {print sum/5}' >> tmp_sample_gaussian
grep "times:" ${out}/out_dim_k${k}*tol${tol}*${comp}_Gaussian | awk '{print $2}' >> tmp_constr_gaussian

grep "A\*S time\|AT\*S time" ${out}/out_dim_k${k}*tol${tol}*${comp}_SRHT | awk '{sum+=$5} END {print sum/5}' >> tmp_sample_srht
grep "times:" ${out}/out_dim_k${k}*tol${tol}*${comp}_SRHT | awk '{print $2}' >> tmp_constr_srht

grep "Number of unknowns:" ${out}/out_dim_k${k}*tol${tol}*${comp}_Gaussian | awk '{print $4}' >> tmp_N_gaussian
grep "\% of dense" ${out}/out_dim_k${k}*tol${tol}*${comp}_Gaussian | awk '{print $6}' | tail -n 1 | sed 's/%//'>> tmp_compr
printf '& & %s & %5.0f & %5.0f & %5.0f & %5.0f & %5.0f & %5.0f & %5.0f & %5.0f & %5.0f & %5.0f & %5.0f & %5.0f & %5.1f \\\\ \n' $k `cat tmp_sample_gaussian` `cat tmp_sample_nnz1` `cat tmp_sample_nnz2` `cat tmp_sample_nnz4` `cat tmp_sample_nnz8` `cat tmp_sample_srht` `cat tmp_constr_gaussian` `cat tmp_constr_nnz1` `cat tmp_constr_nnz2` `cat tmp_constr_nnz4` `cat tmp_constr_nnz8` `cat tmp_constr_srht` `cat tmp_compr`
done
echo ""
done

rm tmp*
42 changes: 42 additions & 0 deletions experiments/run_qc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

T=1

out=out_qc
mkdir $out

leaf=256
comp=stable

export OMP_NUM_THREADS=$T
for tol in 1e-2 1e-4 1e-6; do
echo $tol
for k in 10000 20000 40000; do
echo $k
sampling=SJLT
for nnz in 1 2 4 8; do
echo $nnz
../build/examples/dense/testQC \
$k --hss_rel_tol $tol \
--hss_compression_algorithm $comp \
--hss_nnz0 $nnz --hss_nnz $nnz \
--hss_compression_sketch $sampling \
--hss_leaf_size $leaf --help \
> ${out}/out_dim${dim}_k${k}_cor${cor}_T${T}_tol${tol}_leaf${leaf}_${comp}_${sampling}_nnz${nnz}
done
sampling=Gaussian
../build/examples/dense/testQC \
$k --hss_rel_tol $tol \
--hss_compression_algorithm $comp \
--hss_compression_sketch $sampling \
--hss_leaf_size $leaf --help \
> ${out}/out_dim${dim}_k${k}_cor${cor}_T${T}_tol${tol}_leaf${leaf}_${comp}_${sampling}
sampling=SRHT
../build/examples/dense/testQC \
$k --hss_rel_tol $tol \
--hss_compression_algorithm $comp \
--hss_compression_sketch $sampling \
--hss_leaf_size $leaf --help \
> ${out}/out_dim${dim}_k${k}_cor${cor}_T${T}_tol${tol}_leaf${leaf}_${comp}_${sampling}
done
done

0 comments on commit 95c5f73

Please sign in to comment.