From abad724e4e4a503670f7bb45e112aabddae73577 Mon Sep 17 00:00:00 2001 From: HongyuJia Date: Tue, 14 Feb 2023 12:10:17 +0800 Subject: [PATCH] fix windows copysign error (part2) (#50468) --- paddle/fluid/eager/pylayer/py_layer_node.h | 4 ++++ paddle/fluid/pybind/communication.cc | 4 ++++ paddle/fluid/pybind/communication.h | 4 ++++ paddle/fluid/pybind/communicator_py.cc | 4 ++++ paddle/fluid/pybind/communicator_py.h | 4 ++++ paddle/fluid/pybind/exception.h | 4 ++++ paddle/fluid/pybind/gloo_context_py.cc | 4 ++++ paddle/fluid/pybind/gloo_context_py.h | 4 ++++ paddle/fluid/pybind/imperative.cc | 5 +++++ paddle/fluid/pybind/imperative.h | 4 ++++ paddle/fluid/pybind/jit.h | 4 ++++ paddle/fluid/pybind/parallel_executor.cc | 4 ++++ paddle/fluid/pybind/place.cc | 4 ++++ paddle/fluid/pybind/pybind.cc | 4 ++++ paddle/fluid/pybind/slice_utils.h | 4 ++++ paddle/fluid/pybind/tensor.cc | 4 ++++ paddle/fluid/pybind/tensor_py.h | 4 ++++ paddle/fluid/pybind/uva_utils.h | 4 ++++ 18 files changed, 73 insertions(+) diff --git a/paddle/fluid/eager/pylayer/py_layer_node.h b/paddle/fluid/eager/pylayer/py_layer_node.h index 2b37765bc2a..5eee2f15c1b 100644 --- a/paddle/fluid/eager/pylayer/py_layer_node.h +++ b/paddle/fluid/eager/pylayer/py_layer_node.h @@ -15,6 +15,10 @@ #pragma once #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include "paddle/fluid/eager/autograd_meta.h" #include "paddle/fluid/eager/grad_node_info.h" diff --git a/paddle/fluid/pybind/communication.cc b/paddle/fluid/pybind/communication.cc index b9b57f4339b..31b89d1ca94 100644 --- a/paddle/fluid/pybind/communication.cc +++ b/paddle/fluid/pybind/communication.cc @@ -15,6 +15,10 @@ limitations under the License. */ #include "paddle/fluid/pybind/communication.h" #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include #include #include diff --git a/paddle/fluid/pybind/communication.h b/paddle/fluid/pybind/communication.h index b22750afe9a..eed19dad623 100644 --- a/paddle/fluid/pybind/communication.h +++ b/paddle/fluid/pybind/communication.h @@ -15,6 +15,10 @@ limitations under the License. */ #pragma once #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include "pybind11/chrono.h" #include "pybind11/complex.h" diff --git a/paddle/fluid/pybind/communicator_py.cc b/paddle/fluid/pybind/communicator_py.cc index 7f5ba0e21b4..37cb589856b 100644 --- a/paddle/fluid/pybind/communicator_py.cc +++ b/paddle/fluid/pybind/communicator_py.cc @@ -15,6 +15,10 @@ limitations under the License. */ #include "paddle/fluid/pybind/communicator_py.h" #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include #include diff --git a/paddle/fluid/pybind/communicator_py.h b/paddle/fluid/pybind/communicator_py.h index 7fee6e74526..6fb93842fca 100644 --- a/paddle/fluid/pybind/communicator_py.h +++ b/paddle/fluid/pybind/communicator_py.h @@ -15,6 +15,10 @@ limitations under the License. */ #pragma once #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include "pybind11/chrono.h" #include "pybind11/complex.h" diff --git a/paddle/fluid/pybind/exception.h b/paddle/fluid/pybind/exception.h index b0e0ef82103..31219686dfb 100644 --- a/paddle/fluid/pybind/exception.h +++ b/paddle/fluid/pybind/exception.h @@ -14,6 +14,10 @@ limitations under the License. */ #pragma once #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include "paddle/fluid/platform/enforce.h" #include "pybind11/pybind11.h" diff --git a/paddle/fluid/pybind/gloo_context_py.cc b/paddle/fluid/pybind/gloo_context_py.cc index b4ee1bcd02b..4b2117306a2 100644 --- a/paddle/fluid/pybind/gloo_context_py.cc +++ b/paddle/fluid/pybind/gloo_context_py.cc @@ -15,6 +15,10 @@ limitations under the License. */ #include "paddle/fluid/pybind/gloo_context_py.h" #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include #include #include diff --git a/paddle/fluid/pybind/gloo_context_py.h b/paddle/fluid/pybind/gloo_context_py.h index 51f736ed060..43acc15e3cb 100644 --- a/paddle/fluid/pybind/gloo_context_py.h +++ b/paddle/fluid/pybind/gloo_context_py.h @@ -14,6 +14,10 @@ limitations under the License. */ #pragma once #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include "pybind11/pybind11.h" #include "pybind11/stl.h" diff --git a/paddle/fluid/pybind/imperative.cc b/paddle/fluid/pybind/imperative.cc index e0104472057..d3db3befe96 100644 --- a/paddle/fluid/pybind/imperative.cc +++ b/paddle/fluid/pybind/imperative.cc @@ -15,6 +15,11 @@ limitations under the License. */ #include "paddle/fluid/pybind/imperative.h" #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif + #include #include #include diff --git a/paddle/fluid/pybind/imperative.h b/paddle/fluid/pybind/imperative.h index 91b92944215..ff2561d8b93 100644 --- a/paddle/fluid/pybind/imperative.h +++ b/paddle/fluid/pybind/imperative.h @@ -14,6 +14,10 @@ limitations under the License. */ #pragma once #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include "pybind11/pybind11.h" #include "pybind11/stl.h" diff --git a/paddle/fluid/pybind/jit.h b/paddle/fluid/pybind/jit.h index 897e22e8b85..72bb56c110b 100644 --- a/paddle/fluid/pybind/jit.h +++ b/paddle/fluid/pybind/jit.h @@ -14,6 +14,10 @@ limitations under the License. */ #pragma once #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include "pybind11/pybind11.h" #include "pybind11/stl.h" diff --git a/paddle/fluid/pybind/parallel_executor.cc b/paddle/fluid/pybind/parallel_executor.cc index 9ca2682462e..5c49c1d904e 100644 --- a/paddle/fluid/pybind/parallel_executor.cc +++ b/paddle/fluid/pybind/parallel_executor.cc @@ -13,6 +13,10 @@ 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. */ #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include #include diff --git a/paddle/fluid/pybind/place.cc b/paddle/fluid/pybind/place.cc index 9201908e50c..2f8a5a1c44c 100644 --- a/paddle/fluid/pybind/place.cc +++ b/paddle/fluid/pybind/place.cc @@ -13,6 +13,10 @@ 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. */ #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include #include diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index 29bf54823db..93dea2eb69f 100644 --- a/paddle/fluid/pybind/pybind.cc +++ b/paddle/fluid/pybind/pybind.cc @@ -13,6 +13,10 @@ 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. */ #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include #include diff --git a/paddle/fluid/pybind/slice_utils.h b/paddle/fluid/pybind/slice_utils.h index 1e0a4bd67b1..2977f6e3130 100644 --- a/paddle/fluid/pybind/slice_utils.h +++ b/paddle/fluid/pybind/slice_utils.h @@ -15,6 +15,10 @@ #pragma once #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include "paddle/fluid/framework/convert_utils.h" #include "paddle/fluid/framework/scope_guard.h" diff --git a/paddle/fluid/pybind/tensor.cc b/paddle/fluid/pybind/tensor.cc index aa42a932357..08b17e1aa34 100644 --- a/paddle/fluid/pybind/tensor.cc +++ b/paddle/fluid/pybind/tensor.cc @@ -13,6 +13,10 @@ 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. */ #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include #include diff --git a/paddle/fluid/pybind/tensor_py.h b/paddle/fluid/pybind/tensor_py.h index b21d735b589..ac13fd054fc 100644 --- a/paddle/fluid/pybind/tensor_py.h +++ b/paddle/fluid/pybind/tensor_py.h @@ -15,6 +15,10 @@ limitations under the License. */ #pragma once #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include #include diff --git a/paddle/fluid/pybind/uva_utils.h b/paddle/fluid/pybind/uva_utils.h index 62fd01e6427..7f29814bcec 100644 --- a/paddle/fluid/pybind/uva_utils.h +++ b/paddle/fluid/pybind/uva_utils.h @@ -15,6 +15,10 @@ #pragma once #include +// Avoid a problem with copysign defined in pyconfig.h on Windows. +#ifdef copysign +#undef copysign +#endif #include "paddle/fluid/operators/utils.h" #include "paddle/phi/common/data_type.h" -- GitLab