622 строки
100 KiB
Plaintext
622 строки
100 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"id": "supreme-skirt",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import os\n",
|
||
|
"import pandas as pd\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import pylab"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"id": "racial-savage",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"plt.rcParams[\"font.size\"] = 18\n",
|
||
|
"plt.rcParams[\"font.family\"] = \"Times New Roman\""
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"id": "romance-wichita",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"FIGURES_DIR = \"figures/mlsys22\""
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "structural-newman",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Simulator accuracy"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"id": "civic-auditor",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def get_parallelism_style(dp, hp, pp):\n",
|
||
|
" if dp == 1 and hp == 1 and pp == 1:\n",
|
||
|
" return \"Base\"\n",
|
||
|
" elif dp > 1 and hp == 1 and pp == 1:\n",
|
||
|
" return \"D\"\n",
|
||
|
" elif dp == 1 and hp > 1 and pp == 1:\n",
|
||
|
" return \"T\"\n",
|
||
|
" elif dp == 1 and hp == 1 and pp > 1:\n",
|
||
|
" return \"P\"\n",
|
||
|
" elif dp > 1 and hp > 1 and pp == 1:\n",
|
||
|
" return \"D/T\"\n",
|
||
|
" elif dp == 1 and hp > 1 and pp > 1:\n",
|
||
|
" return \"T/P\"\n",
|
||
|
" elif dp > 1 and hp == 1 and pp > 1:\n",
|
||
|
" return \"D/P\"\n",
|
||
|
" elif dp > 1 and hp > 1 and pp > 1:\n",
|
||
|
" return \"D/T/P\"\n",
|
||
|
" else:\n",
|
||
|
" raise ValueError(f\"Invalid degree combination dp={dp}, hp={hp}, pp={pp}\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 5,
|
||
|
"id": "prerequisite-exchange",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def plot_simulator_accuracy(\n",
|
||
|
" pytorch_filename,\n",
|
||
|
" simulation_filename,\n",
|
||
|
" x,\n",
|
||
|
" y,\n",
|
||
|
" xlabel,\n",
|
||
|
" ylabel,\n",
|
||
|
" xstep,\n",
|
||
|
" ystep,\n",
|
||
|
" output_filename,\n",
|
||
|
" legend_output_filename=None,\n",
|
||
|
"):\n",
|
||
|
" df = pd.read_csv(pytorch_filename)\n",
|
||
|
" df_simulation = pd.read_csv(simulation_filename)\n",
|
||
|
" df = df.rename(\n",
|
||
|
" columns={\"latency\": \"pytorch_latency\", \"throughput\": \"pytorch_throughput\"}\n",
|
||
|
" )\n",
|
||
|
" df[\"simulated_latency\"] = df_simulation[\"latency\"]\n",
|
||
|
" df[\"simulated_throughput\"] = df_simulation[\"throughput\"]\n",
|
||
|
" parallelism_styles = [\n",
|
||
|
" get_parallelism_style(dp, hp, pp)\n",
|
||
|
" for (dp, hp, pp) in df[[\"dp_degree\", \"hp_degree\", \"pp_degree\"]].values\n",
|
||
|
" ]\n",
|
||
|
" df[\"parallelism_style\"] = parallelism_styles\n",
|
||
|
" markers = [\"o\", \"P\", \"^\", \"*\", \"X\", \"D\", \"H\", \"s\"]\n",
|
||
|
" colors = [\n",
|
||
|
" \"#7f7f7f\", # middle gray\n",
|
||
|
" \"#1f77b4\", # muted blue\n",
|
||
|
" \"#ff7f0e\", # safety orange\n",
|
||
|
" \"#2ca02c\", # cooked asparagus green\n",
|
||
|
" \"#d62728\", # brick red\n",
|
||
|
" \"#9467bd\", # muted purple\n",
|
||
|
" \"#8c564b\", # chestnut brown\n",
|
||
|
" \"#e377c2\", # raspberry yogurt pink\n",
|
||
|
" # \"#bcbd22\", # curry yellow-green\n",
|
||
|
" # \"#17becf\", # blue-teal\n",
|
||
|
" ]\n",
|
||
|
" parallelism_styles = [\n",
|
||
|
" \"Base\",\n",
|
||
|
" \"D\",\n",
|
||
|
" \"T\",\n",
|
||
|
" \"P\",\n",
|
||
|
" \"D/T\",\n",
|
||
|
" \"T/P\",\n",
|
||
|
" \"D/P\",\n",
|
||
|
" \"D/T/P\",\n",
|
||
|
" ]\n",
|
||
|
" lines = []\n",
|
||
|
" fig = pylab.figure(figsize=(5, 5))\n",
|
||
|
" ax = fig.add_subplot(111)\n",
|
||
|
" figlegend = pylab.figure(figsize=(5, 1))\n",
|
||
|
" for (parallelism_style, marker, color) in zip(parallelism_styles, markers, colors):\n",
|
||
|
" lines.append(\n",
|
||
|
" ax.scatter(\n",
|
||
|
" df[df[\"parallelism_style\"] == parallelism_style][x],\n",
|
||
|
" df[df[\"parallelism_style\"] == parallelism_style][y],\n",
|
||
|
" label=parallelism_style,\n",
|
||
|
" marker=marker,\n",
|
||
|
" color=color,\n",
|
||
|
" s=100,\n",
|
||
|
" zorder=3\n",
|
||
|
" )\n",
|
||
|
" )\n",
|
||
|
" min_val = min(min(df[x]), min(df[y]))\n",
|
||
|
" max_val = max(max(df[x]), max(df[y]))\n",
|
||
|
" ax.plot(\n",
|
||
|
" [min_val, max_val],\n",
|
||
|
" [min_val, max_val],\n",
|
||
|
" linestyle=\"--\",\n",
|
||
|
" color=\"black\",\n",
|
||
|
" zorder=2,\n",
|
||
|
" )\n",
|
||
|
" # ax.set_yticks(np.arange(0, max(df[y]) + ystep, ystep))\n",
|
||
|
" xticks = np.arange(0, max(df[x]) + xstep, xstep)\n",
|
||
|
" yticks = np.arange(0, max(df[x]) + ystep, ystep)\n",
|
||
|
" ax.set_xticks(xticks)\n",
|
||
|
" ax.set_xticklabels([str(int(t)) for t in xticks])\n",
|
||
|
" ax.set_yticks(yticks)\n",
|
||
|
" ax.set_yticklabels([str(int(t)) for t in yticks])\n",
|
||
|
" ax.set_xlabel(xlabel)\n",
|
||
|
" ax.set_ylabel(ylabel)\n",
|
||
|
" ax.grid(zorder=0)\n",
|
||
|
" leg = figlegend.legend(\n",
|
||
|
" lines,\n",
|
||
|
" parallelism_styles,\n",
|
||
|
" frameon=False,\n",
|
||
|
" loc=\"center\",\n",
|
||
|
" ncol=4,\n",
|
||
|
" columnspacing=None,\n",
|
||
|
" labelspacing=None,\n",
|
||
|
" )\n",
|
||
|
" fig.savefig(output_filename, bbox_inches=\"tight\")\n",
|
||
|
" if legend_output_filename is not None:\n",
|
||
|
" figlegend.savefig(legend_output_filename, bbox_inches=\"tight\")\n",
|
||
|
" # Get the bounding box of the original legend.\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"# bb = leg.get_bbox_to_anchor().transformed(plt.gca().transAxes.inverted())\n",
|
||
|
"\n",
|
||
|
"# # Change to location of the legend.\n",
|
||
|
"# yOffset = 1.2\n",
|
||
|
"# bb.y0 += yOffset\n",
|
||
|
"# bb.y1 += yOffset\n",
|
||
|
"# leg.set_bbox_to_anchor(bb, transform=plt.gca().transAxes)\n",
|
||
|
"# leg.get_frame().set_linewidth(0.0)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "empirical-registrar",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### MLP Training"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"id": "voluntary-refund",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
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//fdp2LBhsrtUIzHFYhiGEQUjR46kb9++HHXUUYwbN85mKxEwxWIYhhEF+fn5XHHFFYwZM6Yst4oRGlMshmEYERg1ahSFhYXsvPPOPPzww+Tm5ia7SzUeUyyGYRhhGDJkCCeddBJPPvlksruSUphiMQzDCEJVuf3227nllls455xzuPTSS5PdpZTCHCQNwzB8qCo333wz99xzD3379uXpp58mMzMz2d1KKWzGYhiG4WPRokU88cQT9O/fn2eeecaUShVI6RmLiNQF/gucCeQCnwLXquoCn0w7T+YPYFdcIq8ZQe0kTMYwjJqJqiIitGnThhkzZrDHHnsgIsnuVkqS0ooFGAoocA2wP3Ad0FlEOqrqGhFpDRQAJ6jqVBHJA6aIyMGqOg8gkTKGYdRMSktLGThwIHvttRfXX389e+65Z7K7lNKk7FKYiDQFFqrqAFV9Q1VvAS4D2gAneGL3AItUdSqAqs4FZgH3+5pKpIxhGDWMkpISLrzwQoYPH87q1auT3Z20IGUVi8fDQddveucdRaQecBIuj72f6cBxItIkkTKxDswwjOqnuLiYu+++m+eff5477riDu+66K9ldSgtSdilMVVeFKM72zp8CnXF2lxVBMkuBTK9+awJlJkUxLMMwEoSqcs455zBp0iSGDBnCTTfdlOwupQ0pq1jCcCwwQVW/EpFTvLKVQTLrvfPOQFECZSogIv2AfgDNmjWjoKAglFhasGHDhrQdXzqPDdJ7fC1btuSCCy7g0EMPTdsxJoO0USwiUge4BLdDzM+moOvA3sFCQBIoUwFVHQ4MB8jLy9P8/PxQYmlBQUEB6Tq+dB4bpN/
|
||
|
"text/plain": [
|
||
|
"<Figure size 360x360 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<Figure size 360x72 with 0 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"simulation_filename = \"~/Downloads/mlp_grid_search_results_simulation_v100.csv\"\n",
|
||
|
"pytorch_filename = \"~/Downloads/mlp_grid_search_results_pytorch_v100.csv\"\n",
|
||
|
"plot_simulator_accuracy(\n",
|
||
|
" pytorch_filename,\n",
|
||
|
" simulation_filename,\n",
|
||
|
" \"pytorch_throughput\",\n",
|
||
|
" \"simulated_throughput\",\n",
|
||
|
" \"PyTorch throughput\\n(samples / second)\",\n",
|
||
|
" \"Simulated throughput\\n(samples /second)\",\n",
|
||
|
" 5000,\n",
|
||
|
" 2500,\n",
|
||
|
" os.path.join(FIGURES_DIR, \"mlp_training_pytorch_vs_simulated_throughput.pdf\"),\n",
|
||
|
" os.path.join(FIGURES_DIR, \"pytorch_vs_simulated_throughput_legend.pdf\"),\n",
|
||
|
")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "advanced-woman",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### GPT-2 Inference"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "reflected-cause",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### TODO"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "american-petroleum",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Optimal configurations"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 7,
|
||
|
"id": "magnetic-playback",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def plot_optimal_configurations(\n",
|
||
|
" pytorch_filename,\n",
|
||
|
" all_model_sizes,\n",
|
||
|
" metric,\n",
|
||
|
" output_filename,\n",
|
||
|
" legend_output_filename=None,\n",
|
||
|
"):\n",
|
||
|
" def get_data(model_size):\n",
|
||
|
" if metric == \"throughput\":\n",
|
||
|
" sort_fn = max\n",
|
||
|
" elif metric == \"latency\":\n",
|
||
|
" sort_fn = min\n",
|
||
|
" df = pd.read_csv(pytorch_filename)\n",
|
||
|
" # df = df[df[\"model_size\"] == model_size]\n",
|
||
|
" df = df[\n",
|
||
|
" df[\"model_size\"] == all_model_sizes[0]\n",
|
||
|
" ] # TODO: Fix this, only for demonstration purposes\n",
|
||
|
" df = df.sort_values(by=[\"throughput\"], ascending=False)\n",
|
||
|
" data = [\n",
|
||
|
" sort_fn(\n",
|
||
|
" df[\n",
|
||
|
" (df[\"dp_degree\"] == 1)\n",
|
||
|
" & (df[\"hp_degree\"] == 1)\n",
|
||
|
" & (df[\"pp_degree\"] == 1)\n",
|
||
|
" ][metric].values\n",
|
||
|
" ),\n",
|
||
|
" sort_fn(\n",
|
||
|
" df[\n",
|
||
|
" (df[\"dp_degree\"] > 1)\n",
|
||
|
" & (df[\"hp_degree\"] == 1)\n",
|
||
|
" & (df[\"pp_degree\"] == 1)\n",
|
||
|
" ][metric].values\n",
|
||
|
" ),\n",
|
||
|
" sort_fn(\n",
|
||
|
" df[\n",
|
||
|
" (df[\"dp_degree\"] == 1)\n",
|
||
|
" & (df[\"hp_degree\"] > 1)\n",
|
||
|
" & (df[\"pp_degree\"] == 1)\n",
|
||
|
" ][metric].values\n",
|
||
|
" ),\n",
|
||
|
" sort_fn(\n",
|
||
|
" df[\n",
|
||
|
" (df[\"dp_degree\"] == 1)\n",
|
||
|
" & (df[\"hp_degree\"] == 1)\n",
|
||
|
" & (df[\"pp_degree\"] > 1)\n",
|
||
|
" ][metric].values\n",
|
||
|
" ),\n",
|
||
|
" sort_fn(\n",
|
||
|
" df[\n",
|
||
|
" ((df[\"dp_degree\"] > 1) & (df[\"hp_degree\"] > 1))\n",
|
||
|
" | ((df[\"dp_degree\"] > 1) & (df[\"pp_degree\"] > 1))\n",
|
||
|
" | ((df[\"hp_degree\"] > 1) & (df[\"pp_degree\"] > 1))\n",
|
||
|
" ][metric].values\n",
|
||
|
" ),\n",
|
||
|
" ]\n",
|
||
|
" base = data[0]\n",
|
||
|
" if metric == \"throughput\":\n",
|
||
|
" data = [v / base for v in data[1:]]\n",
|
||
|
" elif metric == \"latency\":\n",
|
||
|
" data = [base / v for v in data[1:]]\n",
|
||
|
" return data\n",
|
||
|
"\n",
|
||
|
" fig = pylab.figure(figsize=(5, 5))\n",
|
||
|
" ax = fig.add_subplot(111)\n",
|
||
|
" figlegend = pylab.figure(figsize=(5, 1))\n",
|
||
|
" width = 0.65 / len(all_model_sizes)\n",
|
||
|
" if len(all_model_sizes) > 1:\n",
|
||
|
" offsets = np.arange(\n",
|
||
|
" -1 * width, 4 * width, width\n",
|
||
|
" ) # TODO: Fix for even number of model sizes\n",
|
||
|
" else:\n",
|
||
|
" offsets = [0]\n",
|
||
|
" patterns = [\"/\", \"x\", \"+\"]\n",
|
||
|
" lines = []\n",
|
||
|
" max_val = -1\n",
|
||
|
" for i, model_size in enumerate(all_model_sizes):\n",
|
||
|
" data = get_data(model_size)\n",
|
||
|
" x = np.array(list(range(len(data)))) + offsets[i]\n",
|
||
|
" if i == 0:\n",
|
||
|
" lines.append(\n",
|
||
|
" ax.bar(x, height=data, width=width, label=model_size, zorder=3)\n",
|
||
|
" )\n",
|
||
|
" else:\n",
|
||
|
" lines.append(\n",
|
||
|
" ax.bar(\n",
|
||
|
" x,\n",
|
||
|
" height=data,\n",
|
||
|
" width=width,\n",
|
||
|
" label=model_size,\n",
|
||
|
" hatch=patterns[i - 1],\n",
|
||
|
" zorder=3,\n",
|
||
|
" )\n",
|
||
|
" )\n",
|
||
|
" max_val = max(max(data), max_val)\n",
|
||
|
" # for j in range(len(data)):\n",
|
||
|
" # plt.text(j+offsets[i], data[j] + 0.05 * data[0], f\"{data[j]:.2f}.x\", ha=\"center\")\n",
|
||
|
" ax.set_xticks(ticks=np.array(list(range(len(data)))))\n",
|
||
|
" ax.set_xticklabels([\"D\", \"T\", \"P\", \"Hybrid\"])\n",
|
||
|
" ax.set_xlabel(\"Configuration\")\n",
|
||
|
" ax.set_ylabel(\"Speedup\")\n",
|
||
|
" ax.set_ylim(0, 1.2 * max_val)\n",
|
||
|
" spines = list(ax.spines.keys())\n",
|
||
|
" ax.spines[spines[1]].set_visible(False)\n",
|
||
|
" ax.spines[spines[3]].set_visible(False)\n",
|
||
|
" leg = figlegend.legend(\n",
|
||
|
" lines,\n",
|
||
|
" all_model_sizes,\n",
|
||
|
" frameon=False,\n",
|
||
|
" loc=\"center\",\n",
|
||
|
" ncol=4,\n",
|
||
|
" columnspacing=None,\n",
|
||
|
" labelspacing=None,\n",
|
||
|
" )\n",
|
||
|
" ax.grid(zorder=0)\n",
|
||
|
" fig.savefig(output_filename, bbox_inches=\"tight\")\n",
|
||
|
" if legend_output_filename is not None:\n",
|
||
|
" figlegend.savefig(legend_output_filename, bbox_inches=\"tight\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "coordinated-thesis",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### MLP Training"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 8,
|
||
|
"id": "collect-input",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAVcAAAFJCAYAAAAv7W7zAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAAAsTAAALEwEAmpwYAAAmxUlEQVR4nO3debhkVX3u8e8LYhoEDJFBhIaDEhG9RILtVUzETh4HvHq9MWpUjDIo4BAc0UZj1AwajIgKCRDQaIyaOBGvExqNHofIFVFBIMQpHuwQHhEQpREaGn73j72Lrq5Tc+21915V7+d56jnU3jWs/p06L7vW3mstRQRmZlat7ZpugJnZPHK4mpkl4HA1M0vA4WpmloDD1cwsAYermVkCCxGuRx55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wA7NJ5fES8uczV90i6qXzvZ4z7fmZt1cRifLlc95r7KrCjWnwecGNE/BhA0iHAkRGxuftBkvYA/mrcN42ICykGHayakjAizgTO7LN9rBFdZjnJNThSyz1YYUS3QER8pxOspat6g7V0G/DkSltmtgByDY6U5iFYYfK5BfaTdL/uDZLuBpzB6utQzaxmuQcrNNNVksI0y7x8XdIy8CPg14DfBfYD/qTappnZJOYhWGG2rpJNV24a+G+vuz6TXop1McVJrV2Al1JMG3gP4BUR8aaqG2dm45mXYIXZukoGzRXQRH0m7RYgIi6PiMcB9wT2jIg9I+LtlbfMzMYyT8E6q36TsTRVn4nDVdJTJb0iIn5Z3j9R0m7VN83Mhtl05SYHa4/e2a6arM+ks2I9HziLYtm0t0bEdZLOBz4q6cS
|
||
|
"text/plain": [
|
||
|
"<Figure size 360x360 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<Figure size 360x72 with 0 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"pytorch_filename = \"~/Downloads/mlp_grid_search_results_pytorch_v100.csv\"\n",
|
||
|
"plot_optimal_configurations(\n",
|
||
|
" pytorch_filename,\n",
|
||
|
" [\"mlp-xs\", \"mlp-small\", \"mlp-medium\"],\n",
|
||
|
" \"throughput\",\n",
|
||
|
" os.path.join(FIGURES_DIR, \"mlp_training_optimal_configurations.pdf\"),\n",
|
||
|
" os.path.join(FIGURES_DIR, \"mlp_training_optimal_configurations_legend.pdf\"),\n",
|
||
|
")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "white-watts",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### GPT-2 Inference"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "intended-piece",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### TODO"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "silver-tradition",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Memory usage vs throughput / latency"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 11,
|
||
|
"id": "senior-hobby",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def plot_memory_usage_vs_metric(\n",
|
||
|
" simulation_filename, metric, xlabel, ylabel, output_filename, legend_output_filename=None\n",
|
||
|
"):\n",
|
||
|
" df = pd.read_csv(simulation_filename)\n",
|
||
|
" parallelism_styles = [\n",
|
||
|
" get_parallelism_style(dp, hp, pp)\n",
|
||
|
" for (dp, hp, pp) in df[[\"dp_degree\", \"hp_degree\", \"pp_degree\"]].values\n",
|
||
|
" ]\n",
|
||
|
" df[\"parallelism_style\"] = parallelism_styles\n",
|
||
|
" markers = [\"o\", \"P\", \"^\", \"*\", \"X\", \"D\", \"H\", \"s\"]\n",
|
||
|
" colors = [\n",
|
||
|
" \"#7f7f7f\", # middle gray\n",
|
||
|
" \"#1f77b4\", # muted blue\n",
|
||
|
" \"#ff7f0e\", # safety orange\n",
|
||
|
" \"#2ca02c\", # cooked asparagus green\n",
|
||
|
" \"#d62728\", # brick red\n",
|
||
|
" \"#9467bd\", # muted purple\n",
|
||
|
" \"#8c564b\", # chestnut brown\n",
|
||
|
" \"#e377c2\", # raspberry yogurt pink\n",
|
||
|
" # \"#bcbd22\", # curry yellow-green\n",
|
||
|
" # \"#17becf\", # blue-teal\n",
|
||
|
" ]\n",
|
||
|
" parallelism_styles = [\n",
|
||
|
" \"Base\",\n",
|
||
|
" \"D\",\n",
|
||
|
" \"T\",\n",
|
||
|
" \"P\",\n",
|
||
|
" \"D/T\",\n",
|
||
|
" \"T/P\",\n",
|
||
|
" \"D/P\",\n",
|
||
|
" \"D/T/P\",\n",
|
||
|
" ]\n",
|
||
|
" lines = []\n",
|
||
|
" fig = pylab.figure(figsize=(8, 5))\n",
|
||
|
" ax = fig.add_subplot(111)\n",
|
||
|
" figlegend = pylab.figure(figsize=(5, 1))\n",
|
||
|
" for (parallelism_style, marker, color) in zip(parallelism_styles, markers, colors):\n",
|
||
|
" lines.append(\n",
|
||
|
" ax.scatter(\n",
|
||
|
" df[df[\"parallelism_style\"] == parallelism_style][metric],\n",
|
||
|
" df[df[\"parallelism_style\"] == parallelism_style][\"peak_memory\"] / 1e9,\n",
|
||
|
" label=parallelism_style,\n",
|
||
|
" marker=marker,\n",
|
||
|
" color=color,\n",
|
||
|
" s=200,\n",
|
||
|
" zorder=3,\n",
|
||
|
" )\n",
|
||
|
" )\n",
|
||
|
" ax.grid(zorder=0)\n",
|
||
|
" ax.set_xlabel(xlabel)\n",
|
||
|
" ax.set_ylabel(ylabel)\n",
|
||
|
" fig.tight_layout()\n",
|
||
|
" fig.savefig(output_filename, bbox_inches=\"tight\")\n",
|
||
|
" leg = figlegend.legend(\n",
|
||
|
" lines,\n",
|
||
|
" parallelism_styles,\n",
|
||
|
" frameon=False,\n",
|
||
|
" loc=\"center\",\n",
|
||
|
" ncol=8,\n",
|
||
|
" columnspacing=None,\n",
|
||
|
" labelspacing=None,\n",
|
||
|
" )\n",
|
||
|
" if legend_output_filename is not None:\n",
|
||
|
" figlegend.savefig(legend_output_filename, bbox_inches=\"tight\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "buried-tomorrow",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### MLP Training"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 12,
|
||
|
"id": "steady-devil",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
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GNMzjINJT4BOFFV5/kbROQYYB4wWVWXedvOB17N5ebeHCrLVPWJHE5fjtua83ku9zYmr+pWwbI5oA4sexjGXwF9Bpe6VMYY0ym1N1pnXuIGL4h4S1VfTdjWCPwn6I1F5HSgWlXvTNi2nYhk29F2EHCHqsaC3tuYvJt/DThx999O3FpPjDGmAzIFJ6vSbP9Xim31QW4qImcCpwPviMjR3uMU4H4gJiKXiMhLItLXO/4UEblHRHbznu8PnA1cHuS+xhSE32riNLnPnSa39aRudWnLZYwxnVSmbp3eabanGt7TP9sbeiNz7gIEOCZp9y2qGvNGBO0GVHvbP8dNxl0mIv/C7Vr6rqo2ZXtfYwomsdXE57eenHhracpkjDGdWKbg5DARmYUbRCQ6QkTuSdp2YLY3VNWZpJkFNuGYS4FLE54/jRusGFNekltNfH7rieWeGGNMYJmCk77AGWn2TUx6nn6yFGO6smdStJr4nDjMvxpOvK24ZTLGmE4uU87J7cB2qhrK9MCdD2V6cYprTBmpWwVvp2g18TlNbqtKXbr0LWOMMalkCk7uVdXN7V3AOya5m8eYri9Tq4nPRu4YY0xgmdbWeSF5m4gcmu2xxnRp7bWa+Kz1xBhjAkubcyIi2+GOwhkAfKGq7wBniMhBQG3CoQrc583aakz3kE2ria9l5I7lnhhjTDYydetcA7zNtgX+wM0v+Q1wt/eY6T2+U7ASGlNusm018VnriTHGBJJptM4a4HuqelfCtgbgCmBdwrYdgFOA+/JfPGPKUJBWE5+1nhhjTNYyBSf7quqvk7Y9rqoPJx8oIl/Lb7GMKVOO47aaAIQrsz9
|
||
|
"text/plain": [
|
||
|
"<Figure size 576x360 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<Figure size 360x72 with 0 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"simulation_filename = \"~/Downloads/mlp_grid_search_results_simulation_v100.csv\"\n",
|
||
|
"plot_memory_usage_vs_metric(\n",
|
||
|
" simulation_filename,\n",
|
||
|
" \"throughput\",\n",
|
||
|
" \"Throughput (samples / second)\",\n",
|
||
|
" \"Peak Memory (GB)\",\n",
|
||
|
" os.path.join(FIGURES_DIR, \"mlp_training_memory_vs_throughput.pdf\"),\n",
|
||
|
" os.path.join(FIGURES_DIR, \"mlp_training_memory_vs_throughput_legend.pdf\"),\n",
|
||
|
")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "compact-motorcycle",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### GPT-2 Inference"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "electronic-transition",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### TODO"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.9.2"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 5
|
||
|
}
|