Team, I have a working script but when we upgraded some drivers on the GPU system it’s starting to cause zombie process and system is lowing down as script runs periodically as a crib job.
so I am trying to see is there a way I can have a graceful clean up after the Scripts run what is the best procedure to clean up after yourself when Scripts is done running? What wrong am I doing or what better could it be?
gpu-health-check.sh: |
#!/bin/bash
# Do nothing if nvidia-smi is found. This is not a GPU node.
if ! [ -x "$(command -v nvidia-smi)" ]; then
echo "nvidia-smi not found. Ignoring"
exit 0
fi
# Check if there is any retired page. The query is copied from https://docs.nvidia.com/deploy/dynamic-page-retirement/index.html.
bad_gpus=$(nvidia-smi --query-retired-pages=gpu_uuid,retired_pages.address,retired_pages.cause --format=csv,noheader | cut -d, -f1| sort | uniq)
if [ -z "${bad_gpus}" ]; then
echo "No Single/Double Bit ECC Error found"
exit 0
fi
for bad_gpu in "{$bad_gpus}"; do
# Exit 1 if there is a pending page blacklist as we need to reboot the node to actually add the page to the blacklist.
nvidia-smi -i $bad_gpu -q -d PAGE_RETIREMENT | grep Pending| grep Yes > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Found pending blacklist on ${bad_gpu}"
exit 1
fi
echo "No pending blacklist on ${bad_gpu}"
done
exit 0
On gpu system I see
741:19286 ? Z 0:00 [gpu-health-chec] <defunct>
757:30022 ? Z 0:00 [gpu-health-chec] <defunct>
761:31930 ? Z 0:00 [gpu-health-chec] <defunct>
762:31931 ? Z 0:00 [gpu-health-chec] <defunct>
794:37947 ? S 0:00 /bin/bash ./config/gpu-health-check.sh
795:37948 ? S 0:00 /bin/bash ./config/gpu-health-check.sh
796:37955 ? S 0:00 /bin/bash ./config/gpu-health-check.sh
803:37962 ? S 0:00 /bin/bash ./config/gpu-health-check.sh
816:50066 ? Z 0:00 [gpu-health-chec] <defunct>
817:50067 ? Z 0:00 [gpu-health-chec] <defunct>
All above are just piling up. How to avoid coz system is becoming irresponsible after hours.