[Networkit] measuring memory usage with IPython and the memory_profiler

Henning Meyerhenke meyerhenke at kit.edu
Sat Nov 15 14:07:18 CET 2014


I assume the measurements are reasonably correct and refer to what's 
actually being done in C++, right?

Neat...

Henning


Am 15.11.14 um 09:53 schrieb Christian Staudt:
> Hi all,
> I’ve recently discovered an easy way to measure peak memory usage for
> NetworKit code.
>
> First install the Python modules psutil and memory_profiler, e.g. with
>
>  >>> pip install psutil
>  >>> pip install memory_profiler
>
>  From an IPython shell, use the %memit command to show peak memory usage
> of the Python process and incremental memory usage of the piece of code
> being profiled. In this case, reading the graph took 2.59 MB additional
> memory and running Betweenness took 6.99 MB more.
>
> In [*1*]: %load_ext memory_profiler
>
> In [*2*]: from networkit import *
>
> In [*3*]: %memit G =
> readGraph("/Users/cls/workspace/NetworKit/input/PGPgiantcompo.graph")
> peak memory: 79.37 MiB, increment: 2.59 MiB
>
> In [*5*]: %memit centrality.Betweenness(G).run()
> peak memory: 87.26 MiB, increment: 6.99 MiB
>
>
> Best,
> Christian
>

-- 

=======================================================
Karlsruhe Institute of Technology (KIT)
Institute of Theoretical Informatics (ITI)

Juniorprof. Dr. Henning Meyerhenke
Theoret. Informatics / Parallel Computing

Phone: +49-721-608-41876
Web: http://parco.iti.kit.edu/henningm/

KIT - University of the State of Baden-Wuerttemberg and
National Research Center of the Helmholtz Association
=======================================================

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5316 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20141115/bcfe25dc/attachment.p7s>


More information about the NetworKit mailing list