Skip to content

Instantly share code, notes, and snippets.

@morris821028
Created May 14, 2016 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morris821028/bedc7f19e6e3cc856d3441bd97c07744 to your computer and use it in GitHub Desktop.
Save morris821028/bedc7f19e6e3cc856d3441bd97c07744 to your computer and use it in GitHub Desktop.
CUDA Profiler Script on nVidia Driver
#!/bin/bash
TEXT_RED=`tput setaf 1`
TEXT_GREEN=`tput setaf 2`
TEXT_RESET=`tput sgr0`
CONFIG_FILE=nvvp.cfg
if [ ! -f $CONFIG_FILE ];
then
echo "[ERROR] Profile config file ${TEXT_RED}nvvp.cfg${TEXT_RESET} does not exist."
exit 1
fi
time -p COMPUTE_PROFILE=1 COMPUTE_PROFILE_CONFIG=${CONFIG_FILE} $@
if [ $? -eq 0 ];
then
echo "[INFO] ${TEXT_GREEN}Profiler Successed.${TEXT_RESET}"
else
echo "[ERROR] ${TEXT_RED}Usage: ./nvprof.sh <execute-command>${TEXT_RESET}"
exit 1
fi
cat cuda_profile_*.log > nvvp.log
if [ $? -eq 0 ];
then
echo "[INFO] Create ${TEXT_GREEN}nvvp.log${TEXT_RESET} Successed"
else
echo "[ERROR] Create profile log Fail"
exit 1
fi
rm cuda_profile_*.log
echo "[INFO] Now, use NVVP and import OpenCL profile log."
nvidia-smi
profilelogformat CSV
streamid
gpustarttimestamp
gpuendtimestamp
gridsize
threadblocksize
dynsmemperblock
stasmemperblock
regperthread
memtransfersize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment