Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nor working #50

Open
cdcseacave opened this issue Jul 13, 2023 · 4 comments
Open

Nor working #50

cdcseacave opened this issue Jul 13, 2023 · 4 comments

Comments

@cdcseacave
Copy link

cdcseacave commented Jul 13, 2023

for me it does not work at all
I even tried your example code, without profiler does nothing, with profiler tag it does not compile, see bellow:
image

@Stonesjtu
Copy link
Owner

you need to import the function at first

from pytorch_memlab import profile_every

@cdcseacave
Copy link
Author

still does not produce any output:

import torch
from pytorch_memlab import LineProfiler
from pytorch_memlab import profile_every

@profile_every(1)
def inner():
    torch.nn.Linear(100, 100).cuda()

def outer():
    linear = torch.nn.Linear(100, 100).cuda()
    linear2 = torch.nn.Linear(100, 100).cuda()
    inner()

with LineProfiler(outer, inner) as prof:
    outer()
prof.display()

output:

ubuntu@65:~$ python prof.py
No data collected

@Stonesjtu
Copy link
Owner

try:

import torch
from pytorch_memlab import LineProfiler
from pytorch_memlab import profile_every

@profile_every(1)
def inner():
    torch.nn.Linear(100, 100).cuda()

def outer():
    linear = torch.nn.Linear(100, 100).cuda()
    linear2 = torch.nn.Linear(100, 100).cuda()
    inner()

outer()

@cdcseacave
Copy link
Author

ubuntu@65:~$ python prof.py
## inner

active_bytes reserved_bytes line code
         all            all
        peak           peak
      80.00K          2.00M    5 @profile_every(1)
                               6 def inner():
     120.00K          2.00M    7     torch.nn.Linear(100, 100).cuda()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants