From 2df628af884f78f9019e28dc1f242264581bbdb4 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Thu, 10 Aug 2017 15:47:30 +0800 Subject: [PATCH] Fix the bug between nvcc and boost Fix #3386 --- paddle/framework/attribute.h | 2 +- paddle/framework/ddim.h | 2 +- paddle/framework/operator.h | 2 +- paddle/platform/place.h | 2 +- paddle/platform/variant.h | 30 ++++++++++++++++++++++++++++++ 5 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 paddle/platform/variant.h diff --git a/paddle/framework/attribute.h b/paddle/framework/attribute.h index 3a5820e9c60..49a62bedb6a 100644 --- a/paddle/framework/attribute.h +++ b/paddle/framework/attribute.h @@ -14,7 +14,6 @@ limitations under the License. */ #pragma once -#include #include #include #include @@ -24,6 +23,7 @@ limitations under the License. */ #include "paddle/framework/attribute.pb.h" #include "paddle/framework/op_desc.pb.h" #include "paddle/platform/enforce.h" +#include "paddle/platform/variant.h" namespace paddle { namespace framework { diff --git a/paddle/framework/ddim.h b/paddle/framework/ddim.h index 5aa5af0c19b..b2d9fec0471 100644 --- a/paddle/framework/ddim.h +++ b/paddle/framework/ddim.h @@ -14,12 +14,12 @@ limitations under the License. */ #pragma once -#include #include #include #include #include "paddle/framework/dim.h" #include "paddle/platform/enforce.h" +#include "paddle/platform/variant.h" #include "unsupported/Eigen/CXX11/Tensor" namespace paddle { diff --git a/paddle/framework/operator.h b/paddle/framework/operator.h index 8949baf60e8..50fc6d10134 100644 --- a/paddle/framework/operator.h +++ b/paddle/framework/operator.h @@ -15,7 +15,6 @@ limitations under the License. */ #pragma once #include -#include #include #include #include @@ -27,6 +26,7 @@ limitations under the License. */ #include "paddle/framework/tensor.h" #include "paddle/platform/device_context.h" #include "paddle/platform/place.h" +#include "paddle/platform/variant.h" #include "paddle/utils/Error.h" namespace paddle { diff --git a/paddle/platform/place.h b/paddle/platform/place.h index a82e8c942fa..1117476bb37 100644 --- a/paddle/platform/place.h +++ b/paddle/platform/place.h @@ -14,8 +14,8 @@ limitations under the License. */ #pragma once -#include #include +#include "paddle/platform/variant.h" namespace paddle { namespace platform { diff --git a/paddle/platform/variant.h b/paddle/platform/variant.h new file mode 100644 index 00000000000..c5bc45ca724 --- /dev/null +++ b/paddle/platform/variant.h @@ -0,0 +1,30 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +#pragma once + +#include + +#ifndef PADDLE_ONLY_CPU + +// Because boost's variadic templates has bug on nvcc, boost will disable +// BOOST_NO_CXX11_VARIADIC_TEMPLATES when GPU enabled on nvcc. +// Disable BOOST_NO_CXX11_VARIADIC_TEMPLATES on gcc/clang to generate same +// function symbols. +#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#endif +#endif + +#include -- GitLab