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

Refactor to local #6098

Merged
merged 12 commits into from
Aug 31, 2021
Merged

Refactor to local #6098

merged 12 commits into from
Aug 31, 2021

Conversation

clackhan
Copy link
Contributor

@clackhan clackhan commented Aug 30, 2021

  • 重构CastToConsistent后向,在后向过程中自动添加boxing
  • 解决CastFromConsistent后向过程没有dtype attr的bug
  • 删除 oneflow/core/autograd/gradient_funcs/hierarchical_parallel_cast.cpp,由于ConsistentToConsistentOpExpr有注册专门的后向function,此文件不在需要,故删除

…refactor_to_local

Conflicts:
	oneflow/core/autograd/gradient_funcs/consistent_cast.cpp
@@ -57,9 +55,8 @@ class ConsistentToConsistentGradFunction : public OpExprGradFunction<ConsistentT
const auto& grad_nd_sbp =
grad_nd_sbp_.has_value() ? JUST(grad_nd_sbp_.value()) : JUST(out_grad->nd_sbp());
const auto& grad_sbp_list = JUST(GetSbpList(grad_nd_sbp));
const auto& grad_grad_sbp_list = JUST(GetSbpList(ctx->nd_sbp));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删掉这里的理由是什么呢?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删掉这里的理由是什么呢?

这里本来就是后向过程,不需要在此处配置后向的后向,可参考:https://github.com/Oneflow-Inc/oneflow/blob/master/oneflow/user/ops/hierarchical_parallel_cast_op.cpp#L92

@clackhan clackhan requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 30, 2021 03:47
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 30, 2021 06:22
@github-actions
Copy link
Contributor

CI failed, removing label automerge

@oneflow-ci-bot oneflow-ci-bot removed their request for review August 30, 2021 08:05
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 30, 2021 09:54
@oneflow-ci-bot oneflow-ci-bot removed their request for review August 30, 2021 11:37
@oneflow-ci-bot oneflow-ci-bot self-requested a review August 30, 2021 11:37
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 30, 2021 12:44
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 30, 2021 13:55
@github-actions
Copy link
Contributor

CI failed, removing label automerge

@oneflow-ci-bot oneflow-ci-bot removed their request for review August 30, 2021 15:42
@clackhan clackhan requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 31, 2021 02:14
@oneflow-ci-bot oneflow-ci-bot removed their request for review August 31, 2021 02:24
@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

OneFlow resnet50 time: 127.5ms (= 6375.8ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 140.0ms (= 6999.6ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.10 (= 140.0ms / 127.5ms)

OneFlow resnet50 time: 74.3ms (= 3716.9ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 83.5ms (= 4176.6ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.12 (= 83.5ms / 74.3ms)

OneFlow resnet50 time: 48.4ms (= 2420.0ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 58.4ms (= 2920.5ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.21 (= 58.4ms / 48.4ms)

OneFlow resnet50 time: 40.5ms (= 2024.6ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 47.2ms (= 2359.5ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.17 (= 47.2ms / 40.5ms)

OneFlow resnet50 time: 38.2ms (= 1909.2ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 44.2ms (= 2211.9ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.16 (= 44.2ms / 38.2ms)

OneFlow resnet50 time: 145.8ms (= 7288.4ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 152.8ms (= 7640.2ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.05 (= 152.8ms / 145.8ms)

OneFlow resnet50 time: 92.9ms (= 4644.0ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 91.3ms (= 4567.0ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 0.98 (= 91.3ms / 92.9ms)

OneFlow resnet50 time: 65.8ms (= 3291.7ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 67.3ms (= 3366.7ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.02 (= 67.3ms / 65.8ms)

OneFlow resnet50 time: 61.5ms (= 3077.3ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 53.7ms (= 2683.9ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 0.87 (= 53.7ms / 61.5ms)

OneFlow resnet50 time: 55.2ms (= 2757.7ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 49.1ms (= 2456.3ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 0.89 (= 49.1ms / 55.2ms)

@oneflow-ci-bot oneflow-ci-bot merged commit 9502009 into master Aug 31, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the refactor_to_local branch August 31, 2021 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants