diff -Naur rpm/tests/compatible/gpu/nvidia_gpu.py oech/tests/compatible/gpu/nvidia_gpu.py --- rpm/tests/compatible/gpu/nvidia_gpu.py 2024-08-29 19:48:19.472522063 +0800 +++ oech/tests/compatible/gpu/nvidia_gpu.py 2024-08-30 16:21:51.821261220 +0800 @@ -73,6 +73,11 @@ self.logger.info("Set default test gpu as %s." % id_num) + def clean_default_gpu(self): + if 'CUDA_VISIBLE_DEVICES' in os.environ: + del os.environ['CUDA_VISIBLE_DEVICES'] + self.logger.info("Clean default test gpu.") + def test_pressure(self): """ Set pressure for gpu to test @@ -87,10 +92,7 @@ os.chdir("/opt/gpu-burn") cmd = self.command.run_cmd( - "nvidia-smi -q | grep -i -A1 '%s' | grep 'Product Name' | cut -d ':' -f 2" % pci_num) - device_name = cmd[0].strip() - cmd = self.command.run_cmd( - "./gpu_burn -l | grep -i '%s' | cut -d ':' -f 1 | awk '{print $2}'" % device_name) + "nvidia-smi -q | grep -i -A20 '%s' | grep 'Minor Number' | cut -d ':' -f 2" % pci_num) run_id = cmd[0].strip() cmd = getstatusoutput( 'nohup ./gpu_burn -i%s 10 &> %s &' % (run_id, self.gpu_burn)) @@ -185,6 +187,8 @@ result = False self.logger.error("Test Vulkan failed.") + self.clean_default_gpu() + except Exception as e: self.logger.error( "Failed to run the script because compiling or setting variables: %s" % e)