diff --git a/projects/rocprofiler/test/memory_validation/run_scripts/global.cfg b/projects/rocprofiler/test/memory_validation/run_scripts/global.cfg index 347be6f85f..be65609a2e 100644 --- a/projects/rocprofiler/test/memory_validation/run_scripts/global.cfg +++ b/projects/rocprofiler/test/memory_validation/run_scripts/global.cfg @@ -2,6 +2,11 @@ #-- 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" @@ -19,13 +24,22 @@ function initialize make cd ${BASE_DIR}/../ - ELEMENT_SIZE=4 - #-- extract TCP parameters from rocminfo - TCP_SIZE=`rocminfo | grep "L1:" | tail -n1 | awk '{print $NF}'` - LINE_SIZE=`rocminfo | grep "Cacheline Size:" | tail -n1 | awk '{print $NF}'` - if [[ $TCP_SIZE == *KB ]]; then TCP_SIZE=`echo "${TCP_SIZE//KB}"`; fi - C_tcp=`echo "$TCP_SIZE*1024/$ELEMENT_SIZE" | bc` - b_tcp=`echo "$LINE_SIZE/$ELEMENT_SIZE" | bc` + 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 @@ -52,8 +66,13 @@ function getColIds function checkProfRun { rstfile=$1; logfile=$2 - if [ ! -f $rstfile ]; then - printf "${RED}ERROR: $rstfile not generated. See $logfile ...${NC}\n" + # 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 } diff --git a/projects/rocprofiler/test/memory_validation/run_scripts/test_cache_miss.sh b/projects/rocprofiler/test/memory_validation/run_scripts/test_cache_miss.sh index 20c25e3c87..89418258a3 100755 --- a/projects/rocprofiler/test/memory_validation/run_scripts/test_cache_miss.sh +++ b/projects/rocprofiler/test/memory_validation/run_scripts/test_cache_miss.sh @@ -80,7 +80,7 @@ function one_run $N $s "${M}K" ${ROCP_PATH}rocprof -i ${BASE_DIR}/../pmc_config_files/cache_pmc.txt -o \ ${BASE_DIR}/../$rst_file $PATH_CACHE_BENCH/cache $s $N $M \ - >> $log_file + >> $log_file 2>&1 # check the profiling result checkProfRun $rst_file $log_file