Skip to content

Commit

Permalink
Merge pull request #2520 from STEllAR-GROUP/intel17_support
Browse files Browse the repository at this point in the history
Intel 17 support
  • Loading branch information
hkaiser committed Feb 28, 2017
2 parents f0de023 + a6d0a44 commit 50b29e1
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 41 deletions.
28 changes: 15 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -910,27 +910,29 @@ if(NOT MSVC)
if(HPX_WITH_CUDA AND NOT HPX_WITH_CUDA_CLANG)
set(CXX_FLAG -std=c++11)
else()
# Try -std=c++14 first

# The Intel compiler has the C++14 flag, but doesn't have sufficient C++14
# support to compile Boost. If the user has explicitly asked for it, use it,
# otherwise don't run the check.
# FIXME: This should be replaced with a version-based check in the future
# when the Intel compiler is able to build Boost with -std=c++14.
if(HPX_WITH_CXX14 OR NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"))
# Try -std=c++14 first
if(HPX_WITH_CXX14 OR NOT (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)))
check_cxx_compiler_flag(-std=c++14 HPX_WITH_CXX14)
endif()
if(HPX_WITH_CXX14)

if(HPX_WITH_CXX14)
set(CXX_FLAG -std=c++14)
# The Intel compiler doesn't appear to have a fully functional
# implementation of C++14 constexpr. It's fine with our C++14 constexpr
# usage in HPX but chokes on Boost.
# FIXME: This should be replaced with a version-based check in the future
# when the Intel compiler is able to build Boost with -std=c++14.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
add_definitions(-DBOOST_NO_CXX14_CONSTEXPR)
endif()
else()
# ... otherwise try -std=c++1y

# See comment above.
# FIXME: This should be replaced with a version-based check in the future
# when the Intel compiler is able to build Boost with -std=c++14.
if(HPX_WITH_CXX1Y OR NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"))
check_cxx_compiler_flag(-std=c++1y HPX_WITH_CXX1Y)
if(HPX_WITH_CXX1Y OR NOT (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)))
check_cxx_compiler_flag(-std=c++1y HPX_WITH_CXX1y)
endif()

if(HPX_WITH_CXX1Y)
Expand Down
6 changes: 3 additions & 3 deletions cmake/HPX_AddConfigTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,9 @@ macro(hpx_check_for_cxx14_std_result_of_sfinae)
endmacro()

