From e88a091b102e23422b33a05eb6638be74667abc7 Mon Sep 17 00:00:00 2001 From: chortas Date: Sat, 18 Dec 2021 20:15:47 -0300 Subject: [PATCH] Add 256 case --- fftma_module/gen/analysis.ipynb | 88 ++++++++++++++++++++++++--------- 1 file changed, 65 insertions(+), 23 deletions(-) diff --git a/fftma_module/gen/analysis.ipynb b/fftma_module/gen/analysis.ipynb index a1f0cb1..6af36bd 100644 --- a/fftma_module/gen/analysis.ipynb +++ b/fftma_module/gen/analysis.ipynb @@ -56,21 +56,19 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ - "def analyze(file_name):\n", + "def get_data(file_name):\n", " data = []\n", "\n", - " with open(file_name) as log_file: \n", + " with open(file_name) as log_file:\n", " lines = log_file.readlines()\n", - " print(len(lines))\n", " for line in lines:\n", " row = {}\n", " split_line = line.split()\n", - " if \"USED\" not in split_line or \"ELAPSED\" not in split_line:\n", - " continue\n", + " if \"USED\" not in split_line or \"ELAPSED\" not in split_line: continue\n", " idx_used_mem = split_line.index(\"USED\") + 4\n", " idx_elapsed = split_line.index(\"ELAPSED\") + 2\n", " \n", @@ -84,8 +82,29 @@ " row[\"time\"] = elapsed\n", " data.append(row)\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_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) " ] }, @@ -98,7 +117,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -349,7 +368,7 @@ "clean_real 1 " ] }, - "execution_count": 19, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -1450,10 +1469,45 @@ }, { "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": {}, "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": { @@ -1461,18 +1515,6 @@ "display_name": "Python 3 (ipykernel)", "language": "python", "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,