68bf049d49
'rocminfo' output format on v2.6 is slightly different, and thus cache capacity and cache linesize can be incorrectly obtained. Example: 'L1: 16KB' vs. 'L1: 16(0x10) KB'. This patch fixes the formatting issue, and further does more check on profiled .csv file. Change-Id: I934ee3613a79fa8acc431a394e88a9e09833311b
80 líneas
2.4 KiB
INI
80 líneas
2.4 KiB
INI
#-- profiler path
|
|
#-- specify the path to your rocprofiler here, ow default one will be used
|
|
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
|
|
#-- the one used for cache/mem validation
|
|
PATH_CACHE_BENCH="benches/test_cache"
|
|
|
|
#-- colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
NC='\033[0m'
|
|
|
|
#-- function to do some initializations
|
|
function initialize
|
|
{
|
|
cd ${BASE_DIR}/../$PATH_CACHE_BENCH/
|
|
# Build the benchmark
|
|
make
|
|
cd ${BASE_DIR}/../
|
|
|
|
ELEMENT_SIZE=4 # element size in bytes of the test array (default: int/4B)
|
|
if [[ ! -z $ROCM_PATH ]]; then ROCM_PATH=$ROCM_PATH"/"; fi
|
|
#-- extract TCP size from rocminfo (delete '(*)' and space)
|
|
TCP_SIZE=`${ROCM_PATH}rocminfo | grep "L1:" | tail -n1 | \
|
|
sed 's/\([[:space:]]\|([^)]*)\)//g' | cut -f2 -d':'`
|
|
if [[ $TCP_SIZE != *KB ]]; then
|
|
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 getColIds
|
|
{
|
|
local file=$1
|
|
local counterline=`head -n1 $file`
|
|
|
|
IFS=',' read -ra CARR <<< "$counterline"
|
|
local colIds=""
|
|
for srch in $headers
|
|
do
|
|
local colId=1
|
|
for ele in "${CARR[@]}"; do
|
|
if [[ $srch == $ele ]]; then break; fi
|
|
colId=$(( $colId+1 ))
|
|
done
|
|
colIds=$colIds" "$colId"|$srch"
|
|
done
|
|
echo $colIds
|
|
}
|
|
|
|
# check to make sure the profiling file has been generated
|
|
function checkProfRun
|
|
{
|
|
rstfile=$1; logfile=$2
|
|
# number of lines in the profiled .csv file (0 by default)
|
|
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;
|
|
fi
|
|
}
|
|
|