Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions content/parallel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ algorithm from above, and we have highlighted the lines which are important
to get this MPI example to work:

.. code-block:: python
:emphasize-lines: 3,23-25,29,39,42
:emphasize-lines: 3,23-25,35,40

import random
import time
Expand Down Expand Up @@ -320,18 +320,16 @@ to get this MPI example to work:

n = 10 ** 7

if size > 1:
n_task = int(n / size)
else:
n_task = n
n_task = int(n / size)

t0 = time.perf_counter()
_, n_inside_circle = sample(n_task)
t = time.perf_counter() - t0

print(f"before gather: rank {rank}, n_inside_circle: {n_inside_circle}")
n_inside_circle = comm.gather(n_inside_circle, root=0)
print(f"after gather: rank {rank}, n_inside_circle: {n_inside_circle}")

t = time.perf_counter() - t0

if rank == 0:
pi_estimate = 4.0 * sum(n_inside_circle) / n
Expand Down
Loading