-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ce6e6f7c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b1432d29", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"\n", | ||
"\n", | ||
"file_name = \"SN40L_updated_results.csv\"\n", | ||
"\n", | ||
"\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 11, | ||
"id": "35cfc93b", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import csv\n", | ||
"\n", | ||
"def read_csv_without_header(csv_file):\n", | ||
" with open(csv_file, \"r\", newline=\"\") as f:\n", | ||
" reader = csv.reader(f)\n", | ||
" next(reader)\n", | ||
"\n", | ||
" rows = []\n", | ||
" for row in reader:\n", | ||
" rows.append(row)\n", | ||
" return rows\n", | ||
"\n", | ||
"\n", | ||
"def get_matching_row(hardware, numhardware, framework, network, inp_out, batch):\n", | ||
" csv_file = \"../SN40L_updated_results.csv\"\n", | ||
" rows = read_csv_without_header(csv_file)\n", | ||
" \n", | ||
" for row in rows:\n", | ||
" if row != []:\n", | ||
" Hardware = str(row[0]) \n", | ||
" Num_of_Hardware = int(row[1])\n", | ||
" Framework = str(row[2])\n", | ||
" Model = str(row[3])\n", | ||
" Input_Output_Length = int(row[4]) \n", | ||
" Batch_Size = int(row[5])\n", | ||
" Throughput = float(row[6])\n", | ||
" \n", | ||
" \n", | ||
" if Hardware == hardware:\n", | ||
" if Num_of_Hardware == numhardware:\n", | ||
" if Framework == framework:\n", | ||
" if Model == network:\n", | ||
" if Input_Output_Length == inp_out:\n", | ||
" if Batch_Size == batch:\n", | ||
" latency = float((batch*(Input_Output_Length + Input_Output_Length))/Throughput)\n", | ||
" \n", | ||
" list_1 = [Hardware,Num_of_Hardware,Framework,Model,Input_Output_Length,Batch_Size,latency,Throughput]\n", | ||
" \n", | ||
" with open(\"SN40L_latency_throughput.csv\", 'a', newline = '') as csvfile:\n", | ||
" writer = csv.writer(csvfile)\n", | ||
" writer.writerow(list_1) \n", | ||
" \n", | ||
" csvfile.close()\n", | ||
" \n", | ||
"def get_data_rows():\n", | ||
" \n", | ||
" for framework in [\"sambaflow\"]:\n", | ||
" for hardware in [\"SambaNova SN40L\"]:\n", | ||
" for network in [\"meta-llama/Meta-Llama-3-70B\"]:\n", | ||
" inp_out_list = []\n", | ||
" for inp_out in [128, 256, 512, 1024, 2048]:\n", | ||
" for numhardware in [8]:\n", | ||
" for batch in [1,16]:\n", | ||
" get_matching_row(hardware, numhardware, framework, network, inp_out, batch)\n", | ||
"get_data_rows() " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "97aab62d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "fbf08689", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "103697c9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "9bf8c083", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "7a35ca51", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1cfc74dc", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"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.11.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "6527cb23", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "af24bbbf", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "0a21ad9d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib.pyplot as plt\n", | ||
"import numpy as np\n", | ||
"from matplotlib.ticker import FuncFormatter\n", | ||
"import csv\n", | ||
"\n", | ||
"def read_csv_without_header(csv_file):\n", | ||
" with open(csv_file, \"r\", newline=\"\") as f:\n", | ||
" reader = csv.reader(f)\n", | ||
" next(reader)\n", | ||
"\n", | ||
" rows = []\n", | ||
" for row in reader:\n", | ||
" rows.append(row)\n", | ||
" return rows\n", | ||
"\n", | ||
"\n", | ||
"def get_matching_row(hardware, numhardware, framework, network, KV_block_size, batch):\n", | ||
" csv_file = \"All_results.csv\"\n", | ||
" rows = read_csv_without_header(csv_file)\n", | ||
" \n", | ||
" for row in rows:\n", | ||
" if row != []:\n", | ||
" Hardware = str(row[0]) \n", | ||
" Num_of_Hardware = int(row[1])\n", | ||
" Framework = str(row[2])\n", | ||
" Model = str(row[3])\n", | ||
" Input_Output_Length = int(row[4]) \n", | ||
" Batch_Size = int(row[5])\n", | ||
" Latency = float(row[6])\n", | ||
" Throughput = float(row[7])\n", | ||
" \n", | ||
" if Hardware == hardware:\n", | ||
" if Num_of_Hardware == numhardware:\n", | ||
" if Framework == framework:\n", | ||
" if Model == network:\n", | ||
" if Input_Output_Length == inp_out:\n", | ||
" if Batch_Size == batch:\n", | ||
" return Throughput\n", | ||
" return None\n", | ||
" \n", | ||
"\n", | ||
"def get_data_rows():\n", | ||
" \n", | ||
" results_data = []\n", | ||
" \n", | ||
" for KV_block_size in [8, 16, 32, 64, 128]:\n", | ||
" batch_row = []\n", | ||
" for batch in [1, 16, 32, 64]:\n", | ||
" for hardware in [\"Nvidia A100 GPU\"]:\n", | ||
" for numhardware in [1]:\n", | ||
" for network in [\"meta-llama/Meta-Llama-3-8B\"]:\n", | ||
" for framework in [\"vLLM\"]:\n", | ||
" throughput = get_matching_row(hardware, numhardware, framework, network, KV_block_size, batch)\n", | ||
" batch_row.append(throughput)\n", | ||
" results_data.append(batch_row)\n", | ||
" \n", | ||
" x_axis_labels = [1, 16, 32, 64]\n", | ||
" legends = [8, 16, 32, 64, 128]\n", | ||
"\n", | ||
" colors = ['#08519c', '#a63603', '#006d2c', '#a50f15', '#54278f']\n", | ||
" symbols = ['o', 'p', 'd', 's', 'v']\n", | ||
" \n", | ||
" return results_data, x_axis_labels, legends, colors, symbols\n", | ||
"\n", | ||
"\n", | ||
"\n", | ||
"def plot_multiple_lines(lines_data, x_axis_labels, legends, colors, symbols, title, xlabel, \n", | ||
" ylabel, linewidth, markersize, fontsize, n_cols_legend,\n", | ||
" fig_plot_length, fig_plot_height, legend_title, save_pdf, labelspacing, columnspacing):\n", | ||
" \n", | ||
" plt.figure(figsize=(fig_plot_length, fig_plot_height))\n", | ||
" plt.rcParams['font.family'] = 'Century Schoolbook'\n", | ||
" \n", | ||
" for i, line_data in enumerate(lines_data):\n", | ||
" \n", | ||
" valid_y_axis = [x for x in line_data if x is not None]\n", | ||
" valid_x_axis = x_axis_labels[0:len(valid_y_axis)]\n", | ||
" \n", | ||
" plt.plot(valid_x_axis, valid_y_axis, color=colors[i], marker=symbols[i], \n", | ||
" label=str(legends[i]), linewidth = linewidth, markersize = markersize)\n", | ||
" \n", | ||
" for x_value in x_axis_labels:\n", | ||
" plt.axvline(x=x_value, color='gray', linestyle='-', alpha=0.5)\n", | ||
" \n", | ||
" \n", | ||
" plt.title(title, fontsize = fontsize)\n", | ||
" \n", | ||
" plt.xlabel(xlabel, fontsize = fontsize)\n", | ||
" plt.ylabel(ylabel, fontsize = fontsize)\n", | ||
" \n", | ||
" plt.xticks(x_axis_labels, fontsize = fontsize)\n", | ||
" plt.yticks(fontsize = fontsize)\n", | ||
" \n", | ||
" def thousands_formatter(x, pos):\n", | ||
" return f'{int(x/1000)}k'\n", | ||
" \n", | ||
" plt.gca().yaxis.set_major_formatter(FuncFormatter(thousands_formatter))\n", | ||
" \n", | ||
" plt.legend(title=legend_title, loc='lower center', bbox_to_anchor=(0.5, -0.72), \n", | ||
" ncol=n_cols_legend, fontsize = fontsize, title_fontsize = fontsize, frameon = False, \n", | ||
" handlelength = 0, labelspacing = labelspacing, columnspacing = columnspacing)\n", | ||
" \n", | ||
" plt.savefig(save_pdf, dpi=300, bbox_inches='tight', pad_inches=0.03)\n", | ||
" plt.show()\n", | ||
" \n", | ||
"\n", | ||
"lines_data, x_axis_labels, legends, colors, symbols = get_data_rows()\n", | ||
"\n", | ||
"plot_title = \"vLLM: Batch Size vs Input/Output Length \\n of LLaMA-3-8B on a Single A100 GPU\"\n", | ||
"x_axis_title = \"Batch Size\"\n", | ||
"y_axis_title = \"Throughput (Tokens/sec)\"\n", | ||
"\n", | ||
"linewidth = 3\n", | ||
"markersize = 8\n", | ||
"fontsize = 20\n", | ||
"\n", | ||
"n_cols_legend = len(legends) \n", | ||
"\n", | ||
"fig_plot_length = 6\n", | ||
"fig_plot_height = 2.8\n", | ||
"\n", | ||
"labelspacing = 0.2\n", | ||
"columnspacing = 0.6\n", | ||
"\n", | ||
"legend_title = \"Input/Output Length\"\n", | ||
"\n", | ||
"save_pdf = \"llama_3_batch_size_vs_input_length_vLLM.pdf\"\n", | ||
"\n", | ||
"plot_multiple_lines(lines_data, x_axis_labels, legends, colors, symbols, \n", | ||
" plot_title, x_axis_title, y_axis_title, \n", | ||
" linewidth, markersize, fontsize, n_cols_legend, \n", | ||
" fig_plot_length, fig_plot_height, legend_title, save_pdf, labelspacing, columnspacing)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b05bfb94", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e599f039", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5e76e5f8", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"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.11.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.