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

send formatted msg to glog #5999

Merged
merged 14 commits into from
Aug 30, 2021
Merged

send formatted msg to glog #5999

merged 14 commits into from
Aug 30, 2021

Conversation

liufengwei0103
Copy link
Contributor

@liufengwei0103 liufengwei0103 commented Aug 23, 2021

效果图:
截屏2021-08-27 下午12 37 29

std::string GetFormatedSerializedError(const std::shared_ptr<cfg::ErrorProto>& error_proto) {
const auto& maybe_error = TRY(FormatErrorStr(error_proto));
const auto& error_str = maybe_error.GetDataAndErrorProto(error_proto->DebugString());
return error_str.first;
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的调用方式不需要这么迂回,直接返回 maybe_error.Data_YouAreNotAllowedToCallThisFuncOutsideThisFile() 就可以了

Copy link
Contributor Author

@liufengwei0103 liufengwei0103 Aug 30, 2021

Choose a reason for hiding this comment

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

这里的调用方式不需要这么迂回,直接返回 maybe_error.Data_YouAreNotAllowedToCallThisFuncOutsideThisFile() 就可以了

不是吧,这里调用Data_YouAreNotAllowedToCallThisFuncOutsideThisFile这个函数只会返回T data。 这里本来的意思是,如果FormatErrorStr失败了,返回错误栈原来的呈现方式,FormatErrorStr的错误栈就不需要了。

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.

哦哦,了解了。添加一个注释吧

已加

@@ -29,6 +29,11 @@ namespace oneflow {
template<typename T, typename Enabled = void>
class Maybe;

Maybe<std::string> FormatErrorStr(const std::shared_ptr<cfg::ErrorProto>&);
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

@liufengwei0103 liufengwei0103 Aug 30, 2021

Choose a reason for hiding this comment

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

这一行是不是没必要

后面会调用这个函数,这里提前声明一下。否则需要include一下声明这个函数的文件(目前没有声明,只有定义)。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这一行是不是没必要

太多文件编译依赖maybe.h,如果include的方式,被include的文件的改动,会造成大量重新编译。

@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 30, 2021 03:11
@oneflow-ci-bot oneflow-ci-bot self-requested a review August 30, 2021 06:26
@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

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

OneFlow resnet50 time: 74.1ms (= 3707.0ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 85.2ms (= 4257.9ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.15 (= 85.2ms / 74.1ms)

OneFlow resnet50 time: 50.0ms (= 2499.2ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 57.5ms (= 2873.3ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.15 (= 57.5ms / 50.0ms)

OneFlow resnet50 time: 42.3ms (= 2114.1ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 48.4ms (= 2418.3ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.14 (= 48.4ms / 42.3ms)

OneFlow resnet50 time: 39.8ms (= 1988.3ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 43.4ms (= 2171.1ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.09 (= 43.4ms / 39.8ms)

OneFlow resnet50 time: 148.1ms (= 7402.8ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 152.3ms (= 7615.9ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.03 (= 152.3ms / 148.1ms)

OneFlow resnet50 time: 91.9ms (= 4595.3ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 96.4ms (= 4818.0ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.05 (= 96.4ms / 91.9ms)

OneFlow resnet50 time: 63.7ms (= 3187.2ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 68.9ms (= 3443.6ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.08 (= 68.9ms / 63.7ms)

OneFlow resnet50 time: 57.6ms (= 2878.8ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 56.4ms (= 2818.9ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 0.98 (= 56.4ms / 57.6ms)

OneFlow resnet50 time: 61.1ms (= 3056.9ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 48.3ms (= 2414.1ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 0.79 (= 48.3ms / 61.1ms)

@oneflow-ci-bot oneflow-ci-bot merged commit 51f4cb9 into master Aug 30, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the send_formatted_msg_to_glog branch August 30, 2021 09: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.

None yet

3 participants