Skip to content

Commit

Permalink
Merge branch 'main' of github.com:CentML/skyline-vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelshin committed Jun 1, 2023
2 parents f522f44 + b684f2a commit 7ce3b9e
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-vsix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
RELEASE_NOTES="$(git log $(git describe --abbrev=0 --tags --always).. --merges --pretty=format:"%s %b" | cut -f 4,7- -d ' ')"
echo "Autogenerated Release Notes:"
echo "$RELEASE_NOTES"
RELEASE_ARTIFACTS=$(find ./dist -name "*${{ github.event.inputs.tag }}*" -type f | paste -s -d ' ' - )
RELEASE_ARTIFACTS=$(find ./deepview-explore -name "*${{ github.event.inputs.tag }}.vsix" -type f | paste -s -d ' ' - )
VERSION_TAG="v${{ github.event.inputs.tag }}"
gh auth login --with-token <<< "${{ secrets.GH_TOKEN }}"
gh release create "$VERSION_TAG" \
Expand Down
106 changes: 66 additions & 40 deletions deepview-explore/react-ui/src/utils/utils.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
const GPU_POWER = {
MIN_WATTS: {
"k520": 26,
"a10g": 18,
"t4": 8,
"m60": 35,
"k80": 35,
"v100": 35,
"a100": 46,
"p4": 9,
"p100": 36
},
k520: 26,
a10g: 18,
t4: 8,
m60: 35,
k80: 35,
v100: 35,
a100: 46,
p4: 9,
p100: 36,
},
MAX_WATTS: {
"k520": 229,
"a10g": 156,
"t4": 71,
"m60": 306,
"k80": 306,
"v100": 306,
"a100": 107,
"p4": 76.5,
"p100": 306
}
}
k520: 229,
a10g: 156,
t4: 71,
m60: 306,
k80: 306,
v100: 306,
a100: 107,
p4: 76.5,
p100: 306,
},
};

const BYTE_UNITS = ["B", "KB", "MB", "GB"];

Expand Down Expand Up @@ -143,7 +143,6 @@ export function scalePercentages({ scaleSelector, shouldScale, applyFactor }) {
}

export function getTraceByLevel(tree) {
console.log("getTraceByLevel");
var tree_size = function (idx) {
let total = 1;
let num_children = tree[idx]["num_children"];
Expand All @@ -152,25 +151,44 @@ export function getTraceByLevel(tree) {
tree[idx + total]["parent"] = tree[idx];
total += tree_size(idx + total);
}
return (tree[idx]["total"] = total);
};

var total_time = tree[0]["forward_ms"] + tree[0]["backward_ms"];
var min_frac = 0.5;

var pick_expand = function (idx, expanded) {
let total = 1;
let num_children = tree[idx]["num_children"];

let node_time = tree[idx]["forward_ms"] + tree[idx]["backward_ms"];
let expand = true;
if (expanded || node_time > total_time * min_frac) {
expand = false;
}

tree[idx]["expand"] = expand;

for (let i = 0; i < num_children; i++) {
pick_expand(idx + total, expand | expanded);
total += tree[idx + total]["total"];
}
return total;
};

tree[0]["depth"] = 0;
tree_size(0);
pick_expand(0, false);

let coarseDecomposition = tree.filter((node) => {
return node["depth"] === 1;
});
for (let fineLevel = 1; ; fineLevel++) {
let fineDecomposition = tree.filter((node) => {
return node["depth"] === fineLevel;
});
console.log(`fineLevel: ${fineLevel}, length: ${fineDecomposition.length}`);
if (fineDecomposition.length === 0)
return { coarse: coarseDecomposition, fine: coarseDecomposition };
if (fineDecomposition.length >= 7)
return { coarse: coarseDecomposition, fine: fineDecomposition };
}

let fineDecomposition = tree.filter((node) => {
return node["expand"];
});

return { coarse: coarseDecomposition, fine: fineDecomposition };
}

export function computePercentage(operations, total_time) {
Expand Down Expand Up @@ -239,13 +257,21 @@ export function calculate_training_time(numIterations, instance) {
}

function getGPUAvgPower(gpuName) {
return (GPU_POWER.MAX_WATTS[gpuName] - GPU_POWER.MIN_WATTS[gpuName]) * 0.5 + GPU_POWER.MIN_WATTS[gpuName];
return (
(GPU_POWER.MAX_WATTS[gpuName] - GPU_POWER.MIN_WATTS[gpuName]) * 0.5 +
GPU_POWER.MIN_WATTS[gpuName]
);
}

export function getCarbonDataOfInstance(time, instance, cloudProvider) {
let carbonData = [];
for (let index = 0; index < instance.regions.length; index++) {
let instanceCarbonEmissions = getGPUAvgPower(instance.info.gpu) * instance.info.ngpus * time * cloudProvider.regions[instance.regions[index]].emissionsFactor * cloudProvider.pue;
let instanceCarbonEmissions =
getGPUAvgPower(instance.info.gpu) *
instance.info.ngpus *
time *
cloudProvider.regions[instance.regions[index]].emissionsFactor *
cloudProvider.pue;
const miles = unitScale(
instanceCarbonEmissions * ENERGY_CONVERSION_UNITS["miles"],
"generic"
Expand All @@ -262,11 +288,11 @@ export function getCarbonDataOfInstance(time, instance, cloudProvider) {
carbonEmissions: instanceCarbonEmissions,
miles: `${miles.val} ${miles.scale}`,
household: household,
phone: `${phone.val} ${phone.scale}`
phone: `${phone.val} ${phone.scale}`,
});
}
carbonData.sort(function(a, b) {
return ((a.carbonEmissions < b.carbonEmissions) ? -1 : ((a.x === b.x) ? 0 : 1));
carbonData.sort(function (a, b) {
return a.carbonEmissions < b.carbonEmissions ? -1 : a.x === b.x ? 0 : 1;
});
return carbonData;
}
Expand Down Expand Up @@ -295,12 +321,12 @@ export function getErrMsgFromInvalidURL(type, response) {
case "noJsonResponseFromUrl":
return {
msg: `no json data from url: ${response?.url}`,
code
code,
};
default: // url is not accesible
default: // url is not accesible
return {
msg: `url is not accesible: ${response?.url}`,
code
code,
};
}
}

0 comments on commit 7ce3b9e

Please sign in to comment.