repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
cs249r_book | interviews/vault/visuals/mobile/mobile-1886.py | .py | import os
import numpy as np
import matplotlib.pyplot as plt
n = np.arange(0, 8)
rho = 0.625
prob = (1 - rho) * (rho**n)
plt.figure(figsize=(6,4))
plt.bar(n, prob, color='#cfe2f3', edgecolor='#4a90c4')
plt.xlabel('Tasks in System (n)')
plt.ylabel('Probability')
plt.title('M/M/1 State Probabilities')
plt.tight_layout()... | 14 | 413 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1876.py | .py | import matplotlib.pyplot as plt
import os
labels = ['Recompute', 'Checkpoint + Load']
times = [15, 8]
colors = ['#c87b2a', '#3d9e5a']
fig, ax = plt.subplots(figsize=(6, 2))
ax.barh(labels, times, color=colors, edgecolor='black')
ax.set_xlabel('Time (ms)')
ax.set_title('Recovery Strategy Cost')
ax.axvline(x=8, color='... | 16 | 471 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1899.py | .py | import os
import matplotlib.pyplot as plt
stages = ['Token', 'Embed', 'NPU Trans.', 'Decode']
times = [1, 2, 10, 3]
plt.bar(stages, times, color=['#cfe2f3', '#cfe2f3', '#c87b2a', '#cfe2f3'])
plt.ylabel('Duration (ms)')
out = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
plt.savefig(out, format='svg', bbox_inches='tight'... | 8 | 321 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1877.py | .py | import matplotlib.pyplot as plt
import os
labels = ['LPDDR5 Transfer', 'NPU Compute (Ideal)']
times = [0.200, 0.050]
colors = ['#c87b2a', '#4a90c4']
fig, ax = plt.subplots(figsize=(6, 2))
ax.barh(labels, times, color=colors, edgecolor='black')
ax.set_xlabel('Time (ms)')
ax.set_title('Layer Execution Bottleneck')
ax.a... | 16 | 514 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1880.py | .py | import matplotlib.pyplot as plt
import os
labels = ['INT4 Weights', 'KV Cache Capacity']
sizes = [1536, 512]
colors = ['#cfe2f3', '#c87b2a']
fig, ax = plt.subplots(figsize=(6, 2))
ax.barh(0, sizes[0], color=colors[0], edgecolor='black', label=labels[0])
ax.barh(0, sizes[1], left=sizes[0], color=colors[1], edgecolor='... | 20 | 731 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1907.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
minutes = np.linspace(0, 60, 60)
gb_written = (minutes * 60 * 30) / 1000
plt.figure(figsize=(6, 4))
plt.plot(minutes, gb_written, color='#c87b2a', lw=2)
plt.axhline(100, color='red', linestyle='--', label='100 GB Mark')
plt.xlabel('Time (Minutes)')
plt.ylab... | 16 | 460 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1981.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(figsize=(5,2))
ax.barh(['Pipeline'], [0.2], color='#fdebd0', edgecolor='#c87b2a', label='RAM Copy (0.2ms)')
ax.barh(['Pipeline'], [2.0], left=[0.2], color='#cfe2f3', edgecolor='#4a90c4', label='Inference (2ms)')
ax.legend()
ax.set_xlabe... | 9 | 430 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1956.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 3))
ax.barh(['Turn 1', 'Turn 2', 'Turn 3'], [3000, 3000, 3000], color='#cfe2f3', label='System Prompt KV')
ax.barh(['Turn 1', 'Turn 2', 'Turn 3'], [10, 10, 10], left=[3000, 3000, 3000], color='#d4edda', label='Generated KV')
ax.set_xlabel('Tok... | 10 | 465 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1961.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(5, 4))
ax.bar(['L2 BW', 'DRAM BW', 'Effective'], [500, 50, 55], color=['#4a90c4', '#c87b2a', '#3d9e5a'])
ax.set_ylabel('Bandwidth (GB/s)')
ax.set_title('Amdahls Law on Memory BW')
out_path = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
fig.savefi... | 9 | 381 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1911.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6,2))
ax.broken_barh([(0,3)], (0,1), facecolors='#cfe2f3')
ax.broken_barh([(3,1)], (0,1), facecolors='#c87b2a', label='Save')
ax.broken_barh([(4,2)], (0,1), facecolors='#d4edda', label='Interrupt')
ax.broken_barh([(6,1)], (0,1), facecolors='#c87b... | 12 | 537 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1955.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 2))
ax.broken_barh([(0, 0.45)], (1, 1), facecolors='#3d9e5a')
ax.axvline(1.0, color='r', linestyle='--', label='OS Kill Signal')
ax.set_xlim(0, 1.2)
ax.set_yticks([])
ax.set_xlabel('Time (s) after preemption warning')
ax.legend()
out_path = os... | 12 | 434 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1910.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(5,2))
ax.barh(['NPU SRAM', 'LPDDR5 RAM'], [800, 50], color='#cfe2f3', edgecolor='#4a90c4')
ax.set_xlabel('Effective Bandwidth (GB/s)')
out = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
plt.savefig(out, format='svg', bbox_inches='tight') | 7 | 311 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1870.py | .py | import matplotlib.pyplot as plt
import numpy as np
import os
rho = np.linspace(0.1, 0.95, 100)
q_depth = rho / (1 - rho)
fig, ax = plt.subplots(figsize=(6, 4))
ax.plot(rho, q_depth, color='#4a90c4', linewidth=2.5)
ax.set_xlabel('Utilization (ρ)')
ax.set_ylabel('Avg Queue Depth')
ax.set_title('Queue Depth vs Utilizati... | 17 | 495 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1915.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6,2))
ax.plot([0, 5], [0, 100], color='#4a90c4')
ax.plot([5, 5.1], [100, 0], color='#c87b2a', label='CPU Wake/Drain')
ax.plot([5.1, 10], [0, 100], color='#4a90c4')
ax.set_ylabel('Buffer %')
ax.set_xlabel('Time (s)')
ax.legend()
out = os.environ.g... | 11 | 404 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1966.py | .py | import os
import matplotlib.pyplot as plt
precisions = ['FP16 (2 bytes)', 'INT8 (1 byte)']
context_len = [1, 2] # normalized
plt.figure(figsize=(6, 3))
plt.barh(precisions, context_len, color=['#cfe2f3', '#d4edda'], edgecolor=['#4a90c4', '#3d9e5a'])
plt.xlabel('Max Context Tokens (Normalized)')
plt.title('KV Cache Qu... | 11 | 432 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1982.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
t = np.array([0, 100, 200, 300])
q = np.array([15, 10, 5, 0])
fig, ax = plt.subplots(figsize=(5,3))
ax.plot(t, q, color='#4a90c4', linewidth=2, marker='o')
ax.set_ylabel('Queue Length')
ax.set_xlabel('Time (ms)')
plt.savefig(os.environ.get('VISUAL_OUT_PATH', ... | 10 | 366 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1952.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(4, 5))
ax.bar(['Session 1'], [3.5], label='INT4 Weights (3.5GB)', color='#cfe2f3')
ax.bar(['Session 1'], [2.0], bottom=[3.5], label='FP16 KV Cache (2.0GB)', color='#d4edda')
ax.set_ylabel('Memory (GB)')
ax.legend()
out_path = os.environ.get('VISU... | 10 | 416 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1891.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 2))
ax.barh(['Grace Period (1.5s)'], [1500], color='#d4edda', edgecolor='#3d9e5a')
ax.barh(['Grace Period (1.5s)'], [75], color='#c87b2a', edgecolor='black', label='Save (75ms)')
ax.set_xlabel('Time (ms)')
plt.legend()
plt.tight_layout()
plt.... | 10 | 408 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1969.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(figsize=(6, 3))
ax.barh(1, 10, left=0, color='#fdebd0', edgecolor='gray', label='Wasted Space')
ax.barh(1, 3, left=0, color='#4a90c4', edgecolor='black', label='Used Space')
for i in range(4):
ax.barh(0, 0.8, left=i, color='#4a90c... | 16 | 542 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1970.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(0, 10, 100)
ap_power = np.where((t > 4.8) & (t < 5.2), 2000, 0)
hub_power = np.full_like(t, 50)
fig, ax = plt.subplots(figsize=(6, 3))
ax.plot(t, ap_power, label='App Processor', color='#c87b2a')
ax.plot(t, hub_power, label='Sensor Hub', col... | 16 | 518 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1904.py | .py | import os
import numpy as np
import matplotlib.pyplot as plt
lambdas = np.linspace(10, 48, 50)
mu = 50
Wq = (lambdas / mu) / (mu - lambdas)
plt.figure(figsize=(6, 4))
plt.plot(lambdas, Wq * 1000, color='#c87b2a', lw=2)
plt.axvline(40, color='red', linestyle='--', label='Arrival=40')
plt.ylabel('Queue Wait Time (ms)')... | 17 | 475 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1964.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 3))
ax.plot([0, 5, 5, 5.1, 5.1], [1, 1, 0, 0, 1], color='#4a90c4', lw=2)
ax.axvline(5, color='#c87b2a', linestyle='--', label='Crash Event')
ax.annotate('RPO: 5 min', xy=(2.5, 0.5), ha='center')
ax.annotate('RTO: 10s', xy=(5.05, 0.5), ha='lef... | 12 | 491 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1967.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
rho = np.linspace(0.1, 0.9, 50)
wait_uniform = (rho) / (1 - rho) * 0.5
wait_bursty = (rho) / (1 - rho) * 2.5
plt.figure(figsize=(6, 3))
plt.plot(rho, wait_uniform, label='Uniform Arrivals', color='#3d9e5a')
plt.plot(rho, wait_bursty, label='Bursty Arrivals'... | 15 | 525 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1896.py | .py | import os
import matplotlib.pyplot as plt
bw = [100, 60]
labels = ['L3 Cache (80% Hit)', 'Main Memory (20% Miss)']
plt.bar(labels, bw, color=['#4a90c4', '#c87b2a'])
plt.ylabel('Bandwidth (GB/s)')
out = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
plt.savefig(out, format='svg', bbox_inches='tight') | 8 | 298 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1903.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 3))
ax.barh('Frame 1', 15, left=0, color='#cfe2f3', edgecolor='#4a90c4', label='CPU (15ms)')
ax.barh('Frame 1', 10, left=15, color='#d4edda', edgecolor='#3d9e5a', label='NPU (10ms)')
ax.barh('Frame 2', 15, left=25, color='#cfe2f3', edgecolor=... | 13 | 543 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1954.py | .py | import os
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 4))
rho = np.linspace(0.5, 0.98, 50)
lq = (rho**2) / (1 - rho)
ax.plot(rho, lq, color='#c87b2a', lw=2)
ax.axvline(0.95, color='r', linestyle='--', label='App State (rho=0.95)')
ax.set_ylabel('Queue Length')
ax.set_xlabel('Ut... | 14 | 471 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1885.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 2.5))
ax.barh(['ISP', 'Mem Copy', 'NPU', 'Display'], [2, 3, 10, 5], left=[0, 2, 5, 15], color='#cfe2f3', edgecolor='#4a90c4')
ax.set_xlabel('Time (ms)')
ax.set_title('Pipeline Stages')
plt.tight_layout()
plt.savefig(os.environ.get('VISUAL_OUT... | 9 | 374 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1893.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
lam = np.linspace(5, 38, 100)
mu = 40
rho = lam / mu
wq = rho / (mu - lam)
plt.plot(lam, wq, color='#4a90c4', linewidth=2)
plt.axvline(30, color='#c87b2a', linestyle='--')
plt.xlabel('Arrival Rate (FPS)')
plt.ylabel('Queuing Delay (s)')
out = os.environ.get('... | 13 | 400 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1958.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(5, 4))
ax.bar(['FP16 KV'], [1.0], label='Weights', color='#cfe2f3')
ax.bar(['FP16 KV'], [2.0], bottom=[1.0], label='FP16 KV Cache', color='#4a90c4')
ax.bar(['INT8 KV'], [1.0], color='#cfe2f3')
ax.bar(['INT8 KV'], [1.0], bottom=[1.0], label='INT8 ... | 12 | 552 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1882.py | .py | import os
import numpy as np
import matplotlib.pyplot as plt
rho = np.linspace(0.1, 0.9, 100)
mm1 = rho / (1 - rho)
md1 = (rho**2) / (2 * (1 - rho))
plt.figure(figsize=(6,4))
plt.plot(rho, mm1, label='M/M/1', color='#4a90c4')
plt.plot(rho, md1, label='M/D/1', color='#3d9e5a')
plt.xlabel('Utilization')
plt.ylabel('Queu... | 15 | 455 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1902.py | .py | import os
import matplotlib.pyplot as plt
labels = ['L1/L2 Cache', 'System RAM']
bw = [1000, 50]
plt.figure(figsize=(6, 4))
plt.bar(labels, bw, color='#4a90c4')
plt.ylabel('Bandwidth (GB/s)')
plt.title('A17 Pro Memory Bandwidth')
out = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
plt.savefig(out, format='svg', bbox_i... | 12 | 334 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1913.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6,2))
ax.broken_barh([(0,3)], (0,1), facecolors='#cfe2f3', label='Train')
ax.annotate('WiFi Drop', xy=(3, 0.5), xytext=(2.5, 1.2), arrowprops=dict(facecolor='red', shrink=0.05))
ax.broken_barh([(3,1)], (0,1), facecolors='#c87b2a', label='Serializ... | 11 | 519 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1953.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(figsize=(6, 3))
t = np.linspace(0, 33.2, 500)
power = np.where((t % 16.6) < 5.0, 2.0, 0.1)
ax.plot(t, power, color='#c87b2a')
ax.set_xlabel('Time (ms)')
ax.set_ylabel('Power (W)')
ax.set_title('60fps Duty Cycle')
out_path = os.environ.g... | 13 | 424 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1957.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(7, 3))
ax.broken_barh([(0, 0.5), (0.5, 0.5), (1.0, 0.5)], (10, 8), facecolors='#4a90c4', label='Compute Thread')
ax.broken_barh([(0.5, 0.1), (1.5, 0.1)], (0, 8), facecolors='#c87b2a', label='I/O Thread (Write)')
ax.set_ylim(0, 20)
ax.set_yticks([... | 12 | 505 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1889.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 2))
ax.barh(['CPU Crop', 'GPU Filter', 'NPU Detect'], [5, 10, 15], left=[0, 5, 15], color='#cfe2f3', edgecolor='#4a90c4')
ax.set_xlabel('Time (ms)')
plt.tight_layout()
plt.savefig(os.environ.get('VISUAL_OUT_PATH', 'out.svg'), format='svg', bb... | 8 | 338 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1884.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(4,4))
ax.bar(['KV Cache'], [1073], color='#fdebd0', edgecolor='#c87b2a')
ax.axhline(1000, color='red', linestyle='--', label='1GB Strict Limit')
ax.set_ylabel('Memory (MB)')
plt.legend()
plt.tight_layout()
plt.savefig(os.environ.get('VISUAL_OUT_... | 10 | 373 |
cs249r_book | interviews/vault/visuals/mobile/mobile-1873.py | .py | import matplotlib.pyplot as plt
import os
labels = ['Write temp.pt', 'fsync()', 'rename()']
starts = [0, 45, 48]
durations = [45, 3, 1]
colors = ['#cfe2f3', '#fdebd0', '#d4edda']
fig, ax = plt.subplots(figsize=(6, 2))
for i in range(3):
ax.barh(0, durations[i], left=starts[i], color=colors[i], edgecolor='black', ... | 22 | 708 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1646.py | .py | import os
import matplotlib.pyplot as plt
memories = ['SRAM Capacity', 'Model Weights', 'Flash Capacity']
sizes = [256, 500, 1024]
colors = ['#c87b2a', '#4a90c4', '#3d9e5a']
plt.figure(figsize=(6, 3))
plt.bar(memories, sizes, color=colors)
plt.axhline(500, color='gray', linestyle='--')
plt.ylabel('Capacity (KB)')
plt... | 12 | 409 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1658.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6,4))
ax.bar(['INT8 Model', 'INT16 Model'], [200, 400], color=['#d4edda', '#fdebd0'], edgecolor=['#3d9e5a', '#c87b2a'])
ax.axhline(256, color='red', linestyle='--', label='SRAM Limit (256KB)')
ax.set_ylabel('Memory Footprint (KB)')
ax.set_title('... | 9 | 442 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1663.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(0, 60, 600)
y = np.where((t > 15)&(t < 17), 12, 0.1)
fig, ax = plt.subplots(figsize=(6,2))
ax.plot(t, y, color='#3d9e5a')
ax.set_ylabel('Power (mW)')
ax.set_xlabel('Time (minutes)')
plt.savefig(os.environ.get('VISUAL_OUT_PATH', 'out.svg'), for... | 10 | 351 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1661.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(0, 0.2, 100)
energy = 0.009 - (0.06 * t)
fig, ax = plt.subplots(figsize=(5,3))
ax.plot(t, energy, color='#c87b2a', label='Capacitor Energy')
ax.axhline(0, color='red', linestyle='--', label='Depletion')
ax.set_ylabel('Energy (J)')
ax.set_xlabe... | 12 | 438 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1637.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 3))
t = [0, 2, 2.01, 4, 4.01, 6]
prog = [0, 66, 0, 66, 0, 66]
ax.plot(t, prog, color='#c87b2a', lw=2)
ax.axhline(100, color='r', linestyle='--', label='Task Complete')
ax.set_ylabel('Progress (%)')
ax.set_xlabel('Time (min)')
ax.legend()
out_p... | 13 | 442 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1590.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6,2))
ax.plot([0, 10], [1, 1], color='#c87b2a', label='RTC Active')
ax.vlines(x=[2, 5, 8], ymin=1, ymax=10, color='#4a90c4', linewidth=3, label='CPU Wake')
ax.set_yticks([])
ax.set_xlabel('Time')
ax.legend(loc='upper right')
out = os.environ.get(... | 10 | 401 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1585.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 2))
ax.barh('SRAM Arena', 8, color='#4a90c4', edgecolor='black', label='Input (8KB)')
ax.barh('SRAM Arena', 4, left=8, color='#3d9e5a', edgecolor='black', label='Output (4KB)')
ax.set_xlim(0, 15)
ax.set_xlabel('Size (KB)')
ax.legend()
out = ... | 12 | 416 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1640.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 3))
t = [0, 1, 6, 10]
occ = [0, 0, 100, 0]
ax.plot(t, occ, color='#3d9e5a', lw=2)
ax.axvline(1, color='r', linestyle='--', alpha=0.5)
ax.axvline(6, color='r', linestyle='--', alpha=0.5)
ax.set_xlabel('Time (s)')
ax.set_ylabel('Frames in Queue'... | 14 | 481 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1577.py | .py | import os
import matplotlib.pyplot as plt
time = [0, 50, 50, 1000, 1000, 1050, 1050, 2000]
state = [1, 1, 0, 0, 1, 1, 0, 0]
plt.figure(figsize=(6, 2))
plt.plot(time, state, color='#c87b2a', drawstyle='steps-pre')
plt.yticks([0, 1], ['Sleep', 'Active'])
plt.xlabel('Time (ms)')
plt.title('Duty Cycle Timeline')
out = os... | 13 | 414 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1543.py | .py | import matplotlib.pyplot as plt
import numpy as np
import os
time = np.linspace(0, 10, 1000)
power = np.full_like(time, 208) # Raised baseline in mW
power[(time > 2) & (time < 2.5)] = 2500
power[(time > 7) & (time < 7.5)] = 2500
fig, ax = plt.subplots(figsize=(7, 3))
ax.plot(time, power, color='#4a90c4')
ax.axhline(y... | 20 | 632 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1662.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(0, 10, 100)
y = np.where((t > 2)&(t < 3) | (t > 7)&(t < 8), 20.5, 0.5)
fig, ax = plt.subplots(figsize=(5,3))
ax.plot(t, y, color='#3d9e5a')
ax.set_ylabel('Power (mW)')
ax.set_xlabel('Time (s)')
plt.savefig(os.environ.get('VISUAL_OUT_PATH', 'ou... | 10 | 363 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1546.py | .py | import matplotlib.pyplot as plt
import numpy as np
import os
time = np.linspace(0, 6, 100)
buffer = np.minimum(100, time * 20) # 20 packets net growth per second
fig, ax = plt.subplots(figsize=(6, 3))
ax.plot(time, buffer, color='#c87b2a', linewidth=2)
ax.axhline(y=100, color='red', linestyle='--', label='Buffer Capa... | 19 | 618 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1579.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
rho = np.linspace(0.1, 0.95, 100)
L = rho / (1 - rho)
plt.figure(figsize=(6, 4))
plt.plot(rho, L, color='#c87b2a', linewidth=2)
plt.axvline(0.8, color='#4a90c4', linestyle='--', label='Current: rho=0.8')
plt.xlabel('Utilization (rho)')
plt.ylabel('Average Qu... | 15 | 449 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1581.py | .py | import os
import matplotlib.pyplot as plt
time = [0, 5, 10, 15, 20]
checkpoints = [1, 1, 1, 1, 1]
plt.figure(figsize=(6, 2))
plt.stem(time, checkpoints, linefmt='#3d9e5a', markerfmt='D')
plt.yticks([])
plt.xlabel('Time (Minutes)')
plt.title('5-Minute Checkpointing Schedule')
out = os.environ.get('VISUAL_OUT_PATH', 'o... | 13 | 380 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1582.py | .py | import os
import matplotlib.pyplot as plt
labels = ['SRAM Access', 'Flash Access']
cycles = [1, 4]
plt.figure(figsize=(5, 4))
plt.bar(labels, cycles, color=['#4a90c4', '#c87b2a'])
plt.ylabel('Clock Cycles')
plt.title('Memory Fetch Latency')
out = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
plt.savefig(out, format='... | 13 | 346 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1586.py | .py | import os
import matplotlib.pyplot as plt
labels = ['SRAM (Volatile)', 'Flash (Non-Volatile)']
retention = [0, 100]
plt.figure(figsize=(5, 4))
plt.bar(labels, retention, color=['#c87b2a', '#3d9e5a'])
plt.ylabel('Data Retained (%)')
plt.title('Power Loss Scenario')
out = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
p... | 13 | 370 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1578.py | .py | import os
import matplotlib.pyplot as plt
labels = ['SRAM', 'Flash']
sizes = [0.25, 1.0]
plt.figure(figsize=(6, 4))
plt.bar(labels, sizes, color=['#4a90c4', '#3d9e5a'])
plt.ylabel('Size (MB)')
plt.title('Cortex-M4 Typical Memory')
out = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
plt.savefig(out, format='svg', bbox_... | 12 | 335 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1583.py | .py | import os
import matplotlib.pyplot as plt
time = [0, 5, 10]
queue_size = [0, 50, 100]
plt.figure(figsize=(6, 4))
plt.plot(time, queue_size, color='#c87b2a', lw=2)
plt.xlabel('Time Overloaded (Seconds)')
plt.ylabel('Queue Size')
plt.title('Arrival Rate > Service Rate')
out = os.environ.get('VISUAL_OUT_PATH', 'out.svg... | 14 | 374 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1575.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 1.5))
ax.broken_barh([(0, 48), (50, 48)], (0, 1), facecolors='#4a90c4')
ax.broken_barh([(48, 2)], (0, 1), facecolors='#c87b2a', label='2s RTO')
ax.set_yticks([])
ax.set_xlabel('Time')
ax.legend()
out = os.environ.get('VISUAL_OUT_PATH', 'out.sv... | 10 | 375 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1580.py | .py | import os
import matplotlib.pyplot as plt
mem_types = ['SRAM Cap', 'Flash Cap', 'Model Size']
values = [256, 1024, 300]
plt.figure(figsize=(6, 4))
bars = plt.bar(mem_types, values, color=['#4a90c4', '#4a90c4', '#c87b2a'])
plt.axhline(256, color='red', linestyle='--')
plt.ylabel('Size (KB)')
plt.title('Memory Constrain... | 13 | 428 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1553.py | .py | import matplotlib.pyplot as plt
import os
labels = ['Active Phase', 'Sleep Phase']
# Values in mA*seconds (mC)
energy = [15 * 10, 0.002 * 86390]
colors = ['#c87b2a', '#cfe2f3']
fig, ax = plt.subplots(figsize=(4, 4))
ax.pie(energy, labels=labels, colors=colors, autopct='%1.1f%%', startangle=90)
ax.set_title('Daily Ene... | 15 | 466 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1630.py | .py | import os
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 4))
rho = np.linspace(0.1, 0.9, 50)
latency = 1 / (40 - 40*rho)
ax.plot(rho, latency * 1000, color='red')
ax.set_xlabel('Utilization (rho)')
ax.set_ylabel('Latency (ms)')
ax.set_title('Queueing Latency vs Utilization')
out_p... | 13 | 442 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1551.py | .py | import matplotlib.pyplot as plt
import numpy as np
import os
time = np.linspace(0, 10, 100)
queue = np.zeros_like(time)
queue[time <= 5] = time[time <= 5] * (1 - 1/1.2)
queue[time > 5] = np.maximum(0, queue[50] - (time[time > 5] - 5)*(1/1.2))
fig, ax = plt.subplots(figsize=(6, 3))
ax.plot(time, queue, color='#4a90c4'... | 19 | 616 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1570.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
labels = ['SRAM Cap.', 'Model Layout']
sram_avail = [256, 0]
model_acts = [0, 80]
model_weights_sram = [0, 176]
model_weights_flash = [0, 44]
fig, ax = plt.subplots()
ax.bar(labels, sram_avail, color='#d4edda', label='Empty SRAM')
ax.bar(labels, model_acts, c... | 17 | 720 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1574.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(0, 300, 600)
current = np.where(t % 100 < 2, 5, 0.01)
plt.plot(t, current, color='#3d9e5a')
plt.xlabel('Time (ms)')
plt.ylabel('Current (mA)')
plt.yscale('log')
out = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
plt.savefig(out, format='svg', ... | 11 | 340 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-0816.py | .py | import os
import numpy as np
import matplotlib.pyplot as plt
plt.figure(figsize=(10, 4))
t_points = []
p_points = []
for i in range(3):
start = i * 10
t_points.extend([max(0, start - 1e-5), start, start + 0.02, start + 0.02 + 1e-5])
p_points.extend([0.01, 15, 15, 0.01])
if i < 2:
t_points.appen... | 34 | 1,077 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1659.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(0, 3, 300)
y = np.where(t % 1.0 < 0.02, 15, 0.05)
fig, ax = plt.subplots(figsize=(5,3))
ax.plot(t, y, color='#4a90c4')
ax.set_ylabel('Power (mW)')
ax.set_xlabel('Time (s)')
plt.savefig(os.environ.get('VISUAL_OUT_PATH', 'out.svg'), format='svg'... | 10 | 342 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1587.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6,2))
ax.axvline(2, color='#4a90c4', linestyle='-', label='Checkpoint')
ax.axvline(4, color='#4a90c4', linestyle='-')
ax.annotate('Failure', xy=(5, 0), xytext=(5, 1), arrowprops=dict(facecolor='#c87b2a', shrink=0.05))
ax.axvline(6, color='#3d9e5a... | 12 | 524 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1644.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
arrival = np.linspace(10, 99, 100)
rho = arrival / 100.0
q_len = (rho**2) / (1 - rho)
plt.figure(figsize=(6, 3))
plt.plot(arrival, q_len, color='#4a90c4', lw=2)
plt.axvline(95, color='#c87b2a', linestyle='--', label='95 events/s')
plt.xlabel('Arrival Rate (... | 15 | 475 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1649.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(0, 10, 1000)
y = np.where(t % 2 < 0.2, 10, 0.001)
fig, ax = plt.subplots(figsize=(6, 3))
ax.plot(t, y, color='#4a90c4')
ax.set_yscale('log')
ax.set_ylabel('Power (mW)')
ax.set_xlabel('Time (ms)')
ax.set_title('Duty Cycling Power Profile')
plt.... | 13 | 412 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1566.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 2))
ax.barh(['Ideal Active'], [10], left=[50], color='#4a90c4')
ax.barh(['Drift Guardband'], [60], left=[0], color='#c87b2a')
ax.set_xlabel('Time (ms)')
plt.tight_layout()
plt.savefig(os.environ.get('VISUAL_OUT_PATH', 'out.svg'), format='svg'... | 9 | 342 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1542.py | .py | import matplotlib.pyplot as plt
import numpy as np
import os
time = np.arange(0, 400)
progress = time % 60
failure = np.where(time == 300, 1, 0)
fig, ax = plt.subplots(figsize=(8, 3))
ax.plot(time, progress, color='#3d9e5a', label='Progress')
ax.axvline(x=300, color='#c87b2a', linestyle='--', label='Power Loss')
ax.s... | 20 | 600 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1629.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 4))
labels = ['Active (0.6%)', 'Sleep (99.4%)']
sizes = [0.6, 99.4]
ax.pie(sizes, labels=labels, autopct='%1.1f%%', colors=['#ff9999','#66b3ff'])
ax.set_title('Duty Cycle Distribution')
out_path = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
f... | 10 | 390 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1573.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6,1.5))
ax.hlines(1, 0, 15, colors='#4a90c4', linewidth=2)
ax.vlines([0, 5, 10, 15], 0.8, 1.2, colors='#c87b2a', linewidth=3)
ax.text(2.5, 1.3, 'RPO = 5 Min', ha='center')
ax.set_xticks([0, 5, 10, 15])
ax.set_xlabel('Time (Minutes)')
ax.set_ytick... | 11 | 428 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1563.py | .py | import os
import matplotlib.pyplot as plt
labels = ['Boot', 'Inference', 'Sleep']
energy = [30, 20, 1.194]
plt.figure(figsize=(5,4))
plt.pie(energy, labels=labels, autopct='%1.1f%%', colors=['#fdebd0', '#c87b2a', '#cfe2f3'])
plt.title('Energy Contribution per Cycle')
plt.tight_layout()
plt.savefig(os.environ.get('VISU... | 10 | 380 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1571.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(0, 180, 500)
power = np.where((t % 60) < 2, 33, 0) # Exaggerated width for visibility
plt.plot(t, power, color='#c87b2a')
plt.xlabel('Time (Seconds)')
plt.ylabel('Power (mW)')
plt.title('EEPROM Write Pulses')
out = os.environ.get('VISUAL_OUT_P... | 11 | 388 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1567.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(5,3))
ax.bar(['Flash Read', 'SRAM Write'], [10, 400], color=['#c87b2a', '#4a90c4'])
ax.set_ylabel('Bandwidth (MB/s)')
plt.yscale('log')
plt.tight_layout()
plt.savefig(os.environ.get('VISUAL_OUT_PATH', 'out.svg'), format='svg', bbox_inches='tight... | 9 | 322 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1642.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(0, 100, 1000)
power = np.where(t < 5, 10, 0.01)
plt.figure(figsize=(6, 3))
plt.plot(t, power, color='#4a90c4', linewidth=2)
plt.fill_between(t, power, color='#cfe2f3')
plt.xlabel('Time (ms)')
plt.ylabel('Power (mW)')
plt.title('Duty Cycle Po... | 15 | 468 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1635.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(7, 2))
ax.broken_barh([(0, 0.1), (1.33, 0.1)], (0, 12), facecolors='#4a90c4')
ax.set_xlim(0, 2)
ax.set_ylim(0, 15)
ax.set_ylabel('Power (mW)')
ax.set_xlabel('Time (s)')
ax.set_title('Duty Cycle at Max Frequency')
out_path = os.environ.get('VISUAL... | 12 | 414 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1655.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6,3))
ax.broken_barh([(0, 1), (10, 1), (20, 1)], (0, 1), facecolors='#cfe2f3', edgecolors='#4a90c4')
ax.annotate('Max Data Loss (RPO)', xy=(10, 0.5), xytext=(3, 1.2), arrowprops=dict(facecolor='black', arrowstyle='<->'))
ax.set_yticks([])
ax.set_... | 9 | 462 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1632.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(8, 3))
ax.broken_barh([(0, 10), (12, 10)], (10, 9), facecolors=('tab:blue', 'tab:green'))
ax.vlines(10, 5, 25, colors='r', linestyles='solid', label='Checkpoint')
ax.vlines(11.5, 5, 25, colors='k', linestyles='dashed', label='Brownout')
ax.set_yl... | 14 | 542 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1651.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 4))
labels = ['Polling (100 wakes)', 'DMA Batch (1 wake)']
energy = [50, 12]
ax.bar(labels, energy, color=['#fdebd0', '#d4edda'], edgecolor='#c87b2a')
ax.set_ylabel('Relative Energy per Second')
ax.set_title('Energy: Polling vs DMA Batching')
... | 9 | 397 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1589.py | .py | import os
import numpy as np
import matplotlib.pyplot as plt
rho = np.linspace(0, 0.9, 50)
D = 10
delay = (rho * D) / (2 * (1 - rho))
plt.plot(rho, delay, color='#3d9e5a')
plt.xlabel('Utilization (rho)')
plt.ylabel('Delay (ms)')
out = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
plt.savefig(out, format='svg', bbox_inch... | 11 | 331 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1633.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(5, 4))
ax.bar(['Base (50ms@20mW)', 'Fast (25ms@45mW)'], [1.0, 1.125], color=['#4a90c4', '#c87b2a'])
ax.set_ylabel('Active Energy (mJ)')
ax.set_title('DVFS Energy Cost')
out_path = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
fig.savefig(out_path,... | 9 | 370 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1591.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(4,3))
ax.pie([18, 1], labels=['Leakage (18 mAs)', 'Active (1 mAs)'], colors=['#cfe2f3', '#c87b2a'])
ax.set_title('Hourly Energy Usage')
out = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
plt.savefig(out, format='svg', bbox_inches='tight') | 7 | 312 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1549.py | .py | import matplotlib.pyplot as plt
import os
phases = ['Reboot/Init', 'Scan Meta', 'Read State']
times = [8.0, 1.0, 2.5]
colors = ['#cfe2f3', '#fdebd0', '#d4edda']
fig, ax = plt.subplots(figsize=(6, 2))
current = 0
for i in range(3):
ax.barh(0, times[i], left=current, color=colors[i], edgecolor='black', label=phases... | 23 | 715 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1568.py | .py | import os
import matplotlib.pyplot as plt
plt.figure(figsize=(8,3))
plt.plot([0, 5, 5, 6, 10], [1, 1, 0, 1, 1], color='#4a90c4', linewidth=2)
plt.axvline(x=5, color='#c87b2a', linestyle='--', label='Failure (RPO=5s)')
plt.axvline(x=6, color='#3d9e5a', linestyle='--', label='Recovery (RTO=1s)')
plt.fill_between([0, 5],... | 13 | 563 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1569.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
lam = np.linspace(1, 6.5, 100)
service = 0.15
rho = lam * service
wq = (rho * service) / (2 * (1 - rho))
plt.plot(lam, wq, color='#4a90c4', linewidth=2)
plt.axvline(5, color='#c87b2a', linestyle='--')
plt.xlabel('Arrival Rate (Events/s)')
plt.ylabel('Queue Wa... | 13 | 436 |
cs249r_book | interviews/vault/visuals/tinyml/tinyml-1634.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(5, 3))
intervals = [1, 5, 10, 15, 30]
penalty = [0.5, 2.5, 5.0, 7.5, 15.0]
ax.plot(intervals, penalty, marker='o', color='#3d9e5a')
ax.set_xlabel('Checkpoint Interval (min)')
ax.set_ylabel('Expected Rollback Time (min)')
out_path = os.environ.get... | 11 | 422 |
cs249r_book | interviews/vault/visuals/cloud/cloud-4502.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(5,3))
ax.barh(['Physical Block 3', 'Physical Block 1'], [10, 10], color='#cfe2f3', edgecolor='#4a90c4')
ax.set_title('Non-Contiguous Physical Memory Allocation')
ax.set_xlabel('Token Capacity')
out = os.environ.get('VISUAL_OUT_PATH', 'out.svg')
p... | 8 | 370 |
cs249r_book | interviews/vault/visuals/cloud/cloud-4517.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(8, 4))
colors = ['#cfe2f3', '#d4edda', '#fdebd0', '#cccccc']
for i in range(4):
for j in range(4):
ax.broken_barh([(i + j, 0.8)], (3 - i - 0.4, 0.8), facecolors=colors[j%4], edgecolors='#4a90c4')
ax.set_yticks([0, 1, 2, 3])
ax.set_yti... | 12 | 524 |
cs249r_book | interviews/vault/visuals/cloud/cloud-2857.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
mu = 150
lambda_vals = np.linspace(0, 140, 100)
latency = 1 / (mu - lambda_vals) * 1000
fig, ax = plt.subplots(figsize=(6, 4))
ax.plot(lambda_vals, latency, color='#4a90c4', linewidth=2)
ax.scatter([50, 125], [10, 40], color='#c87b2a', zorder=5)
ax.annotate('... | 18 | 771 |
cs249r_book | interviews/vault/visuals/cloud/cloud-2854.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 4))
tiers = ['CPU DRAM\n(PCIe Gen5)', 'Effective Target', 'HBM3 (H100)']
bw = [64, 1600, 3200]
ax.bar(tiers, bw, color=['#cfe2f3', '#fdebd0', '#d4edda'], edgecolor='black')
ax.set_ylabel('Bandwidth (GB/s)')
ax.set_title('Memory Tier Bandwidth ... | 13 | 522 |
cs249r_book | interviews/vault/visuals/cloud/cloud-2862.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Patch
time = np.arange(0, 60)
state = []
for t in time:
if 0 <= t < 10: state.append(1)
elif 10 <= t < 15: state.append(2)
elif 15 <= t < 25: state.append(1)
elif 25 <= t < 30: state.append(2)
elif 30 <= t <... | 28 | 1,139 |
cs249r_book | interviews/vault/visuals/cloud/cloud-4527.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(figsize=(5,3))
ax.bar(['Theoretical HBM', 'Effective'], [5300, 331], color=['#cfe2f3', '#fdebd0'], edgecolor=['#4a90c4', '#c87b2a'])
ax.set_ylabel('Bandwidth (GB/s)')
plt.savefig(os.environ.get('VISUAL_OUT_PATH', 'out.svg'), format='svg... | 7 | 343 |
cs249r_book | interviews/vault/visuals/cloud/cloud-2856.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(8, 4))
stages = 4
microbatches = 8
colors = ['#cfe2f3', '#d4edda']
for s in range(stages):
for m in range(microbatches):
ax.barh(stages - 1 - s, 0.8, left=s+m, height=0.6, color=colors[0], edgecolor='black')
for m in range(microba... | 18 | 744 |
cs249r_book | interviews/vault/visuals/cloud/cloud-4524.py | .py | import os
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(figsize=(6,2))
ax.barh(['Network'], [50], color='#fdebd0', edgecolor='#c87b2a', label='Latency (ms)')
ax.barh(['Buffer Fill'], [50], color='#d4edda', edgecolor='#3d9e5a', label='100MB Buffer')
ax.set_xlabel('Time (ms)')
ax.legend()
plt.... | 9 | 408 |
cs249r_book | interviews/vault/visuals/cloud/cloud-4518.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(7, 3))
stages = ['NVMe Storage', 'PCIe Gen5 Bus', 'HBM3 Memory']
throughput = [0.75, 1.5, 3350]
ax.barh(stages, throughput, color='#cfe2f3', edgecolor='#4a90c4')
ax.set_xscale('log')
ax.set_xlabel('Required / Max Throughput (GB/s, Log Scale)')
ax... | 10 | 438 |
cs249r_book | interviews/vault/visuals/cloud/cloud-2848.py | .py | #!/usr/bin/env python3
"""Pipeline-parallelism bubble timeline (1F1B variant, 4 stages × 4 micro-batches).
Visualizes the warm-up + steady-state + cool-down regions of a 1F1B
schedule on 4 GPUs. Bubble fraction = (P-1) / (P-1+M) where P is the
number of pipeline stages and M is the number of micro-batches.
Renders to... | 117 | 4,203 |
cs249r_book | interviews/vault/visuals/cloud/cloud-4520.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 4))
ax.plot([1, 2, 3, 4, 5], [1, 2, 3, 4, 4], label='GPipe', color='#4a90c4', marker='o')
ax.plot([1, 2, 3, 4, 5], [1, 2, 2, 2, 2], label='1F1B', color='#3d9e5a', marker='x')
ax.set_xlabel('Time Step')
ax.set_ylabel('Active Microbatches in Mem... | 10 | 456 |
cs249r_book | interviews/vault/visuals/cloud/cloud-2847.py | .py | #!/usr/bin/env python3
"""Queueing hockey-stick curve: M/M/1 response time vs. utilization.
Plots the canonical 1/(1-rho) blowup, with P50 and P99 latency proxies
and a horizontal SLO line. The crossing point is the critical
operating utilization — past that, tail latency runs away.
Renders to $VISUAL_OUT_PATH (set b... | 59 | 2,154 |
cs249r_book | interviews/vault/visuals/cloud/cloud-4498.py | .py | import os
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(5,3))
ax.bar(['Disk', 'CPU', 'PCIe', 'GPU'], [8000, 5200, 15000, 5120], color='#cfe2f3', edgecolor='#4a90c4')
ax.axhline(5120, color='#c87b2a', linestyle='--', label='Min Required')
ax.set_ylabel('Images / Second')
ax.legend()
out = os.environ.ge... | 9 | 403 |
cs249r_book | interviews/vault/visuals/cloud/cloud-2852.py | .py | import os
import matplotlib.pyplot as plt
def draw_diagram():
fig, ax = plt.subplots(figsize=(10, 3.5))
ax.set_xlim(0, 100)
ax.set_ylim(0, 10)
ax.axis('off')
# Timeline
ax.plot([5, 95], [5, 5], color='black', linewidth=2)
# Checkpoints
ax.plot([25, 25], [4.5, 5.5], color='#4a9... | 46 | 1,740 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.