chivier commited on
Commit
bb32fa1
1 Parent(s): 81d2a67

sync from github

Browse files
Files changed (1) hide show
  1. src/utils.py +16 -4
src/utils.py CHANGED
@@ -31,6 +31,12 @@ PEAK_FLOPS_DICT = {
31
  "NVIDIA-H100-PCIe-80GB": 1513e12,
32
  "NVIDIA-RTX-A5000-24GB": 444.4e12
33
  },
 
 
 
 
 
 
34
  "8bit":{
35
  "NVIDIA-A100-PCIe-80GB": 1248e12,
36
  "NVIDIA-A100-SXM-80GB": 1248e12,
@@ -92,7 +98,8 @@ def parse_nvidia_smi():
92
  gpu_stats = []
93
 
94
  gpu_info_pattern = re.compile(r'(\d+)C\s+P\d+\s+(\d+)W / \d+W\s+\|\s+(\d+)MiB / \d+MiB\s+\|\s+(\d+)%')
95
- gpu_name_pattern = re.compile(r'NVIDIA\s+([\w\s]+\d+(?:\s*GB)?)')
 
96
 
97
  gpu_name = ""
98
  for index in gpu_indices:
@@ -104,7 +111,7 @@ def parse_nvidia_smi():
104
  name_match = gpu_name_pattern.search(line)
105
  gpu_info = {}
106
  if name_match:
107
- gpu_name = name_match.group(1).strip()
108
  if match:
109
  temp, power_usage, mem_usage, gpu_util = map(int, match.groups())
110
  gpu_info.update({
@@ -208,10 +215,15 @@ def get_gpu_details():
208
  gpus = GPUtil.getGPUs()
209
  gpu = gpus[0]
210
  name = gpu.name.replace(" ", "-")
211
- # Convert memory from MB to GB and round to nearest whole number
212
  memory_gb = round(gpu.memoryTotal / 1024)
213
  memory = f"{memory_gb}GB"
 
 
 
 
 
214
  formatted_name = f"{name}-{memory}"
 
215
  return formatted_name
216
 
217
  def get_peak_bw(gpu_name):
@@ -223,7 +235,7 @@ def get_peak_flops(gpu_name, precision):
223
  def transfer_precision2bytes(precision):
224
  if precision == "float32":
225
  return 4
226
- elif precision == "float16":
227
  return 2
228
  elif precision == "8bit":
229
  return 1
 
31
  "NVIDIA-H100-PCIe-80GB": 1513e12,
32
  "NVIDIA-RTX-A5000-24GB": 444.4e12
33
  },
34
+ "bfloat16":{
35
+ "NVIDIA-A100-PCIe-80GB": 624e12,
36
+ "NVIDIA-A100-SXM-80GB": 624e12,
37
+ "NVIDIA-H100-PCIe-80GB": 1513e12,
38
+ "NVIDIA-RTX-A5000-24GB": 444.4e12
39
+ },
40
  "8bit":{
41
  "NVIDIA-A100-PCIe-80GB": 1248e12,
42
  "NVIDIA-A100-SXM-80GB": 1248e12,
 
98
  gpu_stats = []
99
 
100
  gpu_info_pattern = re.compile(r'(\d+)C\s+P\d+\s+(\d+)W / \d+W\s+\|\s+(\d+)MiB / \d+MiB\s+\|\s+(\d+)%')
101
+ # gpu_name_pattern = re.compile(r'NVIDIA\s+([\w\s]+\d+(?:\s*GB)?)')
102
+ gpu_name_pattern = re.compile(r'NVIDIA\s+(RTX\s+)?([A-Z0-9]+)')
103
 
104
  gpu_name = ""
105
  for index in gpu_indices:
 
111
  name_match = gpu_name_pattern.search(line)
112
  gpu_info = {}
113
  if name_match:
114
+ gpu_name = ''.join(filter(None, name_match.groups())).strip()
115
  if match:
116
  temp, power_usage, mem_usage, gpu_util = map(int, match.groups())
117
  gpu_info.update({
 
215
  gpus = GPUtil.getGPUs()
216
  gpu = gpus[0]
217
  name = gpu.name.replace(" ", "-")
 
218
  memory_gb = round(gpu.memoryTotal / 1024)
219
  memory = f"{memory_gb}GB"
220
+
221
+ for part in name.split('-'):
222
+ if part.endswith("GB") and part[:-2].isdigit():
223
+ name = name.replace(f"-{part}", "").replace(part, "")
224
+
225
  formatted_name = f"{name}-{memory}"
226
+
227
  return formatted_name
228
 
229
  def get_peak_bw(gpu_name):
 
235
  def transfer_precision2bytes(precision):
236
  if precision == "float32":
237
  return 4
238
+ elif precision in ["float16", "bfloat16"]:
239
  return 2
240
  elif precision == "8bit":
241
  return 1