Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jcrist/ptime
IPython magic for parallel profiling (like `%time`, but parallel)
https://github.com/jcrist/ptime
Last synced: 6 days ago
JSON representation
IPython magic for parallel profiling (like `%time`, but parallel)
- Host: GitHub
- URL: https://github.com/jcrist/ptime
- Owner: jcrist
- License: bsd-3-clause
- Created: 2017-07-17T18:54:38.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-17T20:56:42.000Z (over 7 years ago)
- Last Synced: 2024-10-07T22:19:59.554Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 71
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
ptime
=====A tool for measuring serial and parallel execution, and comparing the results.
Provides an `IPython magic
`_ ``%ptime``.
This can be useful for measuring the benefits of parallelizing code, including
measuring the effect of the `Global Interpreter Lock
`_ (GIL).Example
-------.. code::
In [1]: %load_ext ptime
In [2]: import numpy as np
In [3]: x = np.ones((5000, 10000))
In [4]: %ptime x + x
Total serial time: 0.42 s
Total parallel time: 0.25 s
For a 1.67X speedup across 2 threadsIn [5]: %ptime -n4 x + x # use 4 threads
Total serial time: 0.82 s
Total parallel time: 0.31 s
For a 2.60X speedup across 4 threadsIn [6]: res = %ptime -o x + x # Get the result
Total serial time: 0.41 s
Total parallel time: 0.25 s
For a 1.66X speedup across 2 threadsIn [7]: res.speedup
Out[7]: 1.6610825669011922In [8]: %%ptime # Use as a cell magic
...: x = np.ones((5000, 10000))
...: y = x + x
...:
Total serial time: 0.72 s
Total parallel time: 0.47 s
For a 1.54X speedup across 2 threadsInstall
-------This package is available via pip:
.. code::
pip install ptime