| 1 |
Understanding Performance |
| 2 |
========================= |
| 3 |
|
| 4 |
The first step in making computations run quickly is to understand the costs involved. |
| 5 |
In Python we often rely on tools like |
| 6 |
the `CProfile module <https://docs.python.org/3/library/profile.html>`_, |
| 7 |
`%%prun IPython magic <https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-prun>`_, |
| 8 |
`VMProf <https://vmprof.readthedocs.io/en/latest/>`_, or |
| 9 |
`snakeviz <https://jiffyclub.github.io/snakeviz/>`_ |
| 10 |
to understand the costs associated with our code. |
| 11 |
However, few of these tools work well on multi-threaded or multi-process code, |
| 12 |
and fewer still on computations distributed among many machines. |
| 13 |
We also have new costs like data transfer, serialization, task scheduling overhead, and more |
| 14 |
that we may not be accustomed to tracking. |
| 15 |
|
| 16 |
Fortunately, the Dask schedulers come with diagnostics |
| 17 |
to help you understand the performance characteristics of your computations. |
| 18 |
By using these diagnostics and with some thought, |
| 19 |
we can often identify the slow parts of troublesome computations. |
| 20 |
|
| 21 |
The :doc:`single-machine and distributed schedulers <scheduling>` come with *different* diagnostic tools. |
| 22 |
These tools are deeply integrated into each scheduler, |
| 23 |
so a tool designed for one will not transfer over to the other. |
| 24 |
|
| 25 |
These pages provide four options for profiling parallel code: |
| 26 |
|
| 27 |
1. :doc:`Visualize task graphs <graphviz>` |
| 28 |
2. :ref:`Single threaded scheduler and a normal Python profiler <single-threaded-scheduler>` |
| 29 |
3. :doc:`Diagnostics for the single-machine scheduler <diagnostics-local>` |
| 30 |
4. :doc:`Diagnostics for the distributed scheduler and dashboard <diagnostics-distributed>` |
| 31 |
|
| 32 |
Additionally, if you are interested in understanding the various phases where |
| 33 |
slowdown can occur, you may wish to read the following: |
| 34 |
|
| 35 |
- :doc:`Phases of computation <phases-of-computation>` |