###############################################################################
macro(hpx_check_for_cxx_experimental_std_optional)
add_hpx_config_test(HPX_WITH_CXX1Y_EXPERIMENTAL_OPTIONAL
SOURCE cmake/tests/cxx1y_experimental_std_optional.cpp
macro(hpx_check_for_libfun_std_experimental_optional)
add_hpx_config_test(HPX_WITH_LIBFUN_EXPERIMENTAL_OPTIONAL
SOURCE cmake/tests/libfun_std_experimental_optional.cpp
FILE ${ARGN})
endmacro()

Expand Down
11 changes: 6 additions & 5 deletions cmake/HPX_PerformCxxFeatureTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ macro(hpx_perform_cxx_feature_tests)
hpx_check_for_cxx11_std_type_traits(
DEFINITIONS HPX_HAVE_CXX11_STD_TYPE_TRAITS)

if(HPX_WITH_CXX1Y)
if(HPX_WITH_CXX1Y OR HPX_WITH_CXX14)
# Check the availability of certain C++14 language features
hpx_check_for_cxx14_constexpr(
DEFINITIONS HPX_HAVE_CXX14_CONSTEXPR)
Expand All @@ -153,10 +153,11 @@ macro(hpx_perform_cxx_feature_tests)
endif()

# check for experimental facilities
if(HPX_WITH_CXX1Y)
# check for experimenta/optional only of in C++14 mode
hpx_check_for_cxx_experimental_std_optional(
DEFINITIONS HPX_HAVE_CXX1Y_EXPERIMENTAL_OPTIONAL)
if(HPX_WITH_CXX1Y OR HPX_WITH_CXX14)
# check for Library Fundamentals TS v2's experimental/optional only if in
# C++1y or C++14 mode.
hpx_check_for_libfun_std_experimental_optional(
DEFINITIONS HPX_HAVE_LIBFUN_STD_EXPERIMENTAL_OPTIONAL)
endif()
endmacro()

10 changes: 5 additions & 5 deletions hpx/parallel/datapar/execution_policy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ namespace hpx { namespace parallel { namespace execution { HPX_INLINE_NAMESPACE(
};

/// \cond NOINTERNAL
HPX_CONSTEXPR dataseq_policy() {}
HPX_CONSTEXPR dataseq_policy() : exec_{}, params_{} {}
/// \endcond

/// Create a new dataseq_task_policy.
Expand Down Expand Up @@ -451,7 +451,7 @@ namespace hpx { namespace parallel { namespace execution { HPX_INLINE_NAMESPACE(
};

/// Default sequential execution policy object.
static dataseq_policy HPX_CONSTEXPR_OR_CONST dataseq;
HPX_STATIC_CONSTEXPR dataseq_policy dataseq;

/// The class dataseq_policy is an execution policy type used
/// as a unique type to disambiguate parallel algorithm overloading and
Expand Down Expand Up @@ -764,7 +764,7 @@ namespace hpx { namespace parallel { namespace execution { HPX_INLINE_NAMESPACE(
};

/// \cond NOINTERNAL
HPX_CONSTEXPR datapar_policy() {}
HPX_CONSTEXPR datapar_policy() : exec_{}, params_{} {}
/// \endcond

/// Create a new datapar_policy referencing a chunk size.
Expand Down Expand Up @@ -1363,8 +1363,8 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
execution::datapar_policy_shim<Executor, Parameters>;

///////////////////////////////////////////////////////////////////////////
static dataseq_execution_policy HPX_CONSTEXPR_OR_CONST dataseq_execution;
static datapar_execution_policy HPX_CONSTEXPR_OR_CONST datapar_execution;
HPX_STATIC_CONSTEXPR dataseq_execution_policy dataseq_execution;
HPX_STATIC_CONSTEXPR datapar_execution_policy datapar_execution;
}}}
#endif

Expand Down
20 changes: 10 additions & 10 deletions hpx/parallel/execution_policy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ namespace hpx { namespace parallel { namespace execution
};

/// \cond NOINTERNAL
HPX_CONSTEXPR sequenced_policy() {}
HPX_CONSTEXPR sequenced_policy() : exec_{}, params_{} {}
/// \endcond

/// Create a new sequenced_task_policy.
Expand Down Expand Up @@ -459,7 +459,7 @@ namespace hpx { namespace parallel { namespace execution
};

/// Default sequential execution policy object.
static sequenced_policy HPX_CONSTEXPR_OR_CONST seq;
HPX_STATIC_CONSTEXPR sequenced_policy seq;

/// The class sequenced_policy is an execution policy type used
/// as a unique type to disambiguate parallel algorithm overloading and
Expand Down Expand Up @@ -916,7 +916,7 @@ namespace hpx { namespace parallel { namespace execution
};

/// \cond NOINTERNAL
HPX_CONSTEXPR parallel_policy() {}
HPX_CONSTEXPR parallel_policy() : exec_{}, params_{} {}
/// \endcond

/// Create a new parallel_policy referencing a chunk size.
Expand Down Expand Up @@ -1013,7 +1013,7 @@ namespace hpx { namespace parallel { namespace execution
};

/// Default parallel execution policy object.
static parallel_policy HPX_CONSTEXPR_OR_CONST par;
HPX_STATIC_CONSTEXPR parallel_policy par;

/// The class parallel_policy_shim is an execution policy type
/// used as a unique type to disambiguate parallel algorithm overloading
Expand Down Expand Up @@ -1176,7 +1176,7 @@ namespace hpx { namespace parallel { namespace execution
typedef parallel::parallel_execution_tag execution_category;

/// \cond NOINTERNAL
HPX_CONSTEXPR parallel_unsequenced_policy() {}
HPX_CONSTEXPR parallel_unsequenced_policy() : exec_{}, params_{} {}
/// \endcond

/// Create a new parallel_unsequenced_policy from itself
Expand Down Expand Up @@ -1218,7 +1218,7 @@ namespace hpx { namespace parallel { namespace execution
};

/// Default vector execution policy object.
static parallel_unsequenced_policy HPX_CONSTEXPR_OR_CONST par_unseq;
HPX_STATIC_CONSTEXPR parallel_unsequenced_policy par_unseq;

///////////////////////////////////////////////////////////////////////////
// Allow to detect execution policies which were created as a result
Expand Down Expand Up @@ -1437,11 +1437,11 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
using task_execution_policy_tag = parallel::execution::task_policy_tag;

///////////////////////////////////////////////////////////////////////////
static sequential_execution_policy HPX_CONSTEXPR_OR_CONST seq;
static parallel_execution_policy HPX_CONSTEXPR_OR_CONST par;
static parallel_vector_execution_policy HPX_CONSTEXPR_OR_CONST par_vec;
HPX_STATIC_CONSTEXPR sequential_execution_policy seq;
HPX_STATIC_CONSTEXPR parallel_execution_policy par;
HPX_STATIC_CONSTEXPR parallel_vector_execution_policy par_vec;

static task_execution_policy_tag HPX_CONSTEXPR_OR_CONST task;
HPX_STATIC_CONSTEXPR task_execution_policy_tag task;

#if defined(HPX_HAVE_GENERIC_EXECUTION_POLICY)
///////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions hpx/parallel/executors/executor_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <boost/range/irange.hpp>
#include <boost/throw_exception.hpp>

#if defined(HPX_HAVE_CXX1Y_EXPERIMENTAL_OPTIONAL)
#if defined(HPX_HAVE_LIBFUN_STD_EXPERIMENTAL_OPTIONAL)
#include <experimental/optional>
#else
#include <boost/optional.hpp>
Expand Down Expand Up @@ -177,7 +177,7 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v3)
auto && args =
hpx::util::forward_as_tuple(std::forward<Ts>(ts)...);

#if defined(HPX_HAVE_CXX1Y_EXPERIMENTAL_OPTIONAL)
#if defined(HPX_HAVE_LIBFUN_STD_EXPERIMENTAL_OPTIONAL)
std::experimental::optional<result_type> out;
auto && wrapper =
[&]() mutable
Expand Down
6 changes: 3 additions & 3 deletions hpx/runtime/threads/run_as_hpx_thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <type_traits>
#include <utility>

#if defined(HPX_HAVE_CXX1Y_EXPERIMENTAL_OPTIONAL)
#if defined(HPX_HAVE_LIBFUN_STD_EXPERIMENTAL_OPTIONAL)
#include <experimental/optional>
#else
#include <boost/optional.hpp>
Expand All @@ -47,7 +47,7 @@ namespace hpx { namespace threads
// Using the optional for storing the returned result value
// allows to support non-default-constructible and move-only
// types.
#if defined(HPX_HAVE_CXX1Y_EXPERIMENTAL_OPTIONAL)
#if defined(HPX_HAVE_LIBFUN_STD_EXPERIMENTAL_OPTIONAL)
std::experimental::optional<result_type> result;
#else
boost::optional<result_type> result;
Expand All @@ -62,7 +62,7 @@ namespace hpx { namespace threads
// Execute the given function, forward all parameters,
// store result.

#if defined(HPX_HAVE_CXX1Y_EXPERIMENTAL_OPTIONAL)
#if defined(HPX_HAVE_LIBFUN_STD_EXPERIMENTAL_OPTIONAL)
result.emplace(util::invoke_fused(f, std::move(args)));
#elif BOOST_VERSION < 105600
result = boost::in_place(
Expand Down

0 comments on commit 50b29e1

Please sign in to comment.