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

Support symbol placement type in functional. #5627

Merged
merged 4 commits into from
Jul 27, 2021

Conversation

hjchen2
Copy link
Contributor

@hjchen2 hjchen2 commented Jul 27, 2021

No description provided.

@hjchen2 hjchen2 requested a review from clackhan July 27, 2021 08:04
template<>
Maybe<std::vector<Symbol<cfg::SbpParallel>>>
PythonArg::ObjectAs<std::vector<Symbol<cfg::SbpParallel>>>() const {
return *JUST(detail::cast<std::vector<Symbol<cfg::SbpParallel>>>(Borrow()));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里应该是

const auto& v = JUST(detail::cast<std::vector<std::shared_ptr<Symbol<cfg::SbpParallel>>>>(Borrow()));
auto sbp_list = std::make_shared<std::vector<Symbol<cfg::SbpParallel>>>(v->size());
for (int i = 0; i < v->size(); ++i) {
  sbp_list[i] = *(v->at(i));
}
return sbp_list

@oneflow-ci-bot oneflow-ci-bot self-requested a review July 27, 2021 11:09
@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

PyTorch resnet50 time: 139.5ms (= 6974.0ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 126.0ms (= 6302.3ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
Relative speed: 1.11 (= 139.5ms / 126.0ms)

PyTorch resnet50 time: 84.3ms (= 4212.6ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 74.1ms (= 3706.6ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
Relative speed: 1.14 (= 84.3ms / 74.1ms)

PyTorch resnet50 time: 57.5ms (= 2875.4ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 50.2ms (= 2507.7ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
Relative speed: 1.15 (= 57.5ms / 50.2ms)

PyTorch resnet50 time: 48.3ms (= 2417.5ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 48.6ms (= 2427.8ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
Relative speed: 1.00 (= 48.3ms / 48.6ms)

PyTorch resnet50 time: 44.1ms (= 2205.3ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 47.4ms (= 2371.9ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
Relative speed: 0.93 (= 44.1ms / 47.4ms)

@oneflow-ci-bot oneflow-ci-bot removed their request for review July 27, 2021 12:16
@oneflow-ci-bot oneflow-ci-bot merged commit 50325e9 into master Jul 27, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the dev_functional_support_placement_and_sbp_type branch July 27, 2021 12:18
Comment on lines +154 to +156
"ParallelDesc",
"SbpParallel",
"SbpParallelList",
Copy link
Contributor

Choose a reason for hiding this comment

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

"Placement"
"Sbp"
"SbpList"

Comment on lines +185 to +187
"ParallelDesc": "const Symbol<ParallelDesc>&",
"SbpParallel": "const Symbol<cfg::SbpParallel>&",
"SbpParallelList": "const std::vector<Symbol<cfg::SbpParallel>>&",
Copy link
Contributor

Choose a reason for hiding this comment

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

"Placement": "const Symbol<ParallelDesc>&",
"Sbp": "const Symbol<cfg::SbpParallel>&",
"SbpList": "const std::vector<Symbol<cfg::SbpParallel>>&",

Copy link
Contributor

Choose a reason for hiding this comment

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

这么做是因为我们的ParallelDesc后边一定会统一命名成Placement。
但是接口处需要和Python对齐,同时和将来很快要做的改动对齐。

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.

4 participants