From 3a2093a5b7e8fb72be6cfdad97db196ea6419232 Mon Sep 17 00:00:00 2001 From: zhangbo9674 <82555433+zhangbo9674@users.noreply.github.com> Date: Wed, 15 Dec 2021 15:26:09 +0800 Subject: [PATCH] add use_warning of amp (#38086) --- python/paddle/fluid/dygraph/amp/auto_cast.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/python/paddle/fluid/dygraph/amp/auto_cast.py b/python/paddle/fluid/dygraph/amp/auto_cast.py index 7b70daa1507..642ac5e26a2 100644 --- a/python/paddle/fluid/dygraph/amp/auto_cast.py +++ b/python/paddle/fluid/dygraph/amp/auto_cast.py @@ -218,6 +218,13 @@ def amp_guard(enable=True, % tracer._expected_place) enable = False + if tracer._expected_place.is_gpu_place(): + prop = paddle.device.cuda.get_device_capability() + if prop[0] < 7: + warnings.warn( + "AMP only support NVIDIA GPU with Compute Capability 7.0 or higher, current GPU is: %s, with Compute Capability: %d.%d." + % (paddle.device.cuda.get_device_name(), prop[0], prop[1])) + if level == 'O1': amp_level = AMP_LEVEL.O1 _white_list = WHITE_LIST -- GitLab