Skip to content

Commit

Permalink
comments on Dask parallelization
Browse files Browse the repository at this point in the history
  • Loading branch information
facusapienza21 committed Sep 10, 2023
1 parent 0c7c769 commit 18c2e3b
Showing 1 changed file with 32 additions and 9 deletions.
41 changes: 32 additions & 9 deletions notebooks/Parallel.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"source": [
"# Parallelization with Dask\n",
"\n",
"This notebook includes a series of experiments to make multiple samples in parallel using Dark. "
"This notebook includes a series of experiments to make multiple samples in parallel using Dask. Many of the simulations carries for this work where carried in parallel and the setup was configures using Dask. We include here the code that was used to create this simulations. "
]
},
{
Expand All @@ -32,7 +32,9 @@
"id": "baf2420d-458c-4610-8af1-8969d94f7bbd",
"metadata": {},
"source": [
"## 1. Dask Setup"
"## 1. Dask Setup\n",
"\n",
"In this case we decided to work with a total of `60` workers, each one of them carrying a different simulation for some given parameters. "
]
},
{
Expand Down Expand Up @@ -2040,6 +2042,14 @@
"dask_client"
]
},
{
"cell_type": "markdown",
"id": "1d88db41-0133-4e92-b2f6-04f71436c6ba",
"metadata": {},
"source": [
"Check to see if the threads are ready"
]
},
{
"cell_type": "code",
"execution_count": 4,
Expand All @@ -2058,7 +2068,6 @@
}
],
"source": [
"# Check to see if the threads are ready\n",
"dview = rc[:]\n",
"len(dview)"
]
Expand All @@ -2068,7 +2077,9 @@
"id": "373fe361-a6da-47ea-a128-3fafa86ad4cf",
"metadata": {},
"source": [
"## 2. Macro function definition"
"## 2. Macro function definition\n",
"\n",
"We now define a function that is going to execute all the simulation with the desired parameters. In order to this to work in parallel, the class `Params` needs to be redefined inside the function. We further add a hash code to the simulation to keep track of them. "
]
},
{
Expand Down Expand Up @@ -2142,7 +2153,9 @@
"id": "850a9ed8-136f-451d-9a6a-35d57a96dd1a",
"metadata": {},
"source": [
"## 3. Parameter space exploration"
"## 3. Parameter space exploration\n",
"\n",
"We now set the different parameter choices used for the different simulations. "
]
},
{
Expand Down Expand Up @@ -2573,7 +2586,9 @@
"id": "08d0337c-3fd4-430d-b641-aeaca5dbc4f6",
"metadata": {},
"source": [
"## 4. Run Simulation"
"## 4. Run Simulation\n",
"\n",
"We finally set and run all the simulations. "
]
},
{
Expand Down Expand Up @@ -2616,6 +2631,14 @@
"progress(res)"
]
},
{
"cell_type": "markdown",
"id": "3371279b-f65a-44e7-946a-93cf3baf1ffe",
"metadata": {},
"source": [
"## 5. Save outputs"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -2672,9 +2695,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:.conda-paleostats]",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "conda-env-.conda-paleostats-py"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -2686,7 +2709,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
"version": "3.10.9"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 18c2e3b

Please sign in to comment.