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

Log profile averages #2647

Merged
merged 8 commits into from
Oct 17, 2023
Merged

Log profile averages #2647

merged 8 commits into from
Oct 17, 2023

Conversation

j316chuck
Copy link
Contributor

@j316chuck j316chuck commented Oct 17, 2023

What does this PR do?

Logs profile averages

Example:

-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  
                                                   Name    Self CPU %      Self CPU   CPU total %     CPU total  CPU time avg       CPU Mem  Self CPU Mem    # of Calls  Total MFLOPs  
-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  
                                          ProfilerStep*         0.11%      20.738ms       100.00%       19.110s        4.777s     396.89 Mb      -2.00 Mb             4            --  
                     Optimizer.step#DecoupledAdamW.step         4.05%     774.719ms        99.88%       19.086s        4.772s     396.89 Mb     -27.91 Gb             4            --  
                               aten::cross_entropy_loss         2.63%     502.545ms        45.36%        8.668s      45.144ms      24.59 Gb     -41.50 Gb           192            --  
                                      aten::log_softmax         0.00%     785.000us        42.67%        8.153s      42.466ms      73.78 Gb           0 b           192            --  
                                     aten::_log_softmax        42.66%        8.153s        42.66%        8.153s      42.462ms      73.78 Gb      73.78 Gb           192            --  
                                               aten::mm        16.71%        3.193s        16.71%        3.193s       1.426ms      25.05 Gb      18.01 Gb          2240    641292.304  
autograd::engine::evaluate_function: LogSoftmaxBackw...         2.55%     487.009ms        16.42%        3.139s      49.040ms     -24.59 Gb     -49.19 Gb            64            --  
                                    LogSoftmaxBackward0         0.00%     443.000us        13.88%        2.652s      41.430ms      24.59 Gb           0 b            64            --  
                       aten::_log_softmax_backward_data        13.87%        2.651s        13.87%        2.651s      41.423ms      24.59 Gb      24.59 Gb            64            --  
       autograd::engine::evaluate_function: MmBackward0         1.28%     245.319ms        10.07%        1.924s      30.058ms     -24.40 Gb     -24.60 Gb            64            --  
                                           aten::matmul         0.02%       4.509ms         9.54%        1.822s       3.164ms      25.72 Gb           0 b           576            --  
                                            MmBackward0         0.01%       1.427ms         8.78%        1.678s      26.224ms     204.75 Mb           0 b            64            --  
                                           aten::linear         0.14%      26.284ms         8.26%        1.578s       1.451ms      24.91 Gb     393.50 Mb          1088            --  
                                              aten::bmm         3.93%     751.467ms         4.33%     827.912ms     539.005us       2.12 Gb     705.50 Mb          1536     12884.902  
                                            aten::fill_         3.90%     744.822ms         3.90%     745.010ms     372.505us       2.74 Gb       2.74 Gb          2000            --  
                                            aten::zero_         0.12%      23.713ms         3.89%     743.815ms     758.995us      13.94 Gb      11.21 Gb           980            --  
autograd::engine::evaluate_function: NllLossBackward...         0.00%     590.000us         3.89%     742.616ms      11.603ms      24.59 Gb      -1.00 Mb            64            --  
                                       NllLossBackward0         0.00%     200.000us         3.88%     742.026ms      11.594ms      24.59 Gb           0 b            64            --  
                                aten::nll_loss_backward        -0.08%  -16028.000us         3.88%     741.826ms      11.591ms      24.59 Gb      10.76 Gb            64            --  
      autograd::engine::evaluate_function: BmmBackward0         0.05%       9.010ms         2.91%     556.971ms       1.088ms     -32.00 Mb      -1.12 Gb           512            --  
-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  
Self CPU time total: 19.110s

-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  
                                                   Name    Self CPU %      Self CPU   CPU total %     CPU total  CPU time avg       CPU Mem  Self CPU Mem    # of Calls  Total MFLOPs  
-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  
                                     aten::_log_softmax        42.66%        8.153s        42.66%        8.153s      42.462ms      73.78 Gb      73.78 Gb           192            --  
                       aten::_log_softmax_backward_data        13.87%        2.651s        13.87%        2.651s      41.423ms      24.59 Gb      24.59 Gb            64            --  
                                               aten::mm        16.71%        3.193s        16.71%        3.193s       1.426ms      25.05 Gb      18.01 Gb          2240    641292.304  
                                            aten::zero_         0.12%      23.713ms         3.89%     743.815ms     758.995us      13.94 Gb      11.21 Gb           980            --  
                                aten::nll_loss_backward        -0.08%  -16028.000us         3.88%     741.826ms      11.591ms      24.59 Gb      10.76 Gb            64            --  
                                     aten::resolve_conj         0.00%     119.000us         0.00%     119.000us       0.000us       8.46 Gb       8.46 Gb        240055            --  
                                            aten::fill_         3.90%     744.822ms         3.90%     745.010ms     372.505us       2.74 Gb       2.74 Gb          2000            --  
                                              aten::mul         0.48%      92.310ms         0.50%      95.943ms     112.609us       2.00 Gb       1.97 Gb           852       536.871  
                                            aten::empty         0.02%       3.154ms         0.02%       3.154ms       0.400us       1.81 Gb       1.81 Gb          7892            --  
                                       aten::empty_like         0.01%       2.312ms         0.02%       3.252ms       1.328us       1.86 Gb       1.07 Gb          2448            --  
                                         aten::_softmax         0.70%     134.132ms         0.70%     134.132ms     523.953us       1.00 Gb       1.00 Gb           256            --  
                           aten::_softmax_backward_data         0.29%      56.368ms         0.29%      56.368ms     220.188us       1.00 Gb       1.00 Gb           256            --  
                                              aten::bmm         3.93%     751.467ms         4.33%     827.912ms     539.005us       2.12 Gb     705.50 Mb          1536     12884.902  
                                            aten::copy_         0.98%     187.573ms         0.98%     187.573ms      30.060us     652.10 Mb     635.35 Mb          6240            --  
                                           aten::linear         0.14%      26.284ms         8.26%        1.578s       1.451ms      24.91 Gb     393.50 Mb          1088            --  
                                              aten::add         0.08%      15.904ms         0.08%      15.921ms      24.722us     268.63 Mb     268.62 Mb           644        70.451  
                                            aten::addmm         0.31%      60.189ms         0.42%      80.892ms      78.996us     320.00 Mb     210.75 Mb          1024      3758.096  
                                             aten::gelu         0.54%     102.449ms         0.54%     102.449ms     400.191us     160.00 Mb     160.00 Mb           256            --  
                                    aten::gelu_backward         0.71%     135.934ms         0.71%     135.934ms     530.992us     159.38 Mb     159.38 Mb           256            --  
                                           aten::expand         0.02%       4.005ms         0.02%       4.257ms       1.357us     105.88 Mb     105.25 Mb          3136            --  
