Last active
September 27, 2019 03:10
-
-
Save juniorprincewang/f667b7922427645851dff92f0ce8f55d to your computer and use it in GitHub Desktop.
CUDA MPS start and stop script
This file contains 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
#!/bin/bash | |
# the following must be performed with root privilege | |
helpFuction() | |
{ | |
echo "" | |
echo "Usage: $0 device_id" | |
echo -e "\t device_id is the id of nvidia device from what nvidia-smi displays" | |
exit 1 | |
} | |
if [ -z $1 ]; | |
then | |
helpFuction | |
fi | |
echo "Set Device $1" | |
export CUDA_VISIBLE_DEVICES="$1" | |
nvidia-smi -i "$1" -c EXCLUSIVE_PROCESS | |
nvidia-cuda-mps-control -d |
This file contains 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
#!/bin/bash | |
# the following must be performed with root privilege | |
helpFuction() | |
{ | |
echo "" | |
echo "Usage: $0 device_id" | |
echo -e "\t device_id is the id of nvidia device from what nvidia-smi displays" | |
exit 1 | |
} | |
if [ -z $1 ]; | |
then | |
helpFuction | |
fi | |
echo "Set Device $1" | |
echo quit | nvidia-cuda-mps-control | |
nvidia-smi -i "$1" -c DEFAULT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment