-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathcommon.py
More file actions
20 lines (16 loc) · 776 Bytes
/
common.py
File metadata and controls
20 lines (16 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""Common testing setup"""
import os
import unittest
import subprocess
def getAcceleratorName():
try:
deviceName = subprocess.check_output(['nvidia-smi', '--query-gpu=name', '--format=csv,noheader'])
return deviceName.decode('utf-8').strip()
except FileNotFoundError:
return("nvidia-smi not found.")
def isGPU():
return os.path.isfile('/proc/driver/nvidia/version')
gpu_test = unittest.skipIf(not isGPU(), 'Not running GPU tests')
# b/342143152 P100s are slowly being unsupported in new release of popular ml tools such as RAPIDS.
p100_exempt = unittest.skipIf(getAcceleratorName() == "Tesla P100-PCIE-16GB", 'Not running p100 exempt tests')
tpu_test = unittest.skipIf(len(os.environ.get('ISTPUVM', '')) == 0, 'Not running TPU tests')