Git Product home page Git Product logo

Comments (6)

Stonesjtu avatar Stonesjtu commented on July 17, 2024

Do you mean the profiling CPU memory at the same time?

from pytorch_memlab.

GoingMyWay avatar GoingMyWay commented on July 17, 2024

Do you mean the profiling CPU memory at the same time?

No. I mean like https://pypi.org/project/memory-profiler/, it can print the memory usage while running like this

Line #    Mem usage  Increment   Line Contents
==============================================
     3                           @profile
     4      5.97 MB    0.00 MB   def my_func():
     5     13.61 MB    7.64 MB       a = [1] * (10 ** 6)
     6    166.20 MB  152.59 MB       b = [2] * (2 * 10 ** 7)
     7     13.61 MB -152.59 MB       del b
     8     13.61 MB    0.00 MB       return a

And, will you support this function and print the GPU memory usage like this? I think it can much easier to detect which function or which line of the code cost GPU memory usage.

from pytorch_memlab.

Stonesjtu avatar Stonesjtu commented on July 17, 2024

I think https://github.com/Stonesjtu/pytorch_memlab#memory-profiler is what you are looking for.

from pytorch_memlab.

GoingMyWay avatar GoingMyWay commented on July 17, 2024

I think https://github.com/Stonesjtu/pytorch_memlab#memory-profiler is what you are looking for.

Thanks. Does it support adding a property over a function to use it?

from pytorch_memlab.

Stonesjtu avatar Stonesjtu commented on July 17, 2024

Sure it does, just like the other line-by-line profiling tools.

You can refer to the memory-profiler part for full documentation.

 class Net(torch.nn.Module):
    def __init__(self):
        super().__init__()
    @profile
    def forward(self, inp):
        #do_something

from pytorch_memlab.

Stonesjtu avatar Stonesjtu commented on July 17, 2024

Closed as this feature is already implemented. Feel free to reopen if needed.

from pytorch_memlab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.