From d69df9bf26e2844c276352203c6134a90716b3b6 Mon Sep 17 00:00:00 2001 From: WangXi Date: Tue, 11 Feb 2020 16:58:03 +0800 Subject: [PATCH] Add wrong info when use DGC in cpu (#22515) --- python/paddle/fluid/optimizer.py | 4 ++++ tools/sampcd_processor.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/optimizer.py b/python/paddle/fluid/optimizer.py index 24ffe8b4ae4..d9c2cb702f6 100644 --- a/python/paddle/fluid/optimizer.py +++ b/python/paddle/fluid/optimizer.py @@ -1084,6 +1084,10 @@ class DGCMomentumOptimizer(Optimizer): name=None): if framework.in_dygraph_mode(): raise Exception("In dygraph, don't support DGCMomentumOptimizer.") + + assert core.is_compiled_with_cuda(), \ + "Paddle is not compiled with CUDA. DGC is only support GPU for now." + assert learning_rate is not None assert momentum is not None super(DGCMomentumOptimizer, self).__init__( diff --git a/tools/sampcd_processor.py b/tools/sampcd_processor.py index 82002495e1b..f089e424bb8 100644 --- a/tools/sampcd_processor.py +++ b/tools/sampcd_processor.py @@ -601,12 +601,13 @@ wlist_ignore = [ 'PRelu.forward', 'Recall.update', 'start_gperf_profiler', 'TreeConv.forward', 'Conv2D.forward', 'Switch.default', 'elementwise_mod', 'Precision.update', 'WeightedAverage.eval', 'Conv3D.forward', - 'Embedding.forward', 'Recall.eval', 'FC.forward', 'While.block' + 'Embedding.forward', 'Recall.eval', 'FC.forward', 'While.block', + 'DGCMomentumOptimizer' ] # only white on CPU gpu_not_white = [ "deformable_conv", "cuda_places", "CUDAPinnedPlace", "CUDAPlace", - "cuda_profiler" + "cuda_profiler", 'DGCMomentumOptimizer' ] wlist = wlist_temp + wlist_inneed + wlist_ignore -- GitLab