Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change CMAKE_CUDA_STANDARD to C++17 for Windows GPU build #7883

Merged
merged 3 commits into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down
6 changes: 3 additions & 3 deletions onnxruntime/core/providers/cpu/tensor/upsample.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ constexpr const char* UpsampleModeCubic = "cubic";
// is a 4x4 matrix
const size_t CubicModeGridLength = 4;

using GetNearestPixelFunc = std::function<int64_t(float, bool)>;
using GetOriginalCoordinateFunc = std::function<float(float, float, float, float, float, float)>;
using GetNearestPixelFunc = int64_t(*)(float, bool);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change required for c++17?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, otherwise it doesn't build.

using GetOriginalCoordinateFunc = float (*)(float, float, float, float, float, float);

enum UpsampleMode {
NN = 0, // nearest neighbour
Expand Down Expand Up @@ -194,7 +194,7 @@ class UpsampleBase {
ResizeCoordinateTransformationMode coordinate_transform_mode) {
switch (coordinate_transform_mode) {
case ASYMMETRIC:
return [](float x_resized, float x_scale, float, float, float, float) {
return [](float x_resized, float x_scale, float, float, float, float) -> float {
return x_resized / x_scale;
};
case PYTORCH_HALF_PIXEL:
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/cuda/cuda_execution_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class CUDAExecutionProvider : public IExecutionProvider {
p.reset();
});
}
std::shared_ptr<PerThreadContextMap> p{std::make_shared<PerThreadContextMap>()};
std::shared_ptr<PerThreadContextMap> p = std::make_shared<PerThreadContextMap>();
};

static const std::shared_ptr<PerThreadContextMap>& PerThreadContextCache() {
Expand Down