Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import pandas as pd
|
| 4 |
+
|
| 5 |
+
GPU_TFLOPS_NONSPARSE = dict(
|
| 6 |
+
rtx_3070=40.6,
|
| 7 |
+
rtx_3070_ti=43.5,
|
| 8 |
+
rtx_3080_mobile=30,
|
| 9 |
+
rtx_3080=59.5,
|
| 10 |
+
rtx_3090=71,
|
| 11 |
+
rtx_4070=58.3,
|
| 12 |
+
rtx_4070_ti=80.2,
|
| 13 |
+
rtx_4080=97.5,
|
| 14 |
+
rtx_4090=165.2,
|
| 15 |
+
rtx_5070=61.7,
|
| 16 |
+
rtx_5070_ti=87.9,
|
| 17 |
+
rtx_5080=112.6,
|
| 18 |
+
rtx_5090=209.5,
|
| 19 |
+
|
| 20 |
+
rtx_a6000=154.8,
|
| 21 |
+
rtx_6000_ada=364,
|
| 22 |
+
rtx_6000_blackwell_max_q=438.9,
|
| 23 |
+
rtx_6000_blackwell=503.8,
|
| 24 |
+
|
| 25 |
+
a100=312,
|
| 26 |
+
h100_sxm5=1000,
|
| 27 |
+
h100_pcie=800,
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
# === Categorization rules ===
|
| 31 |
+
categories = {
|
| 32 |
+
# consumer RTX cards (30xx/40xx/50xx series, including mobile)
|
| 33 |
+
"consumer_rtx": [
|
| 34 |
+
k for k in GPU_TFLOPS_NONSPARSE
|
| 35 |
+
if any(x in k for x in ["3070", "3080", "3090", "4070", "4080", "4090", "5070", "5080", "5090"])
|
| 36 |
+
],
|
| 37 |
+
# workstation 6000 family (A6000, Ada, Blackwell variants)
|
| 38 |
+
"workstation_6000": [k for k in GPU_TFLOPS_NONSPARSE if "6000" in k],
|
| 39 |
+
# datacenter accelerators
|
| 40 |
+
"datacenter": [k for k in GPU_TFLOPS_NONSPARSE if any(x in k for x in ["a100", "h100"])],
|
| 41 |
+
}
|
| 42 |
+
# === Formatting function ===
|
| 43 |
+
def prettify_name(key: str) -> str:
|
| 44 |
+
"""Convert internal GPU key names to human-friendly titles."""
|
| 45 |
+
name = key.replace("_", " ").upper()
|
| 46 |
+
name = re.sub(r"RTX A", "RTX A", name)
|
| 47 |
+
name = name.replace("TI", "Ti")
|
| 48 |
+
# Title case except GPU model identifiers (keep uppercase RTX/A/H)
|
| 49 |
+
name = " ".join(word.capitalize() if not word.startswith(("RTX", "A", "H")) else word for word in name.split())
|
| 50 |
+
name = name.replace("Max Q", "Max-Q")
|
| 51 |
+
name = name.replace("Pcie", "PCIe")
|
| 52 |
+
|
| 53 |
+
name = name.replace("Smx5", "SXM5")
|
| 54 |
+
return name
|
| 55 |
+
|
| 56 |
+
def make_df(filtered_dict: dict) -> pd.DataFrame:
|
| 57 |
+
df = pd.DataFrame(
|
| 58 |
+
[(prettify_name(k), v) for k, v in filtered_dict.items()],
|
| 59 |
+
columns=["GPU", "TFLOPS (non-sparse)"]
|
| 60 |
+
)
|
| 61 |
+
return df.sort_values(by="TFLOPS (non-sparse)", ascending=False, ignore_index=True)
|
| 62 |
+
|
| 63 |
+
def filter_table(hide_consumer: bool, hide_workstation: bool, hide_datacenter: bool) -> pd.DataFrame:
|
| 64 |
+
data = GPU_TFLOPS_NONSPARSE.copy()
|
| 65 |
+
|
| 66 |
+
if hide_consumer:
|
| 67 |
+
for key in categories["consumer_rtx"]:
|
| 68 |
+
data.pop(key, None)
|
| 69 |
+
if hide_workstation:
|
| 70 |
+
for key in categories["workstation_6000"]:
|
| 71 |
+
data.pop(key, None)
|
| 72 |
+
if hide_datacenter:
|
| 73 |
+
for key in categories["datacenter"]:
|
| 74 |
+
data.pop(key, None)
|
| 75 |
+
|
| 76 |
+
return make_df(data)
|
| 77 |
+
|
| 78 |
+
DEFAULT_DF = filter_table(False, False, False)
|
| 79 |
+
|
| 80 |
+
with gr.Blocks() as demo:
|
| 81 |
+
gr.Markdown("# BF16 GPU TFLOPS Viewer\nToggle categories to hide/show entries.\nWhen calculating the 'usable' TFLOPs of a particular card, these are what we call non-sparse TFLOPs. Below contains data gathered for the most commonly used CUDA cards and their BF16 with FP32 accum (what we use in PyTorch) values")
|
| 82 |
+
|
| 83 |
+
with gr.Row():
|
| 84 |
+
hide_consumer = gr.Checkbox(label="Hide Consumer RTX", value=False)
|
| 85 |
+
hide_workstation = gr.Checkbox(label="Hide Professional Workstation (6000)", value=False)
|
| 86 |
+
hide_datacenter = gr.Checkbox(label="Hide Datacenter Cards", value=False)
|
| 87 |
+
|
| 88 |
+
table = gr.Dataframe(
|
| 89 |
+
value=DEFAULT_DF,
|
| 90 |
+
headers=["GPU", "TFLOPS (non-sparse)"],
|
| 91 |
+
datatype=["str", "number"],
|
| 92 |
+
interactive=False,
|
| 93 |
+
wrap=True,
|
| 94 |
+
max_height=1000
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
for cb in (hide_consumer, hide_workstation, hide_datacenter):
|
| 98 |
+
cb.change(
|
| 99 |
+
fn=filter_table,
|
| 100 |
+
inputs=[hide_consumer, hide_workstation, hide_datacenter],
|
| 101 |
+
outputs=table
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
demo.load(fn=filter_table, inputs=[hide_consumer, hide_workstation, hide_datacenter], outputs=table)
|
| 105 |
+
|
| 106 |
+
if __name__ == "__main__":
|
| 107 |
+
demo.launch()
|