Last active
July 8, 2020 09:51
-
-
Save adujardin/00ff263a089d288df4b30fd39ff69e09 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://spin.atomicobject.com/2017/08/24/start-stop-bash-background-process/ | |
trap "kill 0" EXIT | |
# For jetsons | |
if [ "$(arch)" == "aarch64" ]; then | |
nvpmodel_maxn_mode=0 | |
if [ -e "/proc/device-tree/compatible" ]; then | |
if [ -e "/proc/device-tree/model" ]; then | |
machine="$(tr -d '\0' < /proc/device-tree/model)" | |
fi | |
#CHIP="$(tr -d '\0' < /proc/device-tree/compatible)" | |
#if [[ "${CHIP}" =~ "tegra194" ]]; then | |
# # NX | |
# nvpmodel_maxn_mode=2 | |
#fi | |
if [[ $machine == *"Xavier NX"* ]]; then | |
nvpmodel_maxn_mode=2 | |
fi | |
fi | |
echo "$machine detected" | |
sudo nvpmodel -m $nvpmodel_maxn_mode | |
sudo jetson_clocks | |
sudo nvpmodel -q | |
fi | |
## Setup | |
if ! [ -x "$(command -v stress)" ]; then | |
sudo apt update ; sudo apt install stress -y | |
fi | |
if ! [ -x "$(command -v g++)" ]; then | |
sudo apt update ; sudo apt install build-essential -y | |
fi | |
if [ ! -d "/usr/local/bin/gpu-burn/" ]; then | |
cd /tmp | |
git clone https://github.com/adujardin/gpu-burn.git | |
cd gpu-burn ; make ; cd .. ; sudo cp -R gpu-burn /usr/local/bin/ | |
fi | |
## Run Bench | |
# GPU (CUDA) | |
cd /usr/local/bin/gpu-burn/ | |
./gpu_burn 3000000 & | |
# CPU | |
stress -c $(nproc) & | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment