From 75681c0a7910e97306eb709d3d7e9ed76301ae15 Mon Sep 17 00:00:00 2001 From: dzhwinter Date: Sun, 2 Sep 2018 18:53:02 +0800 Subject: [PATCH] switch to 9.2 --- cmake/cuda.cmake | 2 +- cmake/flags.cmake | 4 ++-- paddle/fluid/framework/eigen.h | 1 + paddle/fluid/framework/ir/node.cc | 2 +- paddle/fluid/framework/op_registry.h | 4 ++++ paddle/fluid/framework/tensor.h | 4 ++++ paddle/fluid/framework/tensor_util.h | 4 ++-- paddle/fluid/inference/api/helper.h | 1 - paddle/fluid/operators/accuracy_op.h | 1 + paddle/fluid/operators/cast_op.h | 7 +------ 10 files changed, 17 insertions(+), 13 deletions(-) diff --git a/cmake/cuda.cmake b/cmake/cuda.cmake index 03c73786a6..2a5588a46b 100644 --- a/cmake/cuda.cmake +++ b/cmake/cuda.cmake @@ -169,9 +169,9 @@ set(CUDA_PROPAGATE_HOST_FLAGS OFF) # Release/Debug flags set by cmake. Such as -O3 -g -DNDEBUG etc. # So, don't set these flags here. +#list(APPEND CUDA_NVCC_FLAGS "-std=c++14") if (NOT WIN32) # windows msvc2015 support c++11 natively. # -std=c++11 -fPIC not recoginize by msvc, -Xcompiler will be added by cmake. -list(APPEND CUDA_NVCC_FLAGS "-std=c++11") list(APPEND CUDA_NVCC_FLAGS "-Xcompiler -fPIC") endif(NOT WIN32) diff --git a/cmake/flags.cmake b/cmake/flags.cmake index e69ba70e78..3dffacdacb 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -136,7 +136,7 @@ else(NOT WIN32) set(COMMON_FLAGS "/w") #disable all warnings set(GPU_COMMON_FLAGS - /w) #disable all warnings + -w) #disable all warnings endif(NOT WIN32) @@ -160,7 +160,7 @@ if(UNIX AND NOT APPLE) set(LINUX TRUE) endif(UNIX AND NOT APPLE) - +set(GPU_COMMON_FLAGS -std=c++11 ${GPU_COMMON_FLAGS}) foreach(flag ${COMMON_FLAGS}) safe_set_cflag(CMAKE_C_FLAGS ${flag}) safe_set_cxxflag(CMAKE_CXX_FLAGS ${flag}) diff --git a/paddle/fluid/framework/eigen.h b/paddle/fluid/framework/eigen.h index e23472cef2..d381e50dea 100644 --- a/paddle/fluid/framework/eigen.h +++ b/paddle/fluid/framework/eigen.h @@ -17,6 +17,7 @@ limitations under the License. */ #define GLOG_NO_ABBREVIATED_SEVERITIES #include "paddle/fluid/framework/tensor.h" +#include #include "unsupported/Eigen/CXX11/Tensor" namespace paddle { diff --git a/paddle/fluid/framework/ir/node.cc b/paddle/fluid/framework/ir/node.cc index 03ed6da104..cc7fd23be7 100644 --- a/paddle/fluid/framework/ir/node.cc +++ b/paddle/fluid/framework/ir/node.cc @@ -18,7 +18,7 @@ namespace paddle { namespace framework { namespace ir { -constexpr char Node::kControlDepVarName[]; +char Node::kControlDepVarName[]; int Node::count_ = 0; } // namespace ir } // namespace framework diff --git a/paddle/fluid/framework/op_registry.h b/paddle/fluid/framework/op_registry.h index 0e6e74293c..2bd2dd4200 100644 --- a/paddle/fluid/framework/op_registry.h +++ b/paddle/fluid/framework/op_registry.h @@ -23,6 +23,10 @@ limitations under the License. */ #include #include +#if defined(_WIN32) +#define GLOG_NO_ABBREVIATED_SEVERITIES // msvc conflict logging with windows.h +#endif + #include "glog/logging.h" // For VLOG() #include "paddle/fluid/framework/attribute.h" #include "paddle/fluid/framework/details/op_registry.h" diff --git a/paddle/fluid/framework/tensor.h b/paddle/fluid/framework/tensor.h index 4cf95fa0ae..bb52787b4b 100644 --- a/paddle/fluid/framework/tensor.h +++ b/paddle/fluid/framework/tensor.h @@ -20,6 +20,10 @@ limitations under the License. */ #include #include +#if defined(_WIN32) +#define GLOG_NO_ABBREVIATED_SEVERITIES // msvc conflict logging with windows.h +#endif + #include "paddle/fluid/framework/data_layout.h" #include "paddle/fluid/framework/ddim.h" #include "paddle/fluid/memory/memory.h" diff --git a/paddle/fluid/framework/tensor_util.h b/paddle/fluid/framework/tensor_util.h index addf71f4dc..4457382ade 100644 --- a/paddle/fluid/framework/tensor_util.h +++ b/paddle/fluid/framework/tensor_util.h @@ -57,8 +57,8 @@ void TensorToVector(const Tensor& src, const platform::DeviceContext& ctx, template void TesnorToVector(const Tensor& src, std::vector* dst); -// bool TensorContainsNAN(const framework::Tensor& tensor); -// bool TensorContainsInf(const framework::Tensor& tensor); +bool TensorContainsNAN(const framework::Tensor& tensor); +bool TensorContainsInf(const framework::Tensor& tensor); void TensorToStream(std::ostream& os, const Tensor& tensor, const platform::DeviceContext& dev_ctx); diff --git a/paddle/fluid/inference/api/helper.h b/paddle/fluid/inference/api/helper.h index 90c4b56d53..4b64c2dc25 100644 --- a/paddle/fluid/inference/api/helper.h +++ b/paddle/fluid/inference/api/helper.h @@ -14,7 +14,6 @@ #pragma once -#include #include #include #include diff --git a/paddle/fluid/operators/accuracy_op.h b/paddle/fluid/operators/accuracy_op.h index 803244dd48..8d3313db96 100644 --- a/paddle/fluid/operators/accuracy_op.h +++ b/paddle/fluid/operators/accuracy_op.h @@ -14,6 +14,7 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/framework/op_registry.h" namespace paddle { diff --git a/paddle/fluid/operators/cast_op.h b/paddle/fluid/operators/cast_op.h index 469fe13774..ea710aaad5 100644 --- a/paddle/fluid/operators/cast_op.h +++ b/paddle/fluid/operators/cast_op.h @@ -54,17 +54,12 @@ class CastOpKernel : public framework::OpKernel { void Compute(const framework::ExecutionContext& context) const override { auto* in = context.Input("X"); auto* out = context.Output("Out"); -#if !defined(_MSC_VER) + framework::VisitDataType( static_cast( context.Attr("out_dtype")), CastOpFunctor( in, out, context.template device_context())); -#else - auto type = static_cast( - context.Attr("out_dtype")); - trans -#endif // msvc } }; -- GitLab