From 38ca0f48398f10b6eae745988c7a1ebd276bbba5 Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Tue, 1 Jun 2021 20:28:34 -0700 Subject: [PATCH] Change CMAKE_CUDA_STANDARD to C++17 for Windows GPU build (#7883) --- cmake/CMakeLists.txt | 7 +++++-- onnxruntime/core/providers/cpu/tensor/upsample.h | 4 ++-- onnxruntime/core/providers/cuda/cuda_execution_provider.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7e8367ae3d..49a83933b8 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1385,8 +1385,11 @@ if (onnxruntime_USE_CUDA) endif() enable_language(CUDA) message( STATUS "CMAKE_CUDA_COMPILER_VERSION: ${CMAKE_CUDA_COMPILER_VERSION}") - - set(CMAKE_CUDA_STANDARD 14) + if (WIN32) + set(CMAKE_CUDA_STANDARD 17) + else() + set(CMAKE_CUDA_STANDARD 14) + endif() file(TO_CMAKE_PATH ${onnxruntime_CUDNN_HOME} onnxruntime_CUDNN_HOME) set(ONNXRUNTIME_CUDA_LIBRARIES ${CUDA_LIBRARIES}) diff --git a/onnxruntime/core/providers/cpu/tensor/upsample.h b/onnxruntime/core/providers/cpu/tensor/upsample.h index c2aea9374b..0b48cd6fed 100644 --- a/onnxruntime/core/providers/cpu/tensor/upsample.h +++ b/onnxruntime/core/providers/cpu/tensor/upsample.h @@ -18,8 +18,8 @@ constexpr const char* UpsampleModeCubic = "cubic"; // is a 4x4 matrix const size_t CubicModeGridLength = 4; -using GetNearestPixelFunc = std::function; -using GetOriginalCoordinateFunc = std::function; +using GetNearestPixelFunc = int64_t(*)(float, bool); +using GetOriginalCoordinateFunc = float (*)(float, float, float, float, float, float); enum UpsampleMode { NN = 0, // nearest neighbour diff --git a/onnxruntime/core/providers/cuda/cuda_execution_provider.h b/onnxruntime/core/providers/cuda/cuda_execution_provider.h index c1c35284ee..e8848e06f2 100644 --- a/onnxruntime/core/providers/cuda/cuda_execution_provider.h +++ b/onnxruntime/core/providers/cuda/cuda_execution_provider.h @@ -178,7 +178,7 @@ class CUDAExecutionProvider : public IExecutionProvider { p.reset(); }); } - std::shared_ptr p{std::make_shared()}; + std::shared_ptr p = std::make_shared(); }; static const std::shared_ptr& PerThreadContextCache() {