-
-
Save aditrades/356adead6ba4fb778aaa3372ba2ba467 to your computer and use it in GitHub Desktop.
CloudWatch metrics for GPU on EC2 G3 instance
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
#!/bin/bash | |
IFS=', ' read -r -a STATS <<< `nvidia-smi --query-gpu=temperature.gpu,memory.used,memory.free,utilization.gpu,utilization.memory --format=csv,nounits,noheader` | |
#echo ${STATS[@]} | |
# Send values to CloudWatch | |
aws cloudwatch put-metric-data --metric-name Temperature --namespace GPUStats --value ${STATS[0]} | |
aws cloudwatch put-metric-data --metric-name MemoryUsed --namespace GPUStats --unit Megabytes --value ${STATS[1]} | |
aws cloudwatch put-metric-data --metric-name MemoryFree --namespace GPUStats --unit Megabytes --value ${STATS[2]} | |
aws cloudwatch put-metric-data --metric-name GPUUtilization --namespace GPUStats --value ${STATS[3]} | |
aws cloudwatch put-metric-data --metric-name MemoryUtilization --namespace GPUStats --value ${STATS[4]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment