diff --git a/paddle/fluid/framework/fleet/fleet_wrapper.h b/paddle/fluid/framework/fleet/fleet_wrapper.h index 982c1b85a5b03bcf481f4e12f9484662fa759040..c9c03fb66f8fa7860f1f746d2587d1b516e7b45d 100644 --- a/paddle/fluid/framework/fleet/fleet_wrapper.h +++ b/paddle/fluid/framework/fleet/fleet_wrapper.h @@ -38,6 +38,7 @@ limitations under the License. */ #ifdef PADDLE_WITH_HETERPS #include "paddle/fluid/platform/device/gpu/gpu_types.h" #endif +#include "paddle/fluid/framework/fleet/heter_ps/log_patch.h" namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/fleet/heter_ps/log_patch.h b/paddle/fluid/framework/fleet/heter_ps/log_patch.h new file mode 100644 index 0000000000000000000000000000000000000000..84c83a56f30613f3d95fb65702c6853aa82424bf --- /dev/null +++ b/paddle/fluid/framework/fleet/heter_ps/log_patch.h @@ -0,0 +1,34 @@ +/* Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. */ + +#pragma once + +#include + +#undef VLOG_IS_ON +#define VLOG_IS_ON(verboselevel) (FLAGS_v >= (verboselevel)) + +#undef COMPACT_GOOGLE_LOG_INFO +#define COMPACT_GOOGLE_LOG_INFO google::LogMessage(__FILE__, __LINE__) + +#undef LOG +#define LOG(severity) COMPACT_GOOGLE_LOG_##severity.stream() + +#undef LOG_IF +#define LOG_IF(severity, condition) \ + static_cast(0), \ + !(condition) ? (void)0 : google::LogMessageVoidify() & LOG(severity) + +#undef VLOG +#define VLOG(verboselevel) LOG_IF(INFO, VLOG_IS_ON(verboselevel)) diff --git a/paddle/fluid/framework/fleet/ps_gpu_wrapper.h b/paddle/fluid/framework/fleet/ps_gpu_wrapper.h index 0e816beef0d331766802f9c76875bf6de7c7315a..fae30a45d2e5b7f6e781098a330716da748e9e22 100644 --- a/paddle/fluid/framework/fleet/ps_gpu_wrapper.h +++ b/paddle/fluid/framework/fleet/ps_gpu_wrapper.h @@ -59,6 +59,7 @@ limitations under the License. */ #ifdef PADDLE_WITH_PSLIB #include "downpour_accessor.h" // NOLINT #endif +#include "paddle/fluid/framework/fleet/heter_ps/log_patch.h" namespace paddle { namespace framework {