IPython magic for parallel profiling
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).
In : %load_ext ptime In : import numpy as np In : x = np.ones((5000, 10000)) In : %ptime x + x Total serial time: 0.42 s Total parallel time: 0.25 s For a 1.67X speedup across 2 threads In : %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 threads In : 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 threads In : res.speedup Out: 1.6610825669011922 In : %%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 threads
This package is available via pip:
pip install ptime
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash||File type||Python version||Upload date|
|ptime-0.0.1.tar.gz (2.8 kB) View hashes||Source||None|