From f861151ad7f79fcb9d864ea53f9b2caf502c2b52 Mon Sep 17 00:00:00 2001 From: qiuzhongya Date: Tue, 13 Dec 2022 09:13:16 +0800 Subject: [PATCH] support for gcc11 in gpu --- .../gpu/kernel/arrays/scale_and_translate_gpu_kernel.cc | 2 +- .../gpu/kernel/arrays/scale_and_translate_grad_gpu_kernel.cc | 2 +- .../ccsrc/plugin/device/gpu/kernel/cuda_impl/CMakeLists.txt | 5 +++-- .../plugin/device/gpu/kernel/nn/resize_bicubic_gpu_kernel.cc | 2 +- .../device/gpu/kernel/nn/resize_bicubic_grad_gpu_kernel.cc | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mindspore/ccsrc/plugin/device/gpu/kernel/arrays/scale_and_translate_gpu_kernel.cc b/mindspore/ccsrc/plugin/device/gpu/kernel/arrays/scale_and_translate_gpu_kernel.cc index 4ae2adcf8e7..10cd22775f4 100644 --- a/mindspore/ccsrc/plugin/device/gpu/kernel/arrays/scale_and_translate_gpu_kernel.cc +++ b/mindspore/ccsrc/plugin/device/gpu/kernel/arrays/scale_and_translate_gpu_kernel.cc @@ -114,7 +114,7 @@ int ScaleAndTranslateGpuKernelMod::Resize(const BaseOperatorPtr &base_operator, const std::vector &inputs, const std::vector &outputs, const std::map &inputsOnHost) { - for (const auto inputtest : inputs) { + for (const auto &inputtest : inputs) { auto inshape = inputtest->GetShapeVector(); if (!IsValidShape(inshape)) { return KRET_UNKNOWN_SHAPE; diff --git a/mindspore/ccsrc/plugin/device/gpu/kernel/arrays/scale_and_translate_grad_gpu_kernel.cc b/mindspore/ccsrc/plugin/device/gpu/kernel/arrays/scale_and_translate_grad_gpu_kernel.cc index 35a67d66926..1be512ea8be 100644 --- a/mindspore/ccsrc/plugin/device/gpu/kernel/arrays/scale_and_translate_grad_gpu_kernel.cc +++ b/mindspore/ccsrc/plugin/device/gpu/kernel/arrays/scale_and_translate_grad_gpu_kernel.cc @@ -78,7 +78,7 @@ int ScaleAndTranslateGradGpuKernelMod::Resize(const BaseOperatorPtr &base_operat std::vector inp_shape_scale = inputs[kIndex2]->GetShapeVector(); std::vector inp_shape_translation = inputs[kIndex3]->GetShapeVector(); std::vector out_shape = outputs[0]->GetShapeVector(); - for (const auto inputtest : inputs) { + for (const auto &inputtest : inputs) { auto inshape = inputtest->GetShapeVector(); if (!IsValidShape(inshape)) { return KRET_UNKNOWN_SHAPE; diff --git a/mindspore/ccsrc/plugin/device/gpu/kernel/cuda_impl/CMakeLists.txt b/mindspore/ccsrc/plugin/device/gpu/kernel/cuda_impl/CMakeLists.txt index 8c9cc85a411..744634c2360 100644 --- a/mindspore/ccsrc/plugin/device/gpu/kernel/cuda_impl/CMakeLists.txt +++ b/mindspore/ccsrc/plugin/device/gpu/kernel/cuda_impl/CMakeLists.txt @@ -11,11 +11,12 @@ endif() if(${CUDA_VERSION} VERSION_LESS 11.0) if(NOT MSVC) - string(REPLACE "-std=c++17" "-std=c++11" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REPLACE "-std=c++17" "-std=c++11" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") endif() else() if(NOT MSVC) - string(REPLACE "-std=c++17" "-std=c++14" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REPLACE "-std=c++17" "-std=c++14" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++14") endif() endif() diff --git a/mindspore/ccsrc/plugin/device/gpu/kernel/nn/resize_bicubic_gpu_kernel.cc b/mindspore/ccsrc/plugin/device/gpu/kernel/nn/resize_bicubic_gpu_kernel.cc index 719fc211f53..b4182d3d6ea 100644 --- a/mindspore/ccsrc/plugin/device/gpu/kernel/nn/resize_bicubic_gpu_kernel.cc +++ b/mindspore/ccsrc/plugin/device/gpu/kernel/nn/resize_bicubic_gpu_kernel.cc @@ -84,7 +84,7 @@ int ResizeBicubicGpuKernelMod::Resize(const BaseOperatorPtr &base_operator, cons std::vector inp_shape = inputs[0]->GetShapeVector(); std::vector inptosize_shape = inputs[1]->GetShapeVector(); std::vector out_shape = outputs[0]->GetShapeVector(); - for (const auto inputtest : inputs) { + for (const auto &inputtest : inputs) { auto inshape = inputtest->GetShapeVector(); if (!IsValidShape(inshape)) { return KRET_UNKNOWN_SHAPE; diff --git a/mindspore/ccsrc/plugin/device/gpu/kernel/nn/resize_bicubic_grad_gpu_kernel.cc b/mindspore/ccsrc/plugin/device/gpu/kernel/nn/resize_bicubic_grad_gpu_kernel.cc index 51c540e2327..a422121f5c0 100644 --- a/mindspore/ccsrc/plugin/device/gpu/kernel/nn/resize_bicubic_grad_gpu_kernel.cc +++ b/mindspore/ccsrc/plugin/device/gpu/kernel/nn/resize_bicubic_grad_gpu_kernel.cc @@ -78,7 +78,7 @@ int ResizeBicubicGradGpuKernelMod::Resize(const BaseOperatorPtr &base_operator, std::vector inp_shape = inputs[0]->GetShapeVector(); std::vector inptosize_shape = inputs[1]->GetShapeVector(); std::vector out_shape = outputs[0]->GetShapeVector(); - for (const auto inputtest : inputs) { + for (const auto &inputtest : inputs) { auto inshape = inputtest->GetShapeVector(); if (!IsValidShape(inshape)) { return KRET_UNKNOWN_SHAPE;