THINK FIRST·CODE LATER

← All labs

DNN partitioning: where to split?

Problem

A neural network is a chain of layers. Input: uplinkMbps rttMs inputKB n, then n layers name deviceMs edgeMs outputKB.

Split k (0 ≤ k ≤ n) runs layers 0 … k−1 on the device and k … n−1 on the edge. For k < n, the device sends the data entering layer k (the input for k = 0, else the output of layer k−1) — transfer time = KB × 8 / 1000 / Mbps seconds — then pays the RTT and the edge times. Split n runs everything on the device and sends nothing.

Print split 3 (after pool): send 30 KB, latency 62.0 ms for each k (all on edge for k = 0, all on device for k = n), then Best: split k, latency X ms (the smallest latency; ties → the smaller k).

Data for this lab

Your program reads its data from standard input. Download the file, then give it to your program as shown below. Start with data set 1: its expected output is given.

os13-3-data-1.txt

20 5 600 5
conv1 15 2 300
conv2 20 3 150
pool 5 1 30
fc1 60 4 4
fc2 20 1 1
What your program must print for os13-3-data-1.txt
split 0 (all on edge): send 600 KB, latency 256.0 ms
split 1 (after conv1): send 300 KB, latency 149.0 ms
split 2 (after conv2): send 150 KB, latency 106.0 ms
split 3 (after pool): send 30 KB, latency 62.0 ms
split 4 (after fc1): send 4 KB, latency 107.6 ms
split 5 (all on device): send 0 KB, latency 120.0 ms
Best: split 3, latency 62.0 ms

Run your program first, then open this and compare line by line: your output must contain these lines exactly.

How to give the file to my program

Terminal (macOS, Linux, or Windows Command Prompt), after compiling:

java Main < os13-3-data-1.txt

Windows PowerShell does not understand <:

Get-Content os13-3-data-1.txt | java Main

IntelliJ IDEA: Run → Edit Configurations → Redirect input from. Or simply paste the content of the file into the console when the program waits for input.

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.