Add 256 case

milestone_5_without_improvements-logs
chortas 3 years ago
parent 0f8cbc686b
commit e88a091b10

@ -56,21 +56,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"def analyze(file_name):\n", "def get_data(file_name):\n",
" data = []\n", " data = []\n",
"\n", "\n",
" with open(file_name) as log_file:\n", " with open(file_name) as log_file:\n",
" lines = log_file.readlines()\n", " lines = log_file.readlines()\n",
" print(len(lines))\n",
" for line in lines:\n", " for line in lines:\n",
" row = {}\n", " row = {}\n",
" split_line = line.split()\n", " split_line = line.split()\n",
" if \"USED\" not in split_line or \"ELAPSED\" not in split_line:\n", " if \"USED\" not in split_line or \"ELAPSED\" not in split_line: continue\n",
" continue\n",
" idx_used_mem = split_line.index(\"USED\") + 4\n", " idx_used_mem = split_line.index(\"USED\") + 4\n",
" idx_elapsed = split_line.index(\"ELAPSED\") + 2\n", " idx_elapsed = split_line.index(\"ELAPSED\") + 2\n",
" \n", " \n",
@ -84,8 +82,29 @@
" row[\"time\"] = elapsed\n", " row[\"time\"] = elapsed\n",
" data.append(row)\n", " data.append(row)\n",
" \n", " \n",
" return data"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"def create_df(file_name):\n",
" data = get_data(file_name)\n",
" df = pd.DataFrame(data)\n", " df = pd.DataFrame(data)\n",
" df_grouped = df.groupby(['function']).agg({'time': ['min', 'max', 'mean', 'sum', 'count'], 'memory': ['min', 'max', 'median']})\n", " return df.groupby(['function']).agg({'time': ['min', 'max', 'mean', 'sum', 'count'], 'memory': ['min', 'max', 'median']})"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"def analyze(file_name):\n",
" df_grouped = create_df(file_name)\n",
" return df_grouped.sort_values(by=('time', 'sum'), ascending=False) " " return df_grouped.sort_values(by=('time', 'sum'), ascending=False) "
] ]
}, },
@ -98,7 +117,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 20,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -349,7 +368,7 @@
"clean_real 1 " "clean_real 1 "
] ]
}, },
"execution_count": 19, "execution_count": 20,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1450,10 +1469,45 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 35,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n",
"1\n",
"2\n",
"3\n",
"4\n",
"5\n",
"6\n",
"7\n",
"8\n",
"9\n"
]
}
],
"source": [
"dfs = []\n",
"for i in range(10):\n",
" print(i)\n",
" df = create_df(\"log_256_{}.txt\".format(i+1))\n",
" dfs.append(df)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": [
"functions = ['Py_kgeneration', 'generate', 'fftma2', 'covariance', 'gasdev', 'fourt', 'cov_value', 'ran2', 'build_real', 'prebuild_gwn', 'clean_real', 'cgrid', 'length', 'maxfactor']\n",
"\n",
"\n",
"#df_final = pd.concat(dfs).sort_values(by=('time', 'sum'), ascending=False) "
]
} }
], ],
"metadata": { "metadata": {
@ -1461,18 +1515,6 @@
"display_name": "Python 3 (ipykernel)", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.18"
} }
}, },
"nbformat": 4, "nbformat": 4,

Loading…
Cancel
Save