-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  
Self CPU time total: 19.110s

What issue(s) does this change relate to?

https://databricks.atlassian.net/browse/GRT-2231

@j316chuck j316chuck requested a review from a team as a code owner October 17, 2023 01:40
@j316chuck j316chuck requested a review from mvpatel2000 October 17, 2023 01:40
@nik-mosaic
Copy link
Contributor

Shouldn't we use logger.log instead of print?

composer/profiler/torch_profiler.py Outdated Show resolved Hide resolved
@j316chuck j316chuck enabled auto-merge (squash) October 17, 2023 19:23
@j316chuck j316chuck disabled auto-merge October 17, 2023 19:23
@j316chuck j316chuck enabled auto-merge (squash) October 17, 2023 19:23
@j316chuck j316chuck merged commit c14b8d0 into dev Oct 17, 2023
15 checks passed
@j316chuck j316chuck deleted the chuck/log_profile_avgs branch October 17, 2023 19:55
b-chu added a commit that referenced this pull request Oct 27, 2023
* Remove apex test and clean up fsdp warnings  (#2616)

* patch default (#2628)

* Add logging for generate callbacks (#2630)

* Update generate.py

* add missing imports

* Expose input_names and output_names when exporting to ONNX (#2601)

* Expose input_names and output_names when exporting to ONNX

* assert sample_input type for pyright

* fix mocks

---------

Co-authored-by: Mihir Patel <mihir.v.patel7@gmail.com>

* Bump version to 0.16.4 (#2627)

* bump version

* filter warning

* remove slack failure

* composer

* ckdn

* commit change

* commit change

* commit change

* commit change

* rename

* revert

* cleanup

* move around tests

* log

* fix slack

* clean test

* composer

* rearrange

* remove logs

* skip

* remove log

---------

Co-authored-by: Chuck Tang <chuck@mosaicml.com>

* many logs

* typos

* logs

* filter

* logs

* fix logs

* monkeypatch sharded tensor

* Add partial state dict functionality for FSDP (#2637)

* Use pytorch chunking

commit-id:e4c9b78f

* Add partial state dict functionality for FSDP

commit-id:2a2cae33

* Update monai requirement from <1.3,>=0.9.1 to >=0.9.1,<1.4 (#2643)

Updates the requirements on [monai](https://github.com/Project-MONAI/MONAI) to permit the latest version.
- [Release notes](https://github.com/Project-MONAI/MONAI/releases)
- [Changelog](https://github.com/Project-MONAI/MONAI/blob/dev/CHANGELOG.md)
- [Commits](Project-MONAI/MONAI@0.9.1...1.3.0)

---
updated-dependencies:
- dependency-name: monai
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump pytest-codeblocks from 0.16.1 to 0.17.0 (#2645)

Bumps [pytest-codeblocks](https://github.com/nschloe/pytest-codeblocks) from 0.16.1 to 0.17.0.
- [Release notes](https://github.com/nschloe/pytest-codeblocks/releases)
- [Commits](nschloe/pytest-codeblocks@v0.16.1...v0.17.0)

---
updated-dependencies:
- dependency-name: pytest-codeblocks
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* remove flush on close (#2646)

* update latest (#2650)

* HSDP Support (#2648)

* add hsdp

* add tuple support

* mod wide

* update

* set default

* disable error validation

* hsdp

* gate import

* Log profile averages (#2647)

Co-authored-by: Mihir Patel <mihir.v.patel7@gmail.com>

* bump

* daily key (#2655)

* Add automatic remote uploader downloader for composer profiler (#2653)

* Update the AWS_OFI_NCCL version and add in the MPI HWLOC install (#2651)

* Update the AWS_OFI_NCCL version and add in the MPI HWLOC install

* Move the HWLOC down to the appropriate stage

* Move the HWLOC to the apt-get install

* Remove extra debug arg

---------

Co-authored-by: Mihir Patel <mihir.v.patel7@gmail.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Charles Tang <j316chuck@users.noreply.github.com>
Co-authored-by: Mihir Patel <mihir.v.patel7@gmail.com>
Co-authored-by: Anna <anna@mosaicml.com>
Co-authored-by: Antoine Broyelle <antoine.broyelle@helsing.ai>
Co-authored-by: Chuck Tang <chuck@mosaicml.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: willgleich <22464726+willgleich@users.noreply.github.com>
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.

3 participants