|
348 | 348 | "cell_type": "markdown", |
349 | 349 | "metadata": {}, |
350 | 350 | "source": [ |
351 | | - "**A simpler way to to maintain an ordered list of results is to use the `Pool.apply` and `Pool.map` functions which we will discuss in the next section.**" |
| 351 | + "**A simpler way to maintain an ordered list of results is to use the `Pool.apply` and `Pool.map` functions which we will discuss in the next section.**" |
352 | 352 | ] |
353 | 353 | }, |
354 | 354 | { |
|
379 | 379 | "source": [ |
380 | 380 | "Another and more convenient approach for simple parallel processing tasks is provided by the `Pool` class. \n", |
381 | 381 | "\n", |
382 | | - "There are four methods that are particularly interesing:\n", |
| 382 | + "There are four methods that are particularly interesting:\n", |
383 | 383 | "\n", |
384 | 384 | " - Pool.apply\n", |
385 | 385 | " \n", |
|
451 | 451 | "cell_type": "markdown", |
452 | 452 | "metadata": {}, |
453 | 453 | "source": [ |
454 | | - "The `Pool.map` and `Pool.apply` will lock the main program until all a process is finished, which is quite useful if we want to obtain resuls in a particular order for certain applications. \n", |
| 454 | + "The `Pool.map` and `Pool.apply` will lock the main program until all processes are finished, which is quite useful if we want to obtain results in a particular order for certain applications. \n", |
455 | 455 | "In contrast, the `async` variants will submit all processes at once and retrieve the results as soon as they are finished. \n", |
456 | 456 | "One more difference is that we need to use the `get` method after the `apply_async()` call in order to obtain the `return` values of the finished processes." |
457 | 457 | ] |
|
759 | 759 | "source": [ |
760 | 760 | "Below, we will set up benchmarking functions for our serial and multiprocessing approach that we can pass to our `timeit` benchmark function. \n", |
761 | 761 | "We will be using the `Pool.apply_async` function to take advantage of firing up processes simultaneously: Here, we don't care about the order in which the results for the different window widths are computed, we just need to associate each result with the input window width. \n", |
762 | | - "Thus we add a little tweak to our Parzen-density-estimation function by returning a tuple of 2 values: window width and the estimated density, which will allow us to to sort our list of results later." |
| 762 | + "Thus we add a little tweak to our Parzen-density-estimation function by returning a tuple of 2 values: window width and the estimated density, which will allow us to sort our list of results later." |
763 | 763 | ] |
764 | 764 | }, |
765 | 765 | { |
|
1097 | 1097 | "name": "python", |
1098 | 1098 | "nbconvert_exporter": "python", |
1099 | 1099 | "pygments_lexer": "ipython3", |
1100 | | - "version": "3.6.1" |
| 1100 | + "version": "3.6.3" |
1101 | 1101 | } |
1102 | 1102 | }, |
1103 | 1103 | "nbformat": 4, |
|
0 commit comments