Skip to content

Commit

Permalink
Update to notebook, [build docs]
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinCawley committed Jul 6, 2021
1 parent d6e39bb commit 87184d9
Showing 1 changed file with 12 additions and 32 deletions.
44 changes: 12 additions & 32 deletions docs/development/profiling/tardis_profiling_threads.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,6 @@
"metadata": {},
"outputs": [],
"source": [
"def open_file(file_name):\n",
" \"\"\"\n",
" Tries to open the file specified by year. If it can, returns the fp.\n",
" If it cannot, it raises an error.\n",
" \n",
" Parameters\n",
" ----------\n",
" file_name : string\n",
" \n",
" Returns\n",
" -------\n",
" fp : file\n",
" \"\"\"\n",
"\n",
" try:\n",
" fp = open(file_name, \"r\")\n",
" return fp\n",
" except:\n",
" raise NameError(\"Filename {} is invalid\".format(file_name))\n",
" \n",
"def build_dictionary(fp):\n",
" \"\"\"\n",
" Uses the fp generated from open_file to return a dictionary. Then closes\n",
Expand Down Expand Up @@ -240,25 +220,25 @@
},
"outputs": [],
"source": [
"tardis_file = 'tardis_example.yml'\n",
"storage_file = 'threads_dict_128_threads_1_node.csv'\n",
"cpu_storage_file = 'cpu_threads_dict_128_threads_1_node.csv'\n",
"TARDIS_FILE = 'tardis_example.yml'\n",
"STORAGE_FILE = 'threads_dict_128_threads_1_node.csv'\n",
"CPU_STORAGE_FILE = 'cpu_threads_dict_128_threads_1_node.csv'\n",
"\n",
"#Compile the numba functions\n",
"run_tardis(tardis_file)\n",
"run_tardis(TARDIS_FILE)\n",
"\n",
"#Opens file and builds the dictionary\n",
"with open(STORAGE_FILE, \"r\") as threads_fp:\n",
" threads_dict = build_dictionary(threads_fp)\n",
"\n",
"with open(CPU_STORAGE_FILE, \"r\") as cpu_fp:\n",
" cpu_threads_dict = build_dictionary(cpu_fp)\n",
"\n",
"#Opens file\n",
"threads_fp = open_file(storage_file)\n",
"cpu_fp = open_file(cpu_storage_file)\n",
"#Creates list of main data\n",
"threads_numbers = [i for i in range(1, 129, 1)]\n",
"cpu_threads_numbers = [i for i in range(1, 129, 1)]\n",
"\n",
"#Creates dictionary of thread timings, closes the file\n",
"threads_dict = build_dictionary(threads_fp)\n",
"cpu_threads_dict = build_dictionary(cpu_fp)\n",
"\n",
"generate_data(128, 30, threads_dict, cpu_threads_dict, tardis_file, storage_file, cpu_storage_file)"
"generate_data(128, 30, threads_dict, cpu_threads_dict, TARDIS_FILE, STORAGE_FILE, CPU_STORAGE_FILE)"
]
},
{
Expand Down

0 comments on commit 87184d9

Please sign in to comment.