Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypertool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Research Labs
HYPER-AI Project
hypertool
Commits
4799058b
Commit
4799058b
authored
2 weeks ago
by
Syed Mafooq Ull Hassan
Browse files
Options
Downloads
Patches
Plain Diff
Feat#3: Fixed L3 cache parsing and added FLOPs annotation
parent
433f1aed
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/hypertool/utils.py
+23
-14
23 additions, 14 deletions
src/hypertool/utils.py
with
23 additions
and
14 deletions
src/hypertool/utils.py
+
23
−
14
View file @
4799058b
...
...
@@ -143,17 +143,26 @@ def extract_cpu_features():
elif
"
CPU max MHz
"
in
line
:
features
[
"
Clock (GHz)
"
]
=
round
(
float
(
line
.
split
(
"
:
"
)[
1
].
strip
())
/
1000
,
2
)
elif
"
L3 cache
"
in
line
:
value
=
line
.
split
(
"
:
"
)[
1
].
strip
()
if
value
.
endswith
(
"
K
"
):
features
[
"
L3_Cache
"
]
=
round
(
int
(
value
[:
-
1
])
/
1024
,
2
)
elif
value
.
endswith
(
"
M
"
):
features
[
"
L3_Cache
"
]
=
float
(
value
[:
-
1
])
else
:
features
[
"
L3_Cache
"
]
=
0.0
features
.
setdefault
(
"
Cores
"
,
os
.
cpu_count
()
or
4
)
features
.
setdefault
(
"
Clock (GHz)
"
,
2.5
)
features
.
setdefault
(
"
L3_Cache
"
,
8.0
)
value
=
line
.
split
(
"
:
"
)[
1
].
strip
().
split
()[
0
]
# take first numeric part
value
=
re
.
sub
(
r
"
[^\d.]
"
,
""
,
value
)
# keep digits and dot only
try
:
features
[
"
L3_Cache
"
]
=
float
(
value
)
except
ValueError
:
features
[
"
L3_Cache
"
]
=
8.0
# fallback
features
.
setdefault
(
"
Cores
"
,
os
.
cpu_count
()
or
4
)
# Use actual core count or 4 core median configuration
features
.
setdefault
(
"
Clock (GHz)
"
,
2.5
)
# Conservative estimate for modern CPUs (average clock rate between AMD and Intel CPUs)
features
.
setdefault
(
"
L3_Cache
"
,
8.0
)
# Typical L3 cache size for mid-tier CPUs
# Fallback Values Justification:
# ------------------------------
# Cores: 4 — Median logical core count for laptops, desktops, and cloud VMs
# Clock: 2.5 GHz — Conservative base frequency across modern CPUs
# L3 Cache: 8.0 MB — Common shared L3 cache size in mid-range CPUs
# These defaults ensure realistic performance estimation without exaggeration
# in case of parsing or access errors.
return
features
except
Exception
as
e
:
...
...
@@ -197,7 +206,7 @@ def get_energy_efficiency_annotation():
cpu_model
=
get_cpu_model
()
tdp
=
get_tdp
(
cpu_model
)
if
not
tdp
:
return
{
"
hyperai.eu/node-energy-efficiency
"
:
"
unknown
"
}
return
{
"
hyperai.eu/node-energy-efficiency
"
:
"
unknown
"
,
"
hyperai.eu/node-flops-per-sec
"
:
"
unknown
"
}
a
=
np
.
random
.
rand
(
1_000_000
).
astype
(
np
.
float32
)
b
=
np
.
random
.
rand
(
1_000_000
).
astype
(
np
.
float32
)
...
...
@@ -220,8 +229,8 @@ def get_energy_efficiency_annotation():
else
:
label
=
"
very high
"
return
{
"
hyperai.eu/node-energy-efficiency
"
:
label
}
return
{
"
hyperai.eu/node-energy-efficiency
"
:
label
,
"
hyperai.eu/node-flops-per-sec
"
:
round
(
flops_per_sec
,
2
)
}
except
Exception
as
e
:
logging
.
error
(
f
"
Failed energy estimation:
{
e
}
"
)
return
{
"
hyperai.eu/node-energy-efficiency
"
:
"
unknown
"
}
return
{
"
hyperai.eu/node-energy-efficiency
"
:
"
unknown
"
,
"
hyperai.eu/node-flops-per-sec
"
:
"
unknown
"
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment