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

Enhenced String report and stacked bar visulization. #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

veya2ztn
Copy link

  1. make the high level profile possible.
    Original profile build the hook for the least leaf module in a model
    For example, only the nn.Linear, nn.Tanh and that elements won't have submodule can get hook.

Old return

MyNet(
  (linear1): Linear(Forward Time: 0.041632ms|Backward Time: 0.014860ms)
  (linear2): Linear(Forward Time: 0.621580ms|Backward Time: 0.009877ms)
  (linear3): ModuleList(
    (0): Linear(Forward Time: 0.054222ms|Backward Time: 0.048355ms)
    (1): Linear(Forward Time: 0.053606ms|Backward Time: 0.050200ms)
  )
  (linear4): Sequential(
    (0): Linear(Forward Time: 0.069707ms|Backward Time: 0.070743ms)
    (1): Tanh(Forward Time: 0.044920ms|Backward Time: 0.039867ms)
    (2): Linear(Forward Time: 0.048994ms|Backward Time: 0.046925ms)
  )
  (linear5): ModuleDict(
    (a): Linear(Forward Time: 0.045158ms|Backward Time: 0.084371ms)
    (b): Linear(Forward Time: 0.046064ms|Backward Time: 0.099857ms)
  )
)

Now it return

It is better to show the whole profile for each level module. Now, the output will become 
MyNet【Forward Time: 2.098945ms|Backward Time: 0.010771ms】(
  (linear1): Linear(Forward Time: 0.041632ms|Backward Time: 0.014860ms)
  (linear2): Linear(Forward Time: 0.621580ms|Backward Time: 0.009877ms)
  (linear3): ModuleList(
    (0): Linear(Forward Time: 0.054222ms|Backward Time: 0.048355ms)
    (1): Linear(Forward Time: 0.053606ms|Backward Time: 0.050200ms)
  )
  (linear4): Sequential【Forward Time: 0.315535ms|Backward Time: 0.229794ms】(
    (0): Linear(Forward Time: 0.069707ms|Backward Time: 0.070743ms)
    (1): Tanh(Forward Time: 0.044920ms|Backward Time: 0.039867ms)
    (2): Linear(Forward Time: 0.048994ms|Backward Time: 0.046925ms)
  )
  (linear5): ModuleDict(
    (a): Linear(Forward Time: 0.045158ms|Backward Time: 0.084371ms)
    (b): Linear(Forward Time: 0.046064ms|Backward Time: 0.099857ms)
  )
)
  • The ROOT module MyNet and sub module Sequential get record.
  • Notice, ModuleList and ModuleDict still get record. It is designed, since those module may not be used in sequential.
    However, we can also complete it by calling the complete_ignore_cost function in nnprofiler.visulization
  1. Add a visulization function that view the profile in stacked bar plot.
    Those timing that won't be recorded will be count as others. See the new README.

@kshitij12345
Copy link
Owner

Thanks for the update @veya2ztn, will have a look in a day or two.

@kshitij12345
Copy link
Owner

@veya2ztn this is still on my radar, will have a look soon. Thank you for patience :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants