Closed willprice closed 4 years ago
Great work to have ipython supported. Can we make ipython an optional dependency by wrapping from . extension import load_ipython_extension
with try catch block.
Sure, I've made ipython
an optional dep in setup.py
now. It can be installed with pip install .[ipython]
from a local clone, or when on pypi: pip install pytorch-memlab[ipython]
. I've also add some documentation to the README.
These are the options %lprun
support:
Options:
-f <function>: LineProfiler only profiles functions and methods it is told
to profile. This option tells the profiler about these functions. Multiple
-f options may be used. The argument may be any expression that gives
a Python function or method object. However, one must be careful to avoid
spaces that may confuse the option parser.
-m <module>: Get all the functions/methods in a module
One or more -f or -m options are required to get any useful results.
-D <filename>: dump the raw statistics out to a pickle file on disk. The
usual extension for this is ".lprof". These statistics may be viewed later
by running line_profiler.py as a script.
-T <filename>: dump the text-formatted statistics with the code side-by-side
out to a text file.
-r: return the LineProfiler object after it has completed profiling.
-s: strip out all entries from the print-out that have zeros.
-u: specify time unit for the print-out in seconds.
I'm thinking it might be worth adding -r
, and -T
. I think I should also add an option for GPU IDs for the profiler
You are right. We'll leave the API change in the future (or never) work.
LGTM, is this still a wip
I think this is in a decent state for a first release. I'm happy to spend a bit more time tarting up the docs though? Up to you :)
OK, just ping me when it's ready.
OK, I'm happy now :)
Merged. Thanks for your contribution!
This address #7.
It's a WIP at the moment but thought I'd push it up to get some feedback. What do you think? I've tried to stay somewhat consistent with
line_profiler
's%lprun
magic command, although currently, it doesn't support the same breadth of arguments (I probably won't add module support, or anything too complex)There's a demo notebook
demo.ipynb
for testing out the IPython line and cell magics.