-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make iguane script packageable * Create module iguane Move iguane script into iguane/__main__.py Add a test to check RGUs * Move RAWDATA into a TOML file and import it. * Move FOM functions into dedicated module `fom` * Update pyproject * Update README * Add comments Re-organise imports in test * Use `read_text()` to import resource
- Loading branch information
1 parent
a4fd850
commit 96f9476
Showing
12 changed files
with
425 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import importlib.resources | ||
import json | ||
import re | ||
try: | ||
import tomllib | ||
except ModuleNotFoundError: | ||
# for Python before 3.11 | ||
import pip._vendor.tomli as tomllib | ||
|
||
|
||
# Import RAWDATA (a dictionary mapping GPU name to GPU flops and data) from a resource file | ||
RAWDATA = tomllib.loads(importlib.resources.read_text("iguane", "rawdata.toml")) | ||
|
||
|
||
UGR_VERSIONS = { | ||
# v1.0 is equivalent to UGR | ||
# https://docs.alliancecan.ca/wiki/Allocations_and_compute_scheduling | ||
"1.0": { 'fp16': 1.6, 'fp32': 1.6, 'memgb': 0.8 }, | ||
"1.0-renorm": { 'fp16': 0.4, 'fp32': 0.4, 'memgb': 0.2 }, | ||
} | ||
|
||
|
||
def fom(f): | ||
globals().setdefault('FOM', {}) | ||
assert f.__name__.startswith('fom_') and f.__name__ != 'fom_', \ | ||
'Figure-of-Merit function names must start with "fom_"!' | ||
FOM[f.__name__[4:]] = f | ||
return f | ||
|
||
|
||
|
||
@fom | ||
def fom_count(name, *, args=None): | ||
return 1 | ||
|
||
|
||
@fom | ||
def fom_fp16(name, *, args=None): | ||
data = RAWDATA[name] | ||
return data['fp16'] or data['fp32'] | ||
|
||
|
||
@fom | ||
def fom_fp32(name, *, args=None): | ||
return RAWDATA[name]['fp32'] | ||
|
||
|
||
@fom | ||
def fom_fp64(name, *, args=None): | ||
return RAWDATA[name]['fp64'] | ||
|
||
|
||
@fom | ||
def fom_tf32(name, *, args=None): | ||
data = RAWDATA[name] | ||
return data['tf32'] or data['fp32'] | ||
|
||
|
||
@fom | ||
def fom_ugr(name, *, args=None): | ||
weights = UGR_VERSIONS[args.ugr_version if args else "1.0"] | ||
ref = RAWDATA['A100-SXM4-40GB'] | ||
data = RAWDATA[name].copy() | ||
data['tf32'] = data['tf32'] or data['fp32'] | ||
data['fp16'] = data['fp16'] or data['fp32'] | ||
return sum([w * (data[k] / ref[k]) for k, w in weights.items()]) | ||
|
||
|
||
@fom | ||
def fom_iguane(name, *, args=None): | ||
ref = RAWDATA['A100-SXM4-80GB'] | ||
data = RAWDATA[name].copy() | ||
data['tf32'] = data['tf32'] or data['fp32'] | ||
data['fp16'] = data['fp16'] or data['fp32'] | ||
weight_fp16 = 0.2 | ||
weight_fp32 = 0.2 | ||
weight_tf32 = 0.2 | ||
weight_memgb = 0.2 | ||
weight_membw = 0.2 | ||
return weight_fp16 * (data['fp16'] / ref['fp16']) + \ | ||
weight_fp32 * (data['fp32'] / ref['fp32']) + \ | ||
weight_tf32 * (data['tf32'] / ref['tf32']) + \ | ||
weight_memgb * (data['memgb'] / ref['memgb']) + \ | ||
weight_membw * (data['membw'] / ref['membw']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# TFLOPS TFLOPS TFLOPS TFLOPS GB GB/s W Release Date | ||
K80 = {fp16= false, fp32= 4.368000, fp64= 1.456000, tf32= false, memgb= 12, membw= 240, tdp=150, reldate="2014-11-17"} | ||
M40 = {fp16= false, fp32= 6.844416, fp64= 0.213888, tf32= false, memgb= 12, membw= 288, tdp=250, reldate="2015-11-10"} | ||
P100-PCIe-12GB = {fp16= 18.679808, fp32= 9.339904, fp64= 4.669952, tf32= false, memgb= 12, membw= 549, tdp=250, reldate="2016-06-20"} | ||
P100-PCIe-16GB = {fp16= 18.679808, fp32= 9.339904, fp64= 4.669952, tf32= false, memgb= 16, membw= 732, tdp=250, reldate="2016-06-20"} | ||
P100-SXM2-16GB = {fp16= 21.217280, fp32=10.608640, fp64= 5.304320, tf32= false, memgb= 16, membw= 732, tdp=300, reldate="2016-04-05"} | ||
V100-PCIe-16GB = {fp16=112.230400, fp32=14.028800, fp64= 7.014400, tf32= false, memgb= 16, membw= 900, tdp=250, reldate="2017-06-21"} | ||
V100-PCIe-32GB = {fp16=112.230400, fp32=14.028800, fp64= 7.014400, tf32= false, memgb= 32, membw= 900, tdp=250, reldate="2018-03-27"} | ||
V100-SXM2-16GB = {fp16=125.337600, fp32=15.667200, fp64= 7.833600, tf32= false, memgb= 16, membw= 900, tdp=300, reldate="2017-05-10"} | ||
V100-SXM2-32GB = {fp16=125.337600, fp32=15.667200, fp64= 7.833600, tf32= false, memgb= 32, membw= 900, tdp=300, reldate="2018-03-27"} | ||
V100S-PCIe-32GB = {fp16=130.826240, fp32=16.353280, fp64= 8.176640, tf32= false, memgb= 32, membw=1134, tdp=250, reldate="2019-11-26"} | ||
RTX-2080 = {fp16= 80.547840, fp32=10.068480, fp64= 0.314640, tf32= false, memgb= 8, membw= 448, tdp=215, reldate="2018-09-20"} | ||
RTX-2080-Super = {fp16= 89.210880, fp32=11.151360, fp64= 0.348480, tf32= false, memgb= 8, membw= 496, tdp=250, reldate="2019-07-23"} | ||
RTX-2080-Ti = {fp16=107.581440, fp32=13.447680, fp64= 0.420240, tf32= false, memgb= 11, membw= 616, tdp=250, reldate="2018-09-27"} | ||
TITAN-RTX = {fp16=130.498560, fp32=16.312320, fp64= 0.509760, tf32= false, memgb= 24, membw= 672, tdp=280, reldate="2018-12-18"} | ||
T4 = {fp16= 65.126400, fp32= 8.140800, fp64= 0.254400, tf32= false, memgb= 16, membw= 300, tdp= 70, reldate="2018-09-12"} | ||
RTX8000 = {fp16=130.498560, fp32=16.312320, fp64= 0.509760, tf32= false, memgb= 48, membw= 672, tdp=260, reldate="2018-08-13"} | ||
A100-PCIe-40GB = {fp16=311.869440, fp32=19.491840, fp64= 9.745920, tf32=155.934720, memgb= 40, membw=1555, tdp=250, reldate="2020-05-14"} | ||
A100-PCIe-80GB = {fp16=311.869440, fp32=19.491840, fp64= 9.745920, tf32=155.934720, memgb= 80, membw=1555, tdp=250, reldate="2021-06-28"} | ||
A100-SXM4-40GB = {fp16=311.869440, fp32=19.491840, fp64= 9.745920, tf32=155.934720, memgb= 40, membw=1555, tdp=400, reldate="2020-05-14"} | ||
A100-SXM4-80GB = {fp16=311.869440, fp32=19.491840, fp64= 9.745920, tf32=155.934720, memgb= 80, membw=1555, tdp=400, reldate="2020-11-16"} | ||
A5000 = {fp16=111.083520, fp32=27.770880, fp64= 0.433920, tf32= 55.541760, memgb= 24, membw= 768, tdp=230, reldate="2021-04-12"} | ||
A6000 = {fp16=154.828800, fp32=38.707200, fp64= 0.604800, tf32= 77.414400, memgb= 48, membw= 768, tdp=300, reldate="2020-10-05"} | ||
RTX-4080 = {fp16=194.949120, fp32=48.737280, fp64= 0.761520, tf32= 97.474560, memgb= 16, membw= 717, tdp=320, reldate="2022-11-16"} | ||
RTX-4080-Super = {fp16=208.896000, fp32=52.224000, fp64= 0.816000, tf32=104.448000, memgb= 16, membw= 736, tdp=425, reldate="2024-01-31"} | ||
RTX-4090-Laptop = {fp16=200.785920, fp32=50.196480, fp64= 0.784320, tf32=100.392960, memgb= 16, membw= 576, tdp=150, reldate="2023-02-08"} | ||
RTX-4090 = {fp16=330.301440, fp32=82.575360, fp64= 1.290240, tf32=165.150720, memgb= 24, membw=1008, tdp=450, reldate="2022-10-12"} | ||
L40S = {fp16=366.428160, fp32=91.607040, fp64= 1.431360, tf32=183.214080, memgb= 48, membw= 864, tdp=350, reldate="2023-08-08"} | ||
H100-PCIe-80GB = {fp16=756.449280, fp32=51.217920, fp64=25.608960, tf32=378.224640, memgb= 80, membw=2039, tdp=350, reldate="2022-03-22"} | ||
H100-SXM5-80GB = {fp16=989.429760, fp32=66.908160, fp64=33.454080, tf32=494.714880, memgb= 80, membw=3352, tdp=700, reldate="2022-03-22"} | ||
H100-NVL-94GB = {fp16=835.500000, fp32=60.000000, fp64=30.000000, tf32=417.250000, memgb= 94, membw=3938, tdp=400, reldate="2023-03-21"} |
Oops, something went wrong.