Skip to content

Commit 7b5a020

Browse files
committed
fixed cpu numbers + advanced options interactions
1 parent 36f6b5d commit 7b5a020

3 files changed

Lines changed: 101 additions & 36 deletions

File tree

frontend/src/assets/data.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ const CPU_DATA : CPUs= {
4949
"Intel Xeon E7-4850 v4": {
5050
"MAKE": INTEL,
5151
"LAUNCH_YEAR": 2016,
52-
"CORE_COUNT": 32,
53-
"THREAD_COUNT": 16,
52+
"CORE_COUNT": 16,
53+
"THREAD_COUNT": 32,
5454
"TDP": 115,
5555
"SORTED_TUPLES_PER_S": 140307773.660298,
5656
"TPCH_RUNS_PER_H": 36.3625,
@@ -65,8 +65,8 @@ const CPU_DATA : CPUs= {
6565
"Intel Xeon Platinum 8180": {
6666
"MAKE": INTEL,
6767
"LAUNCH_YEAR": 2017,
68-
"CORE_COUNT": 56,
69-
"THREAD_COUNT": 28,
68+
"CORE_COUNT": 28,
69+
"THREAD_COUNT": 56,
7070
"TDP": 205,
7171
"SORTED_TUPLES_PER_S": 203679961.220965,
7272
"TPCH_RUNS_PER_H": 81.5934,
@@ -81,8 +81,8 @@ const CPU_DATA : CPUs= {
8181
"Intel Xeon Platinum 8259CL": {
8282
"MAKE": INTEL,
8383
"LAUNCH_YEAR": 2019,
84-
"CORE_COUNT": 48,
85-
"THREAD_COUNT": 24,
84+
"CORE_COUNT": 24,
85+
"THREAD_COUNT": 48,
8686
"TDP": 165,
8787
"SORTED_TUPLES_PER_S": 191378142.90516,
8888
"TPCH_RUNS_PER_H": 88.0331,
@@ -142,6 +142,23 @@ const CPU_DATA : CPUs= {
142142
"SPECINTrate_PER_TDP": 1.37714285714286,
143143
"DIE_SIZE": (2*763) // https://www.techpowerup.com/cpu-specs/xeon-platinum-8570.c3410
144144
},
145+
"AMD EPYC 7451": {
146+
"MAKE": AMD,
147+
"LAUNCH_YEAR": 2017,
148+
"CORE_COUNT": 24,
149+
"THREAD_COUNT": 48,
150+
"TDP": 180,
151+
"SORTED_TUPLES_PER_S": null,
152+
"TPCH_RUNS_PER_H": null,
153+
"SPECINT_RATE": 151,
154+
"SPECINT": 7.16,
155+
"SORTED_TUPLES_PER_JOULE": null,
156+
"TPCH_RUNS_PER_KJOULE": null,
157+
"SPECINT_PER_TDP": 0.03977777777,
158+
"SPECINTrate_PER_TDP": 0.83888888888,
159+
"DIE_SIZE": 213 // https://www.techpowerup.com/cpu-specs/epyc-7601.c1920
160+
},
161+
// -----------------------------------------------------------------------------
145162
"AMD EPYC 7601": {
146163
"MAKE": AMD,
147164
"LAUNCH_YEAR": 2017,

frontend/src/partials/BenchmarkSettings.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { COUNTRY_NAMES } from '../assets/countries.js';
1111
import { ListItem, ListItemWithSearch } from "../utility/ListItems";
1212
import { WORKLOAD_EXPLANATIONS, SCALING_EXPLANATIONS } from "../utility/descriptions";
1313
import UtilizationInput from "../utility/UtilizationInput.js";
14+
import { useEffect } from "react";
1415

1516
export const WORKLOAD_TYPES = ['SPECrate', 'SPECspeed', 'Sorting', 'TPC-H'] as const;
1617
export type WorkloadType = typeof WORKLOAD_TYPES[number];
@@ -94,12 +95,19 @@ function BenchmarkSettings() {
9495
const target = isNew ? newPerformanceIndicator : oldPerformanceIndicator;
9596

9697
const ratio = target / base;
97-
const scaledUtilization = clamp( updates.utilization as number * ratio, 0, 100)
98+
const scaledUtilization = clamp( updates.utilization as number * ratio, 0, 100);
9899

99-
updateServer(otherServer, { utilization: scaledUtilization })
100+
updateServer(otherServer, { utilization: scaledUtilization });
100101
}
101102
}
102103

104+
useEffect(() => {
105+
if (scaling === "Utilization") {
106+
const ratio = newPerformanceIndicator / oldPerformanceIndicator;
107+
const scaledUtilization = clamp( currentServer.utilization as number * ratio, 0, 100);
108+
updateServer(newServer, { utilization: scaledUtilization });
109+
}
110+
}, [scaling])
103111

104112
return (
105113
<div className="flex z-30 flex-col text-medium font-medium flex-wrap px-4 py-2 gap-4">
@@ -157,7 +165,7 @@ return (
157165
/>
158166
</div>
159167
</div>
160-
<div className={`${advancedSettings ? 'h-0' : 'h-96'} duration-300 ease-in-out overflow-hidden relative`}>
168+
<div className={`${advancedSettings ? 'h-96' : 'h-96'} duration-300 ease-in-out overflow-hidden relative`}>
161169
<GeoMap country={country} setCountry={setCountry} />
162170
</div>
163171
</div>

frontend/src/partials/Compare.tsx

Lines changed: 67 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from "react";
1+
import React, { useState, useEffect } from "react";
22
import intel_xeon_logo from "../assets/intel_xeon_logo.png";
33
import CPU_DATA from "../assets/data.ts";
44
import { AMD, CPUEntry, CPUMake } from "./BenchmarkSettings.tsx";
@@ -34,6 +34,31 @@ const getClosestLogo = (launchYear: number | null, make: CPUMake): string => {
3434
return closestYear ? YEAR_LOGOS[closestYear] : intel_xeon_logo;
3535
};
3636

37+
const applyScaledUpdates = (
38+
updates: Partial<ServerType>,
39+
label: string,
40+
NEW_LABEL: string,
41+
oldPerformanceIndicator: number,
42+
newPerformanceIndicator: number
43+
): Partial<ServerType> => {
44+
const isNew = label === NEW_LABEL;
45+
const base = isNew ? oldPerformanceIndicator : newPerformanceIndicator;
46+
const target = isNew ? newPerformanceIndicator : oldPerformanceIndicator;
47+
const ratio = base / target;
48+
49+
const scaleKeys: (keyof Pick<ServerType, 'ssd' | 'ram' | 'hdd'>)[] = ['ssd', 'ram', 'hdd'];
50+
const scaledUpdates: Partial<ServerType> = {};
51+
52+
scaleKeys.forEach((key) => {
53+
const value = updates[key];
54+
if (value == undefined) return;
55+
scaledUpdates[key] = Math.floor(value * ratio);
56+
});
57+
58+
return scaledUpdates;
59+
};
60+
61+
3762
const DISPLAY: Record<string, keyof CPUEntry> = {
3863
Cores: "CORE_COUNT",
3964
Threads: "THREAD_COUNT",
@@ -78,31 +103,48 @@ const Dropdown: React.FC<DropdownProps> = ({ label, thisServer, otherServer, sho
78103
updateServer(thisServer, updates);
79104

80105
if (advancedOptions === 'Mirror') {
81-
updateServer(otherServer, updates);
106+
const { cpu, ...updatesWithoutCPU } = updates;
107+
updateServer(otherServer, updatesWithoutCPU);
82108
return;
83109
}
84110

85111
if (advancedOptions === 'Scale') {
86-
const isNew = label === NEW_LABEL;
87-
const base = isNew ? oldPerformanceIndicator : newPerformanceIndicator;
88-
const target = isNew ? newPerformanceIndicator : oldPerformanceIndicator;
89-
const ratio = base / target;
112+
const scaledUpdates = applyScaledUpdates(
113+
updates,
114+
label,
115+
NEW_LABEL,
116+
oldPerformanceIndicator,
117+
newPerformanceIndicator
118+
);
119+
updateServer(otherServer, scaledUpdates);
120+
return;
121+
}
122+
};
90123

91-
const scaleKeys: (keyof Pick<ServerType, 'ssd' | 'ram' | 'hdd'>)[] = ['ssd', 'ram', 'hdd'];
124+
const cpuLogo = getClosestLogo(specs_selected.LAUNCH_YEAR, specs_selected.MAKE);
92125

93-
const scaledUpdates: Partial<ServerType> = {};
126+
useEffect(() => {
127+
if (label !== NEW_LABEL) return; // only update new cpu
94128

95-
scaleKeys.forEach((key) => {
96-
const value = updates[key];
97-
if (value == undefined) return;
98-
scaledUpdates[key] = Math.floor(value * ratio);
99-
});
129+
if (advancedOptions === 'Scale') {
130+
const scaledUpdates = applyScaledUpdates(
131+
otherServer,
132+
label,
133+
OLD_LABEL, //swap otherwise the scaling goes in the opposite direction
134+
oldPerformanceIndicator,
135+
newPerformanceIndicator
136+
);
137+
updateServer(thisServer, scaledUpdates);
138+
return;
139+
}
100140

101-
updateServer(otherServer, scaledUpdates);
141+
if (advancedOptions === 'Mirror') {
142+
const { cpu, ...updatesWithoutCPU } = otherServer;
143+
updateServer(thisServer, updatesWithoutCPU);
144+
return;
102145
}
103-
};
104146

105-
const cpuLogo = getClosestLogo(specs_selected.LAUNCH_YEAR, specs_selected.MAKE);
147+
}, [advancedOptions])
106148

107149
return (
108150
<div className="col-span-1 z-10 flex flex-col gap-2 font-light relative">
@@ -227,7 +269,15 @@ function Compare() {
227269
<input
228270
type="radio"
229271
name="scalingOption"
230-
value="mirror"
272+
checked={advancedOptions === null}
273+
onChange={() => setAdvancedOptions(null)}
274+
/>
275+
<span>None</span>
276+
</label>
277+
<label className="flex items-center gap-2 cursor-pointer">
278+
<input
279+
type="radio"
280+
name="scalingOption"
231281
checked={advancedOptions === 'Mirror'}
232282
onChange={() => setAdvancedOptions('Mirror')}
233283
/>
@@ -237,21 +287,11 @@ function Compare() {
237287
<input
238288
type="radio"
239289
name="scalingOption"
240-
value="scale"
241290
checked={advancedOptions === 'Scale'}
242291
onChange={() => setAdvancedOptions('Scale')}
243292
/>
244293
<span>Scale Resources</span>
245294
</label>
246-
<label className="flex items-center gap-2 cursor-pointer text-gray-400 italic">
247-
<input
248-
type="radio"
249-
name="scalingOption"
250-
value="other"
251-
disabled
252-
/>
253-
<span>Something else</span>
254-
</label>
255295
</form>
256296
)}
257297
</div>

0 commit comments

Comments
 (0)