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

Add timeout and loc for blocking calls #6007

Merged
merged 37 commits into from
Aug 24, 2021

Conversation

jackalcooper
Copy link
Collaborator

No description provided.

@jackalcooper jackalcooper marked this pull request as ready for review August 24, 2021 02:56
@jackalcooper
Copy link
Collaborator Author

效果:

E0824 10:59:54.763103 4013850 tensor.cpp:96] [rank=1] blocking detected. Python stack:
  File "graph/train_consistent.py", line 370, in <module>
    main(args)

  File "graph/train_consistent.py", line 310, in main
    l = loss.numpy()

  File "/home/caishenghang/oneflow_cuda/python/oneflow/framework/tensor.py", line 50, in _tensor_numpy
    with BlockingContext() as ctx:

  File "/home/caishenghang/oneflow_cuda/python/oneflow/support/blocking.py", line 9, in __init__
    stack_info = "\n".join(traceback.format_stack(limit=5))
E0824 10:59:57.762894 4013849 transport_util.cpp:34] [rank=0] blocking detected. Python stack:
  File "graph/train_consistent.py", line 370, in <module>
    main(args)

  File "graph/train_consistent.py", line 348, in main
    flow.save(

  File "/home/caishenghang/oneflow_cuda/python/oneflow/framework/check_point_v2.py", line 166, in save
    var_dict[name] = var.to_consistent(sbp=flow.sbp.broadcast).to_local()

  File "/home/caishenghang/oneflow_cuda/python/oneflow/nn/modules/consistent_cast.py", line 104, in to_consistent_op
    with BlockingContext() as ctx:

  File "/home/caishenghang/oneflow_cuda/python/oneflow/support/blocking.py", line 9, in __init__
    stack_info = "\n".join(traceback.format_stack(limit=5))

import oneflow._oneflow_internal


class BlockingContext:
Copy link
Contributor

Choose a reason for hiding this comment

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

BlockingInfoContext


def __exit__(self, exc_type, exc_value, traceback):
pass
# oneflow._oneflow_internal.blocking.clear_stack_info_callback()
Copy link
Contributor

Choose a reason for hiding this comment

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

这里不应该被注释。

std::chrono::duration<double> elapsed_seconds = end - start;
CHECK_LT_OR_RETURN(elapsed_seconds.count(), seconds)
<< Error::TimeoutError() << "Timeout error at " << seconds << " seconds.";
}
return Maybe<void>::Ok();
}

Maybe<void> SpinWaitUntilTimeout(const std::function<bool()>& NeedSpin, int64_t seconds) {
return SpinWaitUntilTimeout(
NeedSpin, seconds, [] {}, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的heartbeat_interval_seconds是不是应该是seconds

@oneflow-ci-bot oneflow-ci-bot self-requested a review August 24, 2021 07:17
@jackalcooper jackalcooper requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 24, 2021 14:46
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 24, 2021 15:47
@jackalcooper jackalcooper requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 24, 2021 15:49
@oneflow-ci-bot oneflow-ci-bot removed their request for review August 24, 2021 17:22
@oneflow-ci-bot oneflow-ci-bot self-requested a review August 24, 2021 17:22
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 24, 2021 18:22
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 24, 2021 19:57
@oneflow-ci-bot oneflow-ci-bot self-requested a review August 24, 2021 22:44
@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

PyTorch resnet50 time: 139.8ms (= 6989.5ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 127.9ms (= 6395.8ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
Relative speed: 1.09 (= 139.8ms / 127.9ms)

PyTorch resnet50 time: 84.4ms (= 4218.3ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 74.4ms (= 3720.6ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
Relative speed: 1.13 (= 84.4ms / 74.4ms)

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

PyTorch resnet50 time: 45.4ms (= 2269.3ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 43.4ms (= 2169.6ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
Relative speed: 1.05 (= 45.4ms / 43.4ms)

PyTorch resnet50 time: 42.7ms (= 2136.8ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 40.4ms (= 2022.1ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
Relative speed: 1.06 (= 42.7ms / 40.4ms)

@oneflow-ci-bot oneflow-ci-bot removed their request for review August 24, 2021 23:51
@oneflow-ci-bot oneflow-ci-bot merged commit 69caea8 into master Aug 24, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the add_timeout_and_loc_for_blocking_calls branch August 24, 2021 23:52
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