Skip to content

[Question] Padding in ZeRO optimizer #487

Closed

Description

@e-sha

Why do you use padding here, here in ZeRO optimizer?
Moreover, later you split tensors as if it was not padded. For example, here.
From my perspective padding is not necessary at all.

Activity

  1. tjruwase commented on Oct 28, 2020

    @tjruwase
    Contributor

    We pad the tensors to align to the data parallel size to ensure load-balancing across the ranks.

    The tensor splitting here is on the padded tensors.

  2. e-sha commented on Oct 30, 2020

    @e-sha
    Author

    According to this line the optimizer can split tensor that is not aligned. Thus, padding seems to be an unnecessary feature that just makes code more sophisticated and harder to maintain.

  3. tjruwase commented on Oct 30, 2020

    @tjruwase
    Contributor

    Apologies for the confusion, but that line is old and redundant since the input to the function is the padded tensor. In addition to load-balancing, padding helps to handle cases where the tensor.numel() is smaller than GPU count, which although is a rare case but one that we have seen and led to this unit test.

  4. tjruwase commented on Nov 24, 2020

    @tjruwase
    Contributor

    Closing for lack of activity. Please reopen as needed.

  5. added a commit that references this issue on Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions