Optimal way to monitor GPU memory usage during distributed training (XGBoost)

How to efficiently monitor GPU usage without a dashboard? would this be a good source of info and applicable to my scenario for memory usage tracking using logger.info , or is there anything else that someone could point me to for this scenario?