Commit 19ee9656 authored by Justin Borromeo's avatar Justin Borromeo
Browse files

Remove old file

parent 995128e0
---
title: "Packabilty-Aware Partitioning Results"
author: "Justin Borromeo"
date: "16/11/2020"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library("dplyr")
rm(list = ls())
```
```{r}
linear_results = read.csv('../resulting_csv/cma.csv', header=TRUE, sep=',')
# Filter out squeezenet results
linear_results = filter(linear_results, !grepl('squeeze', topology))
# Filter out infeasible solns
linear_results = filter(linear_results, feasable==1)
head(linear_results)
```
```{r}
# Get linear tp_fullmap and latency_fm for each (topology, partition count),
# aggregate by max tp and min latency. This is imperfect because there's a
# mismatch between trial parameters between linear and square. It's more of a
# ballpark estimate.
fullmap_linear_baseline = linear_results %>%
group_by(topology, partitions) %>%
summarize(max_tp_fm=max(tp_fullmap), min_latency_fm=min(latency_fm))
head(fullmap_linear_baseline)
```
```{r}
packing_results = read.csv('../resulting_csv/cma_logmore_sq_full_evo_packing.csv',
header=FALSE,
sep=',')
names(packing_results) = c('target',
'evo_counter',
'partitions',
'topology',
'feasible',
'tp_partition',
'latency_partition',
'tp_fullmap',
'latency_fm',
'tp_gain',
'latency_penalty',
'best_layer_partition',
'best_resource_partition',
'time_taken',
'sigma',
'seed',
'valid_sampling_percentage',
'trial',
'popsize',
'res_unit',
'seeding_type',
'packing_strategy',
'png_filename')
packing_results = filter(packing_results, feasible==1)
```
```{r}
# Unconstrained infinite bin
packing_results_unconstrained = filter(packing_results, packing_strategy=='unconstrained')
# Greedy partition sizing, no penalty
packing_results_no_penalty = filter(packing_results, packing_strategy=='no_penalty')
# Greedy partition sizing, penalty
packing_results_penalty = filter(packing_results, packing_strategy=='overflow_penalty')
```
Partition latencies for (topology, partition) pairing at max evolution
counter.
```{r}
topologies = distinct(linear_results, topology)$topology
for (topology_name in topologies) {
topology_linear =
filter(linear_results, topology==topology_name)
topology_unconstrained =
filter(packing_results_unconstrained, topology==topology_name)
topology_no_penalty =
filter(packing_results_no_penalty, topology==topology_name)
topology_penalty =
filter(packing_results_penalty, topology==topology_name)
partition_counts = distinct(topology_linear, partitions)$partitions
linear_latencies = c()
unconstrained_latencies = c()
no_penalty_latencies = c()
penalty_latencies = c()
idx = 1
for(partition_count in partition_counts) {
topology_part_linear = filter(topology_linear,
partitions==partition_count)
topology_part_unconstrained = filter(topology_unconstrained,
partitions==partition_count)
topology_part_no_penalty = filter(topology_no_penalty,
partitions==partition_count)
topology_part_penalty = filter(topology_penalty,
partitions==partition_count)
# Get maximum evolution number for the (topology,partition) combo. Does
# this cause an issue if we potentially had two different seedings where 1
# resulted in a better soln?
linear_max_evo = max(topology_part_linear$evo_counter)
unconstrained_max_evo = max(topology_part_unconstrained$evo_counter)
no_penalty_max_evo = max(topology_part_no_penalty$evo_counter)
penalty_max_evo = max(topology_part_penalty$evo_counter)
# Get values for final evolution of (topology,partition) grouping.
# TODO is final evolution really the best?
topology_part_linear = filter(topology_part_linear,
evo_counter==linear_max_evo)
linear_latencies[idx] = topology_part_linear$latency_partition[1]/ partition_count
topology_part_unconstrained = filter(topology_part_unconstrained,
evo_counter==unconstrained_max_evo)
unconstrained_latencies[idx] = topology_part_unconstrained$latency_partition[1]/ partition_count
topology_part_no_penalty = filter(topology_part_no_penalty,
evo_counter==no_penalty_max_evo)
no_penalty_latencies[idx] = topology_part_penalty$latency_partition[1] / partition_count
topology_part_penalty = filter(topology_part_penalty,
evo_counter==penalty_max_evo)
penalty_latencies[idx] = topology_part_penalty$latency_partition[1] / partition_count
idx = idx+1
}
plot(partition_counts,
linear_latencies,
type="l",
xlab="Num partitions",
ylab="Min latency_partition",
main=paste(topology_name, "Min Partition Latency", " "),
ylim = c(0, 1.25*max(linear_latencies)))
lines(partition_counts,
unconstrained_latencies,
col="red")
lines(partition_counts,
no_penalty_latencies,
col="green")
lines(partition_counts,
penalty_latencies,
col="blue")
}
```
Partition throughput for (topology, partition) pairing at max evolution
counter.
```{r}
topologies = distinct(linear_results, topology)$topology
for (topology_name in topologies) {
topology_linear =
filter(linear_results, topology==topology_name)
topology_unconstrained =
filter(packing_results_unconstrained, topology==topology_name)
topology_no_penalty =
filter(packing_results_no_penalty, topology==topology_name)
topology_penalty =
filter(packing_results_penalty, topology==topology_name)
partition_counts = distinct(topology_linear, partitions)$partitions
linear_tps = c()
unconstrained_tps = c()
no_penalty_tps = c()
penalty_tps = c()
idx = 1
for(partition_count in partition_counts) {
topology_part_linear = filter(topology_linear,
partitions==partition_count)
topology_part_unconstrained = filter(topology_unconstrained,
partitions==partition_count)
topology_part_no_penalty = filter(topology_no_penalty,
partitions==partition_count)
topology_part_penalty = filter(topology_penalty,
partitions==partition_count)
# Get maximum evolution number for the (topology,partition) combo. Does
# this cause an issue if we potentially had two different seedings or
# targets where 1 resulted in a better soln?
linear_max_evo = max(topology_part_linear$evo_counter)
unconstrained_max_evo = max(topology_part_unconstrained$evo_counter)
no_penalty_max_evo = max(topology_part_no_penalty$evo_counter)
penalty_max_evo = max(topology_part_penalty$evo_counter)
# Get values for final evolution of (topology,partition) grouping.
# TODO is final evolution really the best?
topology_part_linear = filter(topology_part_linear,
evo_counter==linear_max_evo)
linear_tps[idx] = topology_part_linear$tp_partition[1]
topology_part_unconstrained = filter(topology_part_unconstrained,
evo_counter==unconstrained_max_evo)
unconstrained_tps[idx] = topology_part_unconstrained$tp_partition[1]
topology_part_no_penalty = filter(topology_part_no_penalty,
evo_counter==no_penalty_max_evo)
no_penalty_tps[idx] = topology_part_penalty$tp_partition[1]
topology_part_penalty = filter(topology_part_penalty,
evo_counter==penalty_max_evo)
penalty_tps[idx] = topology_part_penalty$tp_partition[1]
idx = idx+1
}
plot(partition_counts,
linear_tps,
type="l",
xlab="Num partitions",
ylab="Partition Throughput",
main=paste(topology_name, "Final (max evo_counter) Partition TP", " "),
ylim = c(0, 1.25*max(unconstrained_tps)))
lines(partition_counts,
unconstrained_tps,
col="red")
lines(partition_counts,
no_penalty_tps,
col="green")
lines(partition_counts,
penalty_tps,
col="blue")
}
```
Min partition latency for (topology, partition) pairing.
```{r}
topologies = distinct(linear_results, topology)$topology
for (topology_name in topologies) {
topology_linear =
filter(linear_results, topology==topology_name)
topology_unconstrained =
filter(packing_results_unconstrained, topology==topology_name)
topology_no_penalty =
filter(packing_results_no_penalty, topology==topology_name)
topology_penalty =
filter(packing_results_penalty, topology==topology_name)
partition_counts = distinct(topology_linear, partitions)$partitions
linear_latencies = c()
unconstrained_latencies = c()
no_penalty_latencies = c()
penalty_latencies = c()
idx = 1
for(partition_count in partition_counts) {
topology_part_linear = filter(topology_linear,
partitions==partition_count)
topology_part_unconstrained = filter(topology_unconstrained,
partitions==partition_count)
topology_part_no_penalty = filter(topology_no_penalty,
partitions==partition_count)
topology_part_penalty = filter(topology_penalty,
partitions==partition_count)
linear_latencies[idx] = min(topology_part_linear$latency_partition) / partition_count
unconstrained_latencies[idx] = min(topology_part_unconstrained$latency_partition)/ partition_count
no_penalty_latencies[idx] = min(topology_part_no_penalty$latency_partition)/ partition_count
penalty_latencies[idx] = min(topology_part_penalty$latency_partition)/ partition_count
idx = idx+1
}
plot(partition_counts,
linear_latencies,
type="l",
xlab="Num partitions",
ylab="Min latency_partition",
main=paste(topology_name, "Min Partition Latency", " "),
ylim = c(0, 1.25*max(linear_latencies)))
lines(partition_counts,
unconstrained_latencies,
col="red")
lines(partition_counts,
no_penalty_latencies,
col="green")
lines(partition_counts,
penalty_latencies,
col="blue")
}
```
Max partition throughput for (topology, partition) pairing.
```{r}
topologies = distinct(linear_results, topology)$topology
for (topology_name in topologies) {
topology_linear =
filter(linear_results, topology==topology_name)
topology_unconstrained =
filter(packing_results_unconstrained, topology==topology_name)
topology_no_penalty =
filter(packing_results_no_penalty, topology==topology_name)
topology_penalty =
filter(packing_results_penalty, topology==topology_name)
partition_counts = distinct(topology_linear, partitions)$partitions
linear_tps = c()
unconstrained_tps = c()
no_penalty_tps = c()
penalty_tps = c()
idx = 1
for(partition_count in partition_counts) {
topology_part_linear = filter(topology_linear,
partitions==partition_count)
topology_part_unconstrained = filter(topology_unconstrained,
partitions==partition_count)
topology_part_no_penalty = filter(topology_no_penalty,
partitions==partition_count)
topology_part_penalty = filter(topology_penalty,
partitions==partition_count)
linear_tps[idx] = max(topology_part_linear$tp_partition)
unconstrained_tps[idx] = max(topology_part_unconstrained$tp_partition)
no_penalty_tps[idx] = max(topology_part_no_penalty$tp_partition)
penalty_tps[idx] = max(topology_part_penalty$tp_partition)
idx = idx+1
}
plot(partition_counts,
linear_tps,
type="l",
xlab="Num partitions",
ylab="Partition Throughput",
main=paste(topology_name, "Final (max evo_counter) Partition TP", " "),
ylim = c(0, 1.25*max(unconstrained_tps)))
lines(partition_counts,
unconstrained_tps,
col="red")
lines(partition_counts,
no_penalty_tps,
col="green")
lines(partition_counts,
penalty_tps,
col="blue")
}
```
TP Gain vs. Latency Penalty @ min partition latency solution for (topology,
partition count) pair.
```{r}
topologies = distinct(linear_results, topology)$topology
for (topology_name in topologies) {
topology_linear =
filter(linear_results, topology==topology_name)
topology_unconstrained =
filter(packing_results_unconstrained, topology==topology_name)
topology_no_penalty =
filter(packing_results_no_penalty, topology==topology_name)
topology_penalty =
filter(packing_results_penalty, topology==topology_name)
partition_counts = distinct(topology_linear, partitions)$partitions
linear_tp_gains = c()
unconstrained_tp_gains = c()
no_penalty_tp_gains = c()
penalty_tp_gains = c()
linear_latency_penalty = c()
unconstrained_latency_penalty = c()
no_penalty_latency_penalty = c()
penalty_latency_penalty = c()
idx = 1
# Get this at min latency_partition row
for(partition_count in partition_counts) {
topology_part_linear = filter(topology_linear,
partitions==partition_count)
topology_part_unconstrained = filter(topology_unconstrained,
partitions==partition_count)
topology_part_no_penalty = filter(topology_no_penalty,
partitions==partition_count)
topology_part_penalty = filter(topology_penalty,
partitions==partition_count)
# TP Gain = TP Partition / TP FullMap
# Latency Penalty = Latency Partition / Latency FullMap
baseline_row = filter(fullmap_linear_baseline, partitions==partition_count & topology==topology_name)
tp_baseline = baseline_row$max_tp_fm
latency_baseline = baseline_row$min_latency_fm
min_latency_row_linear = topology_part_linear[which.min(topology_part_linear$latency_partition),]
linear_tp_gains[idx] = min_latency_row_linear$tp_partition/tp_baseline
linear_latency_penalty[idx] = min_latency_row_linear$latency_partition/latency_baseline
min_latency_row_unconstrained = topology_part_unconstrained[which.min(topology_part_unconstrained$latency_partition),]
unconstrained_tp_gains[idx] = min_latency_row_unconstrained$tp_partition/tp_baseline
unconstrained_latency_penalty[idx] = min_latency_row_unconstrained$latency_partition/latency_baseline
min_latency_row_no_penalty = topology_part_no_penalty[which.min(topology_part_no_penalty$latency_partition),]
no_penalty_tp_gains[idx] = min_latency_row_no_penalty$tp_partition/tp_baseline
no_penalty_latency_penalty[idx] = min_latency_row_no_penalty$latency_partition/latency_baseline
min_latency_row_penalty = topology_part_penalty[which.min(topology_part_penalty$latency_partition),]
penalty_tp_gains[idx] = min_latency_row_penalty$tp_partition/tp_baseline
penalty_latency_penalty[idx] = min_latency_row_penalty$latency_partition/latency_baseline
idx = idx + 1
}
plot(linear_tp_gains,
linear_latency_penalty,
xlab="TP Gain",
ylab="Latency Penalty",
main=paste(topology_name, "TP Gain vs. Latency Penalty", " "),
xlim=c(0,25),
ylim=c(0,6),
type='o')
lines(unconstrained_tp_gains,
unconstrained_latency_penalty,
col="red",
type='o')
lines(no_penalty_tp_gains,
no_penalty_latency_penalty,
col="green",
type='o')
lines(penalty_tp_gains,
penalty_latency_penalty,
col="blue",
type='o')
legend("topright",
legend = c("Linear", "Unconstrained", "Packed, No Penalty", "Packed, Penalty"),
col = c("black", "red", "green", "blue"),
lty=1)
}
```
```{r}
# MobileNet
mb_df = read.csv('../resulting_csv/cma_logmore_sq_full_evo_packing_mobile.csv',
header=FALSE,
sep=',')
names(mb_df) = c('target',
'evo_counter',
'partitions',
'topology',
'feasible',
'tp_partition',
'latency_partition',
'tp_fullmap',
'latency_fm',
'tp_gain',
'latency_penalty',
'best_layer_partition',
'best_resource_partition',
'time_taken',
'sigma',
'seed',
'valid_sampling_percentage',
'trial',
'popsize',
'res_unit',
'seeding_type',
'packing_strategy',
'png_filename')
mb_df = filter(mb_df, feasible==1)
# Set 0s in mb_df$latency_partition to infinities
# Unconstrained infinite bin
mb_packing_results_unconstrained = filter(mb_df, packing_strategy=='unconstrained')
# Greedy partition sizing, no penalty
mb_packing_results_no_penalty = filter(mb_df, packing_strategy=='no_penalty')
# Greedy partition sizing, penalty
mb_packing_results_penalty = filter(mb_df, packing_strategy=='overflow_penalty')
topologies = c("mobilenet.csv")
for (topology_name in topologies) {
topology_linear = filter(linear_results, topology==topology_name)
topology_unconstrained =
filter(mb_packing_results_unconstrained, topology==topology_name)
topology_no_penalty =
filter(mb_packing_results_no_penalty, topology==topology_name)
topology_penalty =
filter(mb_packing_results_penalty, topology==topology_name)
partition_counts = distinct(mb_packing_results_unconstrained, partitions)$partitions
linear_tp_gains = c()
unconstrained_tp_gains = c()
no_penalty_tp_gains = c()
penalty_tp_gains = c()
linear_latency_penalty = c()
unconstrained_latency_penalty = c()
no_penalty_latency_penalty = c()
penalty_latency_penalty = c()
idx = 1
# Get this at min latency_partition row
for(partition_count in partition_counts) {
topology_part_linear = filter(topology_linear,
partitions==partition_count)
topology_part_unconstrained = filter(topology_unconstrained,
partitions==partition_count)
topology_part_no_penalty = filter(topology_no_penalty,
partitions==partition_count)
topology_part_penalty = filter(topology_penalty,
partitions==partition_count)
# TP Gain = TP Partition / TP FullMap
# Latency Penalty = Latency Partition / Latency FullMap
baseline_row = filter(fullmap_linear_baseline, partitions==partition_count & topology==topology_name)
tp_baseline = baseline_row$max_tp_fm
latency_baseline = baseline_row$min_latency_fm
min_latency_row_linear = topology_part_linear[which.min(topology_part_linear$latency_partition),]
if (length(min_latency_row_linear$tp_partition/tp_baseline) > 0) {
linear_tp_gains[idx] = min_latency_row_linear$tp_partition/tp_baseline
linear_latency_penalty[idx] = min_latency_row_linear$latency_partition/latency_baseline
}
min_latency_row_unconstrained = topology_part_unconstrained[which.min(topology_part_unconstrained$latency_partition),]
unconstrained_tp_gains[idx] = min_latency_row_unconstrained$tp_partition/tp_baseline
unconstrained_latency_penalty[idx] = min_latency_row_unconstrained$latency_partition/latency_baseline
min_latency_row_no_penalty = topology_part_no_penalty[which.min(topology_part_no_penalty$latency_partition),]
no_penalty_tp_gains[idx] = min_latency_row_no_penalty$tp_partition/tp_baseline
no_penalty_latency_penalty[idx] = min_latency_row_no_penalty$latency_partition/latency_baseline
min_latency_row_penalty = topology_part_penalty[which.min(topology_part_penalty$latency_partition),]
penalty_tp_gains[idx] = min_latency_row_penalty$tp_partition/tp_baseline
penalty_latency_penalty[idx] = min_latency_row_penalty$latency_partition/latency_baseline
idx = idx + 1
}
}
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment