diff --git a/evaluation/scripts/README.txt b/evaluation/scripts/README.txt new file mode 100644 index 00000000..79cbc558 --- /dev/null +++ b/evaluation/scripts/README.txt @@ -0,0 +1,64 @@ +-build.sh- + +Description: Makes the build in the opae directory with the specified core + count and optional performance profiling. If a build already + exists, a make clean command is ran before the build. Script waits + until the inteldev script or quartus program is finished running. + +Usage: ./build.sh -c [1|2|4|8|16] [-p [y|n]] + +Options: + -c + Core count (1, 2, 4, 8, or 16). + + -p + Performance profiling enable (y or n). Changes the source file in the + opae directory to include/exclude "+define+PERF_ENABLE". + +_______________________________________________________________________________ + + +-build_all_perf.sh- + +Description: Runs build.sh with performance profiling enabled for all valid + core configurations. + +_______________________________________________________________________________ + + +-program_fpga.sh- + +Description: Signs and programs the fpga for a specified core count. Prompts + for PACSign are all automatically answered 'yes'. + +Usage: ./program_fpga.sh -c [1|2|4|8|16] + +Options: + -c + Core count (1, 2, 4, 8, or 16). + +_______________________________________________________________________________ + + +-gather_perf_results.sh- + +Description: Creates directory named perf_YYYY_MM_DD and core subfolders in + evaluation. Copies relevant build output files to specified core + directory. Runs and redirects outputs of sgemm, vecadd, saxpy, + sfilter, nearn, and gaussian benchmarks to specified core + directory. Build should already be made before running this. + +Usage: ./gather_perf_results.sh -c [1|2|4|8|16] + +Options: + -c + Core count (1, 2, 4, 8, or 16). + +_______________________________________________________________________________ + + +-gather_all_perf_results.sh- + +Description: Programs fpga and runs gather_perf_results.sh for all valid core + configurations. All builds should already be made before running + this. diff --git a/evaluation/scripts/build.sh b/evaluation/scripts/build.sh new file mode 100755 index 00000000..abb646f1 --- /dev/null +++ b/evaluation/scripts/build.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +while getopts c:p: flag +do + case "${flag}" in + c) cores=${OPTARG};; #1, 2, 4, 8, 16 + p) perf=${OPTARG};; #perf counters enable (y/n) + esac +done + +if [[ ! "$cores" =~ ^(1|2|4|8|16)$ ]]; then + echo 'Invalid parameter for argument -c (1, 2, 4, 8, or 16 expected)' + exit 1 +fi + +cd ../../hw/syn/opae + +sources_file="./sources_${cores}c.txt" + +if [ ${perf:0:1} = "n" ]; then + if grep -v '^ *#' ${sources_file} | grep -Fxq '+define+SYNTHESIS'; then + sed -i 's/+define+PERF_ENABLE/#+define+PERF_ENABLE/' ${sources_file} + elif ! grep -Fxq '#+define+PERF_ENABLE' ${sources_file}; then + sed -i '1s/^/#+define+PERF_ENABLE\n/' ${sources_file} + fi +elif [ ${perf:0:1} = "y" ]; then + if grep -Fxq '#+define+PERF_ENABLE' ${sources_file}; then + sed -i 's/+define+PERF_ENABLE/#+define+PERF_ENABLE/' ${sources_file} + elif ! grep -Fxq '+define+PERF_ENABLE' ${sources_file}; then + sed -i '1s/^/+define+PERF_ENABLE\n/' ${sources_file} + fi +else + echo 'Invalid parameter for argument -p (y/n expected)' + exit 1 +fi + +if [ -d "./build_fpga_{$cores}c" ]; then + make "clean-fpga-${cores}c" +fi +make "fpga-${cores}c" + +sleep 30 + +pids=($(pgrep -f "${OPAE_PLATFORM_ROOT}|quartus")) +for pid in ${pids[@]}; do + while kill -0 ${pid} 2> /dev/null; do + sleep 30 + done +done + diff --git a/evaluation/scripts/build_all_perf.sh b/evaluation/scripts/build_all_perf.sh new file mode 100755 index 00000000..ffcfa211 --- /dev/null +++ b/evaluation/scripts/build_all_perf.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +for ((i=1; i <= 16; i=i*2)); do + echo "Building ${i} core build..." + ./build.sh -c ${i} -p y + echo "Done ${i} core build." +done diff --git a/evaluation/scripts/gather_all_perf_results.sh b/evaluation/scripts/gather_all_perf_results.sh new file mode 100755 index 00000000..0e540adc --- /dev/null +++ b/evaluation/scripts/gather_all_perf_results.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +cd ../../hw/syn/opae/ + +date=$(date +%Y_%m_%d) +results_dir="../../../evaluation/perf_${date}" +mkdir -p ${results_dir} + +for ((i=1; i <= 16; i=i*2)); do + mkdir -p "${results_dir}/${i}c" +done + +for ((i=1; i <= 16; i=i*2)); do + cp "./build_fpga_${i}c/build.log" "${results_dir}/${i}c/build.log" + cp "./build_fpga_${i}c/build/output_files/afu_default.syn.summary" "${results_dir}/${i}c/afu_default.syn.summary" + cp "./build_fpga_${i}c/build/output_files/afu_default.fit.summary" "${results_dir}/${i}c/afu_default.fit.summary" + cp "./build_fpga_${i}c/build/output_files/afu_default.sta.summary" "${results_dir}/${i}c/afu_default.sta.summary" + cp "./build_fpga_${i}c/build/output_files/user_clock_freq.txt" "${results_dir}/${i}c/user_clock_freq.txt" +done + +cd ../../../evaluation/scripts + +for ((i=1; i <= 16; i=i*2)); do + ./program_fpga.sh -c ${i} + ../../ci/blackbox.sh --driver=fpga --app=sgemm --perf > "${results_dir}/${i}c/sgemm.result" + ../../ci/blackbox.sh --driver=fpga --app=vecadd --perf > "${results_dir}/${i}c/vecadd.result" + ../../ci/blackbox.sh --driver=fpga --app=saxpy --perf > "${results_dir}/${i}c/saxpy.result" + ../../ci/blackbox.sh --driver=fpga --app=sfilter --perf > "${results_dir}/${i}c/sfilter.result" + ../../ci/blackbox.sh --driver=fpga --app=nearn --perf > "${results_dir}/${i}c/nearn.result" + ../../ci/blackbox.sh --driver=fpga --app=guassian --perf > "${results_dir}/${i}c/guassian.result" +done diff --git a/evaluation/scripts/gather_perf_results.sh b/evaluation/scripts/gather_perf_results.sh new file mode 100755 index 00000000..8bfb2ba1 --- /dev/null +++ b/evaluation/scripts/gather_perf_results.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +cd ../../hw/syn/opae/ + +while getopts c: flag +do + case "${flag}" in + c) i=${OPTARG};; #cores: 1, 2, 4, 8, 16 + esac +done + +if [[ ! "$i" =~ ^(1|2|4|8|16)$ ]]; then + echo 'Invalid parameter for argument -c (1, 2, 4, 8, or 16 expected)' + exit 1 +fi + +date=$(date +%Y_%m_%d) +results_dir="../../../evaluation/perf_${date}" +mkdir -p ${results_dir} + +mkdir -p "${results_dir}/${i}c" + +cp "./build_fpga_${i}c/build.log" "${results_dir}/${i}c/build.log" +cp "./build_fpga_${i}c/build/output_files/afu_default.syn.summary" "${results_dir}/${i}c/afu_default.syn.summary" +cp "./build_fpga_${i}c/build/output_files/afu_default.fit.summary" "${results_dir}/${i}c/afu_default.fit.summary" +cp "./build_fpga_${i}c/build/output_files/afu_default.sta.summary" "${results_dir}/${i}c/afu_default.sta.summary" +cp "./build_fpga_${i}c/build/output_files/user_clock_freq.txt" "${results_dir}/${i}c/user_clock_freq.txt" + +../../../ci/blackbox.sh --driver=fpga --app=sgemm --perf > "${results_dir}/${i}c/sgemm.result" +../../../ci/blackbox.sh --driver=fpga --app=vecadd --perf > "${results_dir}/${i}c/vecadd.result" +../../../ci/blackbox.sh --driver=fpga --app=saxpy --perf > "${results_dir}/${i}c/saxpy.result" +../../../ci/blackbox.sh --driver=fpga --app=sfilter --perf > "${results_dir}/${i}c/sfilter.result" +../../../ci/blackbox.sh --driver=fpga --app=nearn --perf > "${results_dir}/${i}c/nearn.result" +../../../ci/blackbox.sh --driver=fpga --app=guassian --perf > "${results_dir}/${i}c/guassian.result" diff --git a/evaluation/scripts/program_fpga.sh b/evaluation/scripts/program_fpga.sh new file mode 100755 index 00000000..1245d37c --- /dev/null +++ b/evaluation/scripts/program_fpga.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +while getopts c: flag +do + case "${flag}" in + c) i=${OPTARG};; #cores: 1, 2, 4, 8, 16 + esac +done + +if [[ ! "$i" =~ ^(1|2|4|8|16)$ ]]; then + echo 'Invalid parameter for argument -c (1, 2, 4, 8, or 16 expected)' + exit 1 +fi + +cd "../../hw/syn/opae/build_fpga_${i}c" + +printf "y\ny\ny\n" | PACSign PR -t UPDATE -H openssl_manager -i vortex_afu.gbs -o vortex_afu_unsigned_ssl.gbs > /dev/null + +fpgasupdate vortex_afu_unsigned_ssl.gbs