From d4282ea97ece945b1d1d72aca4ed2aa794534c13 Mon Sep 17 00:00:00 2001 From: Zhou Wei <52485244+zhouwei25@users.noreply.github.com> Date: Thu, 18 Mar 2021 12:44:34 +0800 Subject: [PATCH] fix multi cuda environment bug (#31694) --- python/paddle/utils/cpp_extension/extension_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/paddle/utils/cpp_extension/extension_utils.py b/python/paddle/utils/cpp_extension/extension_utils.py index b68100fe521..1ff42a7bcbc 100644 --- a/python/paddle/utils/cpp_extension/extension_utils.py +++ b/python/paddle/utils/cpp_extension/extension_utils.py @@ -442,7 +442,8 @@ def find_cuda_home(): [which_cmd, 'nvcc'], stderr=devnull) if six.PY3: nvcc_path = nvcc_path.decode() - nvcc_path = nvcc_path.rstrip('\r\n') + # Multi CUDA, select the first + nvcc_path = nvcc_path.split('\r\n')[0] # for example: /usr/local/cuda/bin/nvcc cuda_home = os.path.dirname(os.path.dirname(nvcc_path)) -- GitLab