Commit 7b7f8020 authored by GRASLAND Hadrien's avatar GRASLAND Hadrien
Browse files

Replace racey process substitution with a simpler stderr/stdout swap

parent 295cafdc
......@@ -14,21 +14,32 @@ for size in $(seq 3 8); do
echo -e "\t Simple"
g++ gemm_simple.cpp -DSIZE=$size -O3 -march=native
for i in $(seq 1 ${REPEAT}); do
${TIME} -f "%U, " ./a.out 2> >(tr -d '\n' | tee -a ${FILE}_simple.res) && echo
# GNU time produces its data on stderr, and we want to post-process it.
# But bash's pipe operator only works on stdout. So we need to swap
# stdout and stderr first.
/usr/bin/time -f "%U, " ./a.out 3>&1 1>&2 2>&3 3>&- \
| tr -d '\n' | tee -a ${FILE}_simple.res \
&& echo
done
echo >> ${FILE}_simple.res
echo -e "\t Eigen"
g++ gemm_eigen.cpp -DSIZE=$size -O3 -march=native
for i in $(seq 1 ${REPEAT}); do
${TIME} -f "%U, " ./a.out 2> >(tr -d '\n' | tee -a ${FILE}_eigen.res) && echo
# Same as above, only targeting a different file
/usr/bin/time -f "%U, " ./a.out 3>&1 1>&2 2>&3 3>&- \
| tr -d '\n' | tee -a ${FILE}_eigen.res \
&& echo
done
echo >> ${FILE}_eigen.res
echo -e "\t Custom"
g++ gemm_custom.cpp -DSIZE=$size -O3 -march=native
for i in $(seq 1 ${REPEAT}); do
${TIME} -f "%U, " ./a.out 2> >(tr -d '\n' | tee -a ${FILE}_custom.res) && echo
# Same as above, only targeting a different file
/usr/bin/time -f "%U, " ./a.out 3>&1 1>&2 2>&3 3>&- \
| tr -d '\n' | tee -a ${FILE}_custom.res \
&& echo
done
echo >> ${FILE}_custom.res
......
......@@ -10,13 +10,21 @@ rm -f eigen_${FILE}
for size in $(seq 3 8); do
g++ matrix_product_custom.cpp -DSIZE=$size -O3 -march=native
for i in $(seq 1 ${REPEAT}); do
/usr/bin/time -f "%U, " ./a.out 2> >(tr -d '\n' | tee -a custom_${FILE}) && echo
# GNU time produces its data on stderr, and we want to post-process it.
# But bash's pipe operator only works on stdout. So we need to swap
# stdout and stderr first.
/usr/bin/time -f "%U, " ./a.out 3>&1 1>&2 2>&3 3>&- \
| tr -d '\n' | tee -a custom_${FILE} \
&& echo
done
echo >> custom_${FILE}
g++ matrix_product_eigen.cpp -DSIZE=$size -O3 -march=native
for i in $(seq 1 ${REPEAT}); do
/usr/bin/time -f "%U, " ./a.out 2> >(tr -d '\n' | tee -a eigen_${FILE}) && echo
# Same as above, only targeting a different file
/usr/bin/time -f "%U, " ./a.out 3>&1 1>&2 2>&3 3>&- \
| tr -d '\n' | tee -a eigen_${FILE} \
&& echo
done
echo >> eigen_${FILE}
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment