From b584e06166b38ccdbd10a9cc4e35553e917d166f Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Mon, 13 Jun 2022 09:34:26 -0500 Subject: [PATCH] Couple of unrelated changes - define ASIO_NO_NOMINMAX - disambiguate member access in basic_function - add datapar algorithms to hpx/local/algorithm.hpp - suppress dll-export and unused variable warnings - #include datapar headers more consistently - more consequent implementation of policy.base_policy() --- cmake/HPX_SetupAsio.cmake | 2 + .../executors/datapar/execution_policy.hpp | 4 +- .../hpx/executors/execution_policy.hpp | 55 +++++++++++++++++++ .../hpx/functional/detail/basic_function.hpp | 4 +- .../include/hpx/local/algorithm.hpp | 3 + .../command_line_handling.hpp | 4 ++ wrap/include/hpx/wrap_main.hpp | 22 +++++--- 7 files changed, 84 insertions(+), 10 deletions(-) diff --git a/cmake/HPX_SetupAsio.cmake b/cmake/HPX_SetupAsio.cmake index 8abf7353fd39..71c8a8fc320d 100644 --- a/cmake/HPX_SetupAsio.cmake +++ b/cmake/HPX_SetupAsio.cmake @@ -82,4 +82,6 @@ if(NOT HPX_FIND_PACKAGE) # Disable experimental std::string_view support as a workaround to # https://github.com/chriskohlhoff/asio/issues/597 hpx_add_config_cond_define(ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW) + # Disable Asio's definition of NOMINMAX + hpx_add_config_cond_define(ASIO_NO_NOMINMAX) endif() diff --git a/libs/core/executors/include/hpx/executors/datapar/execution_policy.hpp b/libs/core/executors/include/hpx/executors/datapar/execution_policy.hpp index e4cc2fc41525..547f58627cf3 100644 --- a/libs/core/executors/include/hpx/executors/datapar/execution_policy.hpp +++ b/libs/core/executors/include/hpx/executors/datapar/execution_policy.hpp @@ -293,9 +293,11 @@ namespace hpx { namespace execution { inline namespace v1 { using base_policy_type = sequenced_task_policy_shim; + base_policy_type base_policy() { - return simd_task_policy_shim(exec_, params_); + return sequenced_task_policy_shim( + exec_, params_); } /// Return the associated executor object. diff --git a/libs/core/executors/include/hpx/executors/execution_policy.hpp b/libs/core/executors/include/hpx/executors/execution_policy.hpp index 7c2b125fdc56..1c46f961bbd7 100644 --- a/libs/core/executors/include/hpx/executors/execution_policy.hpp +++ b/libs/core/executors/include/hpx/executors/execution_policy.hpp @@ -22,6 +22,9 @@ #include #include #include +#if defined(HPX_HAVE_DATAPAR) +#include +#endif #include #include @@ -1393,6 +1396,12 @@ namespace hpx { namespace execution { } public: + using base_policy_type = parallel_task_policy; + base_policy_type base_policy() + { + return parallel_task_policy{}; + } + /// Return the associated executor object. executor_type& executor() { @@ -1526,6 +1535,14 @@ namespace hpx { namespace execution { } public: + using base_policy_type = + parallel_task_policy_shim; + base_policy_type base_policy() + { + return parallel_task_policy_shim( + exec_, params_); + } + /// Return the associated executor object. executor_type& executor() { @@ -1686,6 +1703,12 @@ namespace hpx { namespace execution { } public: + using base_policy_type = parallel_policy; + base_policy_type base_policy() + { + return parallel_policy{}; + } + /// Return the associated executor object. executor_type& executor() { @@ -1831,6 +1854,12 @@ namespace hpx { namespace execution { } public: + using base_policy_type = parallel_policy_shim; + base_policy_type base_policy() + { + return parallel_policy_shim(exec_, params_); + } + /// Return the associated executor object. executor_type& executor() { @@ -1998,6 +2027,12 @@ namespace hpx { namespace execution { } public: + using base_policy_type = sequenced_policy; + base_policy_type base_policy() + { + return sequenced_policy{}; + } + /// Return the associated executor object. executor_type& executor() { @@ -2139,6 +2174,14 @@ namespace hpx { namespace execution { } public: + using base_policy_type = + sequenced_task_policy_shim; + base_policy_type base_policy() + { + return sequenced_task_policy_shim( + exec_, params_); + } + /// Return the associated executor object. executor_type& executor() { @@ -2305,6 +2348,12 @@ namespace hpx { namespace execution { } public: + using base_policy_type = sequenced_policy; + base_policy_type base_policy() + { + return sequenced_policy{}; + } + /// Return the associated executor object. executor_type& executor() { @@ -2447,6 +2496,12 @@ namespace hpx { namespace execution { } public: + using base_policy_type = sequenced_policy_shim; + base_policy_type base_policy() + { + return sequenced_policy_shim(exec_, params_); + } + /// Return the associated executor object. executor_type& executor() { diff --git a/libs/core/functional/include/hpx/functional/detail/basic_function.hpp b/libs/core/functional/include/hpx/functional/detail/basic_function.hpp index 7fdafabbf080..ea505e27378c 100644 --- a/libs/core/functional/include/hpx/functional/detail/basic_function.hpp +++ b/libs/core/functional/include/hpx/functional/detail/basic_function.hpp @@ -224,8 +224,8 @@ namespace hpx { namespace util { namespace detail { HPX_FORCEINLINE R operator()(Ts... vs) const { - vtable const* vptr = static_cast(base_type::vptr); - return vptr->invoke(object, HPX_FORWARD(Ts, vs)...); + vtable const* f_vptr = static_cast(base_type::vptr); + return f_vptr->invoke(object, HPX_FORWARD(Ts, vs)...); } using base_type::get_function_address; diff --git a/libs/core/include_local/include/hpx/local/algorithm.hpp b/libs/core/include_local/include/hpx/local/algorithm.hpp index 7106c982e395..a1f54a29b023 100644 --- a/libs/core/include_local/include/hpx/local/algorithm.hpp +++ b/libs/core/include_local/include/hpx/local/algorithm.hpp @@ -9,3 +9,6 @@ #include #include #include +#if defined(HPX_HAVE_DATAPAR) +#include +#endif diff --git a/libs/full/command_line_handling/include/hpx/command_line_handling/command_line_handling.hpp b/libs/full/command_line_handling/include/hpx/command_line_handling/command_line_handling.hpp index 676bfbf5d5c0..91727559899b 100644 --- a/libs/full/command_line_handling/include/hpx/command_line_handling/command_line_handling.hpp +++ b/libs/full/command_line_handling/include/hpx/command_line_handling/command_line_handling.hpp @@ -18,6 +18,8 @@ #include #include +#include + /////////////////////////////////////////////////////////////////////////////// namespace hpx { namespace util { @@ -98,3 +100,5 @@ namespace hpx { namespace util { int argc, char** argv); }; }} // namespace hpx::util + +#include diff --git a/wrap/include/hpx/wrap_main.hpp b/wrap/include/hpx/wrap_main.hpp index a8562d6d5110..5b823222e177 100644 --- a/wrap/include/hpx/wrap_main.hpp +++ b/wrap/include/hpx/wrap_main.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2014 Hartmut Kaiser +// Copyright (c) 2007-2022 Hartmut Kaiser // Copyright (c) 2018-2020 Nikunj Gupta // // SPDX-License-Identifier: BSL-1.0 @@ -8,18 +8,23 @@ #pragma once #include + +#if defined(HPX_MSVC) +#pragma warning(push) +#pragma warning(disable : 4100) +#endif + #include // We support different implementation depending upon the Operating // System in use. -#if defined(HPX_HAVE_DYNAMIC_HPX_MAIN) && \ - (defined(__linux) || defined(__linux__) || defined(linux) || \ - defined(__APPLE__)) +#if defined(HPX_HAVE_DYNAMIC_HPX_MAIN) && \ + (defined(__linux) || defined(__linux__) || defined(linux) || \ + defined(__APPLE__)) #include -namespace hpx_start -{ +namespace hpx_start { // include_libhpx_wrap here is an override for the one present in // src/hpx_wrap.cpp. The value of this variable defines if we need // to change the program's entry point or not. @@ -35,7 +40,7 @@ namespace hpx_start // HPX::wrap_main instead of an orthogonal exception about thread not // registered with the HPX runtime system. HPX_SYMBOL_EXPORT bool is_linked __attribute__((weak)) = false; -} +} // namespace hpx_start #else @@ -49,3 +54,6 @@ namespace hpx_start #define main hpx_startup::user_main #endif +#if defined(HPX_MSVC) +#pragma warning(pop) +#endif