Merge "tests: improve scripts on rocm v2.6, and do more check" into amd-master

[ROCm/rocprofiler commit: 6fa4f1dc66]
This commit is contained in:
Evgeny Shcherbakov
2019-08-23 15:02:06 -04:00
committed by Gerrit Code Review
2 changed files with 29 additions and 10 deletions
@@ -2,6 +2,11 @@
#-- specify the path to your rocprofiler here, ow default one will be used #-- specify the path to your rocprofiler here, ow default one will be used
ROCP_PATH="" ROCP_PATH=""
#-- rocm path
#-- specify the path to rocminfo here, ow default will be used
#-- default path: /opt/rocm/bin, see https://rocm.github.io/install.html
ROCM_PATH=""
#-- benchmark path #-- benchmark path
#-- the one used for cache/mem validation #-- the one used for cache/mem validation
PATH_CACHE_BENCH="benches/test_cache" PATH_CACHE_BENCH="benches/test_cache"
@@ -19,13 +24,22 @@ function initialize
make make
cd ${BASE_DIR}/../ cd ${BASE_DIR}/../
ELEMENT_SIZE=4 ELEMENT_SIZE=4 # element size in bytes of the test array (default: int/4B)
#-- extract TCP parameters from rocminfo if [[ ! -z $ROCM_PATH ]]; then ROCM_PATH=$ROCM_PATH"/"; fi
TCP_SIZE=`rocminfo | grep "L1:" | tail -n1 | awk '{print $NF}'` #-- extract TCP size from rocminfo (delete '(*)' and space)
LINE_SIZE=`rocminfo | grep "Cacheline Size:" | tail -n1 | awk '{print $NF}'` TCP_SIZE=`${ROCM_PATH}rocminfo | grep "L1:" | tail -n1 | \
if [[ $TCP_SIZE == *KB ]]; then TCP_SIZE=`echo "${TCP_SIZE//KB}"`; fi sed 's/\([[:space:]]\|([^)]*)\)//g' | cut -f2 -d':'`
C_tcp=`echo "$TCP_SIZE*1024/$ELEMENT_SIZE" | bc` if [[ $TCP_SIZE != *KB ]]; then
b_tcp=`echo "$LINE_SIZE/$ELEMENT_SIZE" | bc` printf "${RED}ERROR: 'rocminfo' failed to get L1/line sizes ... ${NC}\n"
exit
else
TCP_SIZE=`echo "${TCP_SIZE//KB}"`
fi
#-- extract cache line size from rocminfo (delete '(*)' and space)
LINE_SIZE=`${ROCM_PATH}rocminfo | grep "Cacheline Size:" | tail -n1 | \
sed 's/\([[:space:]]\|([^)]*)\)//g' | cut -f2 -d':'`
C_tcp=$(( $TCP_SIZE*1024/$ELEMENT_SIZE )) # num of items can be held
b_tcp=$(( $LINE_SIZE/$ELEMENT_SIZE )) # num of items in a line
} }
#-- function to list columns in profiling file #-- function to list columns in profiling file
@@ -52,8 +66,13 @@ function getColIds
function checkProfRun function checkProfRun
{ {
rstfile=$1; logfile=$2 rstfile=$1; logfile=$2
if [ ! -f $rstfile ]; then # number of lines in the profiled .csv file (0 by default)
printf "${RED}ERROR: $rstfile not generated. See $logfile ...${NC}\n" nlines=0
if [ -f $rstfile ]; then nlines=`wc -l $rstfile | awk '{ print $1 }'`; fi
# no .csv file generated, or no kernel data collected
if (( $nlines < 2 )); then
printf "\n${RED}ERROR: $rstfile not (correctly) generated. "
printf "See $logfile ...${NC}\n"
exit; exit;
fi fi
} }
@@ -80,7 +80,7 @@ function one_run
$N $s "${M}K" $N $s "${M}K"
${ROCP_PATH}rocprof -i ${BASE_DIR}/../pmc_config_files/cache_pmc.txt -o \ ${ROCP_PATH}rocprof -i ${BASE_DIR}/../pmc_config_files/cache_pmc.txt -o \
${BASE_DIR}/../$rst_file $PATH_CACHE_BENCH/cache $s $N $M \ ${BASE_DIR}/../$rst_file $PATH_CACHE_BENCH/cache $s $N $M \
>> $log_file >> $log_file 2>&1
# check the profiling result # check the profiling result
checkProfRun $rst_file $log_file checkProfRun $rst_file $log_file