Skip to content

Commit

Permalink
process more perf data into df, export to matlab
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerbarton committed Feb 15, 2024
1 parent 303d319 commit 8ba104d
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 33 deletions.
101 changes: 68 additions & 33 deletions target/sim/bench.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"metadata": {},
"outputs": [],
"source": [
"!python -m pip install pandas plotly pyyaml"
"!python -m pip install pandas plotly pyyaml scipy"
]
},
{
Expand Down Expand Up @@ -330,22 +330,6 @@
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "813a82e1-5683-497a-8603-545cb55baada",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "46335c5f-0802-4541-8ebe-5f3ef2de12e4",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "db94fbb4-44d3-4ca1-a271-5be3d0f904f5",
Expand Down Expand Up @@ -616,32 +600,33 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6186458e-484c-495a-8b5a-1bd5883667ac",
"id": "75cb302d-07aa-49e9-819a-0487738bcea2",
"metadata": {},
"outputs": [],
"source": [
"import hjson\n",
"from pathlib import Path\n",
"dfs = []\n",
"for i in range(4):\n",
" with Path(f'logs_{i}/params.hjson').open() as f:\n",
" param = hjson.loads(f.read())\n",
" df1 = pd.json_normalize(param)\n",
" df1.index = df1.index + i\n",
" dfs.append(df1)\n",
"runs = pd.concat(dfs)\n",
"runs"
"import pandas as pd\n",
"import plotly.express as px"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "481d6636-026f-4111-88e6-b86773d1aa03",
"id": "74f75c0a-47e4-432a-bf91-3750988e64ed",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import plotly.express as px"
"dfs = []\n",
"n_runs = 11\n",
"for i in range(n_runs):\n",
" with Path(f'logs_{i}/params.hjson').open() as f:\n",
" param = hjson.loads(f.read())\n",
" df1 = pd.json_normalize(param)\n",
" df1.index = df1.index + i\n",
" dfs.append(df1)\n",
"runs = pd.concat(dfs)\n",
"runs"
]
},
{
Expand All @@ -657,7 +642,7 @@
"end_region = -2\n",
"\n",
"dfs = []\n",
"for run_id in range(4):\n",
"for run_id in range(n_runs):\n",
" for i in range(9):\n",
" hart_type = 'dma' if i % 9 == 8 else 'fpu'\n",
" p = [i % 9, int(i / 9), 0]\n",
Expand Down Expand Up @@ -703,15 +688,35 @@
"perf"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "015c33a5-e12c-459f-8a7c-fa0980fe66f0",
"metadata": {},
"outputs": [],
"source": [
"perf[(perf['hart_type'] == 'fpu') & (perf['region_id'] == 2)][['fpss_fpu_occupancy','gemmInfo.K','gemmInfo.N']]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "05415f8f-b48f-4e4c-a783-35a0e4575ca0",
"metadata": {},
"outputs": [],
"source": [
"# px.violin(perf[(perf['hart_type'] == 'fpu') & (perf['region_id'] == 2)], 'gemmInfo.K', 'fpss_fpu_occupancy', violinmode='overlay')\n",
"px.bar(perf[(perf['hart_type'] == 'fpu')], 'gemmInfo.K', 'fpss_fpu_occupancy', color='region_id')"
"# px.violin(perf[(perf['hart_type'] == 'fpu') & (perf['region_id'] == 2)], color='gemmInfo.K', y='fpss_fpu_occupancy', violinmode='overlay')\n",
"px.scatter(perf[(perf['hart_type'] == 'fpu')], 'gemmImpl.L1_K', 'fpss_fpu_occupancy', color='gemmImpl.L1_N', log_x=True, range_y=[0,1])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "710efc36-a758-4571-83db-bd46b3ce6105",
"metadata": {},
"outputs": [],
"source": [
"px.scatter(perf[(perf['hart_type'] == 'fpu')], 'gemmImpl.L1_K', 'cycles', color='gemmImpl.L1_N', log_x=True)"
]
},
{
Expand Down Expand Up @@ -754,6 +759,36 @@
"px.violin(perf[(perf['cycles'] < 1000) & (perf['fpss_occupancy'] == 0)], 'cycles')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6b80cbd5-49a7-4067-bc25-4b846f7ae433",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "cf2bab5d-ee65-4dca-84fa-e067d44f8cd8",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "4d4799a3-c653-438b-b4b1-4d209a7deb43",
"metadata": {},
"outputs": [],
"source": [
"# Export df to matlab\n",
"import scipy.io as sio\n",
"import re\n",
"out = perf[(perf['hart_type'] == 'fpu') & (perf['region_id'] == 2)]\n",
"sio.savemat('./logs/perf.mat', out.rename(columns=lambda x: re.sub('[\\. -]','_',x)).to_dict('list'))"
]
},
{
"cell_type": "markdown",
"id": "925ac4a8-de21-4203-b52a-185aaa3c212c",
Expand Down
File renamed without changes.

0 comments on commit 8ba104d

Please sign in to comment.