From 4ec72876020a15598678f2f83b2df2a38cf4dd8f Mon Sep 17 00:00:00 2001 From: Wilber Date: Thu, 14 May 2020 13:09:09 +0800 Subject: [PATCH] fix compile when with_nccl=off. test=develop (#24444) --- cmake/external/lite.cmake | 1 + paddle/fluid/operators/sync_batch_norm_op.cu.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/external/lite.cmake b/cmake/external/lite.cmake index 323a8ddc729..70c11d37f91 100644 --- a/cmake/external/lite.cmake +++ b/cmake/external/lite.cmake @@ -91,3 +91,4 @@ endfunction() external_lite_static_libs(lite_full_static ${LITE_BINARY_DIR}/inference_lite_lib/cxx/lib/libpaddle_full_api_shared.so) add_definitions(-DPADDLE_WITH_LITE) +add_definitions(-DLITE_WITH_LOG) diff --git a/paddle/fluid/operators/sync_batch_norm_op.cu.h b/paddle/fluid/operators/sync_batch_norm_op.cu.h index f3d579f3f86..d52eaecb94c 100644 --- a/paddle/fluid/operators/sync_batch_norm_op.cu.h +++ b/paddle/fluid/operators/sync_batch_norm_op.cu.h @@ -186,7 +186,7 @@ void SyncBatchNormFunctor(const framework::ExecutionContext &ctx, auto gplace = BOOST_GET_CONST(platform::CUDAPlace, ctx.GetPlace()); memory::Copy(platform::CPUPlace(), c_g_st_d, gplace, stats, bytes, 0); -#ifndef WIN32 +#ifdef PADDLE_WITH_NCCL auto *comm = dev_ctx.nccl_comm(); if (comm) { int dtype = platform::ToNCCLDataType(mean_out->type()); @@ -460,7 +460,7 @@ void SyncBatchNormGradFunctor( dy_d, x_d, saved_mean, N, fsize, C, stats); } -#ifndef WIN32 +#ifdef PADDLE_WITH_NCCL auto *comm = dev_ctx.nccl_comm(); if (comm) { int dtype = platform::ToNCCLDataType(scale->type()); -- GitLab