From ff70cbdeee7565e22e86aeb08800f5efccf71b81 Mon Sep 17 00:00:00 2001 From: Jiasen Huang Date: Sat, 1 Feb 2025 04:40:28 +0000 Subject: [PATCH 1/2] Generated a copy of SPEC06 src --- scripts/src_copy.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 scripts/src_copy.sh diff --git a/scripts/src_copy.sh b/scripts/src_copy.sh new file mode 100755 index 0000000..205d272 --- /dev/null +++ b/scripts/src_copy.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +echo "SPEC="$SPEC +#SPEC=/www/SPEC2006/cpu2006-1.2 +SPEC_BM=$SPEC/benchspec/CPU2006 +echo "SPEC_BM="$SPEC_BM + +cases=$(find $SPEC_BM -maxdepth 1 -type d -name '[0-9]*' -exec basename {} \;) +echo "$cases" + +# TEST_DIR=/www/CPU2006LiteWrapper/scripts/test_copy_dir +# for case in $cases; do +# mkdir -p $TEST_DIR/$case/src +# echo "Ready to copy $SPEC_BM/$case/src into " +# cp -r $SPEC_BM/$case/src $TEST_DIR/$case + +# if [ "$case" = "400.perlbench" ]; then +# break +# fi +# done + +cur_dir=`pwd` +cd .. +SPEC_LITE=`pwd` +cd $cur_dir +echo "SPEC_LITE="$SPEC_LITE +for case in $cases; do + mkdir -p $SPEC_LITE/$case/src + echo "Ready to copy $SPEC_BM/$case/src into $SPEC_LITE/$case" + cp -r $SPEC_BM/$case/src $SPEC_LITE/$case +done From c86c524934020a7c1bfe83f07bd13320cff8de74 Mon Sep 17 00:00:00 2001 From: Jiasen Huang Date: Wed, 19 Feb 2025 21:13:53 +0800 Subject: [PATCH 2/2] 1. Replaced several hard-coded dir; 2. Set more ENV in env.sh; 3. Added scripts/collect.sh --- Makefile.apps | 2 +- env.sh | 12 ++++++++++++ scripts/collect.sh | 31 +++++++++++++++++++++++++++++++ scripts/src_copy.sh | 4 ++-- 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100755 env.sh create mode 100755 scripts/collect.sh diff --git a/Makefile.apps b/Makefile.apps index 9f67f2c..4e96e46 100644 --- a/Makefile.apps +++ b/Makefile.apps @@ -4,8 +4,8 @@ html: cat Makefile | sed 's/^\([^#]\)/ \1/g' | markdown_py > Makefile.html .PHONY: html - ## 1. Basic Setup and Checks +SPEC=~/dev/SPEC2006/cpu2006-1.2/ ### Default to create elf ifeq ($(MAKECMDGOALS),) diff --git a/env.sh b/env.sh new file mode 100755 index 0000000..346f6e8 --- /dev/null +++ b/env.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +export SPEC=~/dev/SPEC2006/cpu2006-1.2/ +echo "SPEC="$SPEC + +export SPEC_LITE=`pwd` +echo "SPEC_LITE="$SPEC_LITE + +export ARCH=riscv64 +export CROSS_COMPILE=riscv64-unknown-linux-gnu- +echo "ARCH="$ARCH +echo "CROSS_COMPILE"=$CROSS_COMPILE diff --git a/scripts/collect.sh b/scripts/collect.sh new file mode 100755 index 0000000..afc12c0 --- /dev/null +++ b/scripts/collect.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +if [ "$#" -ne 1 ]; then + echo "Illegal number of parameters" + exit +fi + +toolchain_name=$1 + +# Create a directory to store the build results +mkdir -p cpu2006_build + +# Loop over the build directories found by the find command +find . -name "build" | while read build_dir; do + # Extract benchmark name using string manipulation (removing the initial number and dot) + benchmark_name=$(basename $(dirname "$build_dir") | sed 's/^[0-9]*\.//') + + # Construct the desired name for the target file + new_name="${benchmark_name}_base.${toolchain_name}" + + # Identify the target file. We're assuming it's the only non-directory item directly under the build directory. + target_file=$(find "$build_dir" -maxdepth 1 -type f ! -name "*.log") + + # If target_file isn't empty, copy it to the cpu2006_build directory with the new name + if [ -n "$target_file" ]; then + echo copying $target_file to cpu2006_build/$new_name + cp "$target_file" "cpu2006_build/$new_name" + fi +done + + diff --git a/scripts/src_copy.sh b/scripts/src_copy.sh index 205d272..e313fbc 100755 --- a/scripts/src_copy.sh +++ b/scripts/src_copy.sh @@ -1,14 +1,14 @@ #!/bin/bash echo "SPEC="$SPEC -#SPEC=/www/SPEC2006/cpu2006-1.2 +#SPEC=~/dev/SPEC2006/cpu2006-1.2 SPEC_BM=$SPEC/benchspec/CPU2006 echo "SPEC_BM="$SPEC_BM cases=$(find $SPEC_BM -maxdepth 1 -type d -name '[0-9]*' -exec basename {} \;) echo "$cases" -# TEST_DIR=/www/CPU2006LiteWrapper/scripts/test_copy_dir +# TEST_DIR=~/dev/checkpoint/CPU2006LiteWrapper/scripts/test_copy_dir # for case in $cases; do # mkdir -p $TEST_DIR/$case/src # echo "Ready to copy $SPEC_BM/$case/src into "