Skip to content

Commit

Permalink
Merge branch 'master' into simple_base_lco
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Aug 8, 2017
2 parents 899f60d + 8719307 commit 6e5fba6
Show file tree
Hide file tree
Showing 421 changed files with 14,366 additions and 11,749 deletions.
74 changes: 47 additions & 27 deletions CMakeLists.txt
Expand Up @@ -10,11 +10,11 @@
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

# We require at least CMake V3.0.2
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
# We require at least CMake V3.3.2
cmake_minimum_required(VERSION 3.3.2 FATAL_ERROR)

# explicitly set certain policies
cmake_policy(VERSION 3.0.2)
cmake_policy(VERSION 3.3.2)
macro(hpx_set_cmake_policy policy value)
if(POLICY ${policy})
cmake_policy(SET ${policy} ${value})
Expand Down Expand Up @@ -147,6 +147,21 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
# set(DEFAULT_MALLOC "jemalloc")
endif()

if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(HPX_WITH_THREAD_STACKOVERFLOW_DETECTION_DEFAULT OFF)
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
if("${CMAKE_BUILD_TYPE_UC}" STREQUAL "DEBUG")
set(HPX_WITH_THREAD_STACKOVERFLOW_DETECTION_DEFAULT ON)
endif()
hpx_option(HPX_WITH_THREAD_STACKOVERFLOW_DETECTION
BOOL
"Enable stackoverflow detection for HPX threads/coroutines. (default: OFF, debug: ON)"
${HPX_WITH_THREAD_STACKOVERFLOW_DETECTION_DEFAULT} ADVANCED)
if(HPX_WITH_THREAD_STACKOVERFLOW_DETECTION)
hpx_add_config_define(HPX_HAVE_THREAD_STACKOVERFLOW_DETECTION)
endif()
endif()

hpx_option(HPX_WITH_MALLOC
STRING
"Define which allocator should be linked in. Options are: system, tcmalloc, jemalloc, tbbmalloc, and custom (default is: tcmalloc)"
Expand Down Expand Up @@ -528,6 +543,17 @@ if(HPX_WITH_SCHEDULER_LOCAL_STORAGE)
hpx_add_config_define(HPX_HAVE_SCHEDULER_LOCAL_STORAGE)
endif()

# Count number of terminated threads before forcefully cleaning up all of
# them. Note: terminated threads are cleaned up either when this number is
# reached for a particular thread queue or if the HPX_BUSY_LOOP_COUNT_MAX is
# reached, which will clean up the terminated threads for _all_ thread queues.
hpx_option(HPX_SCHEDULER_MAX_TERMINATED_THREADS STRING
"Maximum number of terminated threads collected before those are cleaned up (default: 100)"
"100" CATEGORY "Thread Manager" ADVANCED)

hpx_add_config_define(HPX_SCHEDULER_MAX_TERMINATED_THREADS
${HPX_SCHEDULER_MAX_TERMINATED_THREADS})

hpx_option(HPX_WITH_SWAP_CONTEXT_EMULATION BOOL
"Emulate SwapContext API for coroutines (default: OFF)"
OFF CATEGORY "Thread Manager" ADVANCED)
Expand Down Expand Up @@ -672,7 +698,7 @@ endif()
## External libraries/frameworks used by sme of the examples and benchmarks
hpx_option(HPX_WITH_EXAMPLES_OPENMP BOOL
"Enable examples requiring OpenMP support (default: OFF)." OFF
CATEGORY "Tools" ADVANCED)
CATEGORY "Build Targets" ADVANCED)
if(HPX_WITH_EXAMPLES_OPENMP)
find_package(OpenMP)
if(NOT OPENMP_FOUND)
Expand All @@ -681,7 +707,7 @@ if(HPX_WITH_EXAMPLES_OPENMP)
endif()
hpx_option(HPX_WITH_EXAMPLES_TBB BOOL
"Enable examples requiring TBB support (default: OFF)." OFF
CATEGORY "Tools" ADVANCED)
CATEGORY "Build Targets" ADVANCED)
if(HPX_WITH_EXAMPLES_TBB)
find_package(TBB)
if(NOT TBB_FOUND)
Expand All @@ -690,7 +716,7 @@ if(HPX_WITH_EXAMPLES_TBB)
endif()
hpx_option(HPX_WITH_EXAMPLES_QTHREADS BOOL
"Enable examples requiring QThreads support (default: OFF)." OFF
CATEGORY "Tools" ADVANCED)
CATEGORY "Build Targets" ADVANCED)
if(HPX_WITH_EXAMPLES_QTHREADS)
find_package(QThreads)
if(NOT QTHREADS_FOUND)
Expand All @@ -699,7 +725,7 @@ if(HPX_WITH_EXAMPLES_QTHREADS)
endif()
hpx_option(HPX_WITH_EXAMPLES_HDF5 BOOL
"Enable examples requiring HDF5 support (default: OFF)." OFF
CATEGORY "Tools" ADVANCED)
CATEGORY "Build Targets" ADVANCED)
if(HPX_WITH_EXAMPLES_HDF5)
find_package(HDF5 COMPONENTS CXX)
if(NOT HDF5_FOUND)
Expand All @@ -711,7 +737,7 @@ endif()
if(NOT "${HPX_PLATFORM_UC}" STREQUAL "BLUEGENEQ")
hpx_option(HPX_WITH_EXAMPLES_QT4 BOOL
"Enable examples requiring Qt4 support (default: OFF)." OFF
CATEGORY "Tools" ADVANCED)
CATEGORY "Build Targets" ADVANCED)
if(HPX_WITH_EXAMPLES_QT4)
find_package(Qt4)
if(NOT QT4_FOUND)
Expand Down Expand Up @@ -933,6 +959,14 @@ if(HPX_WITH_ALGORITHM_INPUT_ITERATOR_SUPPORT)
hpx_add_config_define(HPX_HAVE_ALGORITHM_INPUT_ITERATOR_SUPPORT)
endif()

# HPX_WITH_UNWRAPPED_COMPATIBILITY: introduced in V1.1.0
hpx_option(HPX_WITH_UNWRAPPED_COMPATIBILITY BOOL
"Enable the deprecated unwrapped function (default: ON)"
ON ADVANCED)
if(HPX_WITH_UNWRAPPED_COMPATIBILITY)
hpx_add_config_define(HPX_HAVE_UNWRAPPED_COMPATIBILITY)
endif()

################################################################################
# Set basic search paths for HPX
################################################################################
Expand Down Expand Up @@ -1518,7 +1552,7 @@ endif()
if(HPX_WITH_GENERIC_CONTEXT_COROUTINES)
# Check if we can use generic coroutine contexts without any problems
if(NOT Boost_CONTEXT_FOUND)
hpx_error("The usage of Boost.Context was selected but Boost.Context was not found (Version 1.51 or higher is required).")
hpx_error("The usage of Boost.Context was selected but Boost.Context was not found.")
endif()
if("${HPX_PLATFORM_UC}" STREQUAL "BLUEGENEQ")
if(Boost_VERSION LESS 105600)
Expand Down Expand Up @@ -1829,24 +1863,6 @@ if("${HPX_PLATFORM_UC}" STREQUAL "XEONPHI")
PATTERN ".git" EXCLUDE)
endif()

if(Boost_VERSION LESS 105300)
# Install Boost.Atomic library for older Boost versions only
install(
DIRECTORY external/atomic/boost
DESTINATION include/hpx/external
COMPONENT core
FILES_MATCHING PATTERN "*.hpp"
PATTERN ".git" EXCLUDE)

# Install Boost.Lockfree library for older Boost versions only
install(
DIRECTORY external/lockfree/boost
DESTINATION include/hpx/external
COMPONENT core
FILES_MATCHING PATTERN "*.hpp"
PATTERN ".git" EXCLUDE)
endif()

install(
FILES "${PROJECT_SOURCE_DIR}/LICENSE_1_0.txt"
DESTINATION share/hpx-${HPX_VERSION}
Expand Down Expand Up @@ -1900,6 +1916,10 @@ if(HPX_WITH_VIM_YCM)
hpx_info("VIM YouCompleteMe: run 'make configure_ycm' to copy config file to source directory and enable support in YCM. To enable automatic loading of configure file, add to your .vimrc option: \"let g:ycm_extra_conf_globlist = ['${CMAKE_SOURCE_DIR}/*']\"")
endif()

################################################################################
# print overall configuration summary
include(HPX_PrintSummary)

################################################################################
# External build system support (FindHPX.cmake and pkg-config).
################################################################################
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Expand Up @@ -25,7 +25,7 @@ install:
- cmd: 7z x "C:\projects\vcpkg-export-hpx-dependencies.7z" -y -oC:\projects\vcpkg >NUL

before_build:
- cmd: cmake -H. -Bbuild -A%PLATFORM% -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DCMAKE_TOOLCHAIN_FILE=C:/projects/vcpkg/scripts/buildsystems/vcpkg.cmake -DHPX_WITH_GIT_COMMIT=%APPVEYOR_REPO_COMMIT% -DHPX_WITH_PSEUDO_DEPENDENCIES=On -DHPX_WITH_EXAMPLES=On -DHPX_WITH_TESTS=On -DHPX_WITH_RUNTIME=Off
- cmd: cmake -H. -Bbuild -A%PLATFORM% -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DCMAKE_TOOLCHAIN_FILE=C:/projects/vcpkg/scripts/buildsystems/vcpkg.cmake -DHPX_WITH_GIT_COMMIT=%APPVEYOR_REPO_COMMIT% -DHPX_WITH_PSEUDO_DEPENDENCIES=On -DHPX_WITH_EXAMPLES=On -DHPX_WITH_EXAMPLES_HDF5=On -DHPX_WITH_TESTS=Off -DHPX_WITH_RUNTIME=Off

build_script:
- cmd: cmake --build build --config %CONFIGURATION% --target core -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /verbosity:minimal /maxcpucount:2 /nologo
Expand Down
7 changes: 7 additions & 0 deletions cmake/HPX_AddConfigTest.cmake
Expand Up @@ -560,6 +560,13 @@ macro(hpx_check_for_cxx14_variable_templates)
CMAKECXXFEATURE cxx_variable_templates)
endmacro()

###############################################################################
macro(hpx_check_for_cxx14_deprecated_attribute)
add_hpx_config_test(HPX_WITH_CXX14_DEPRECATED_ATTRIBUTE
SOURCE cmake/tests/cxx14_deprecated_attribute.cpp
FILE ${ARGN})
endmacro()

###############################################################################
macro(hpx_check_for_libfun_std_experimental_optional)
add_hpx_config_test(HPX_WITH_LIBFUN_EXPERIMENTAL_OPTIONAL
Expand Down
4 changes: 2 additions & 2 deletions cmake/HPX_GeneratePackage.cmake
Expand Up @@ -56,11 +56,11 @@ endforeach()
if(HPX_WITH_STATIC_LINKING)
set(HPX_PKG_LIBRARIES_BAZEL "${HPX_CONF_PREFIX}/lib/libhpx.a ${HPX_PKG_LIBRARIES}")
set(HPX_PKG_DEBUG_LIBRARIES_BAZEL "${HPX_CONF_PREFIX}/lib/libhpxd.a ${HPX_PKG_DEBUG_LIBRARIES}")
set(HPX_CONF_LIBRARIES "hpx;${HPX_LIBRARIES}")
set(HPX_CONF_LIBRARIES "general;hpx;${HPX_LIBRARIES}")
set(HPX_PKG_LIBRARIES "\${libdir}/libhpx.a ${HPX_PKG_LIBRARIES}")
set(HPX_PKG_DEBUG_LIBRARIES "\${libdir}/libhpxd.a ${HPX_PKG_DEBUG_LIBRARIES}")
else()
set(HPX_CONF_LIBRARIES "hpx;hpx_init;${HPX_LIBRARIES}")
set(HPX_CONF_LIBRARIES "general;hpx;general;hpx_init;${HPX_LIBRARIES}")
if(APPLE)
set(HPX_PKG_LIBRARIES_BAZEL "${HPX_CONF_PREFIX}/lib/libhpx.dylib ${HPX_CONF_PREFIX}/lib/libhpx_init.a ${HPX_PKG_LIBRARIES}")
set(HPX_PKG_DEBUG_LIBRARIES_BAZEL "${HPX_CONF_PREFIX}/lib/libhpxd.dylib ${HPX_CONF_PREFIX}/lib/libhpx_initd.a ${HPX_PKG_DEBUG_LIBRARIES}")
Expand Down
3 changes: 1 addition & 2 deletions cmake/HPX_Option.cmake
Expand Up @@ -14,7 +14,6 @@ set(HPX_OPTION_CATEGORIES
"Parcelport"
"Profiling"
"Debugging"
"Tools"
)

function(hpx_option option type description default)
Expand All @@ -32,7 +31,7 @@ function(hpx_option option type description default)
set_property(CACHE "${option}" PROPERTY HELPSTRING "${description}")
set_property(CACHE "${option}" PROPERTY TYPE "${type}")
endif()

if(HPX_OPTION_STRINGS)
if("${type}" STREQUAL "STRING")
set_property(CACHE "${option}" PROPERTY STRINGS "${HPX_OPTION_STRINGS}")
Expand Down
3 changes: 3 additions & 0 deletions cmake/HPX_PerformCxxFeatureTests.cmake
Expand Up @@ -160,6 +160,9 @@ macro(hpx_perform_cxx_feature_tests)
hpx_check_for_cxx14_variable_templates(
DEFINITIONS HPX_HAVE_CXX14_VARIABLE_TEMPLATES)

hpx_check_for_cxx14_deprecated_attribute(
DEFINITIONS HPX_HAVE_CXX14_DEPRECATED_ATTRIBUTE)

# check for experimental facilities

# check for Library Fundamentals TS v2's experimental/optional
Expand Down
55 changes: 55 additions & 0 deletions cmake/HPX_PrintSummary.cmake
@@ -0,0 +1,55 @@
# Copyright (c) 2017 Hartmut Kaiser
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

get_property(DEFINITIONS_VARS GLOBAL PROPERTY HPX_CONFIG_DEFINITIONS)
if(DEFINED DEFINITIONS_VARS)
list(SORT DEFINITIONS_VARS)
list(REMOVE_DUPLICATES DEFINITIONS_VARS)
endif()

set(hpx_config_information)

message("")
hpx_info("Configuration summary:")
get_cmake_property(_variableNames CACHE_VARIABLES)
foreach (_variableName ${_variableNames})
if(${_variableName}Category)

# handle only opetions which start with HPX_WITH_
string(FIND ${_variableName} "HPX_WITH_" __pos)
if(NOT ${__pos} EQUAL -1)
get_property(_value CACHE "${_variableName}" PROPERTY VALUE)
hpx_info(" ${_variableName}=${_value}")

string(REPLACE "_WITH_" "_HAVE_" __variableName ${_variableName})
list(FIND DEFINITIONS_VARS ${__variableName} __pos)
if(NOT ${__pos} EQUAL -1)
set(hpx_config_information
"${hpx_config_information}"
"\n \"${_variableName}=${_value}\",")
elseif(NOT ${_variableName}Category STREQUAL "Generic" AND NOT ${_variableName}Category STREQUAL "Build Targets")
get_property(_type CACHE "${_variableName}" PROPERTY TYPE)
if(_type STREQUAL "BOOL")
set(hpx_config_information
"${hpx_config_information}"
"\n \"${_variableName}=OFF\",")
endif()
endif()

endif()
endif()
endforeach()

if(hpx_config_information)
string(REPLACE ";" "" hpx_config_information ${hpx_config_information})
endif()
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/templates/config_defines_strings.hpp.in"
"${CMAKE_BINARY_DIR}/hpx/config/config_strings.hpp"
@ONLY)
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/templates/config_defines_strings.hpp.in"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hpx/config/config_strings.hpp"
@ONLY)
28 changes: 5 additions & 23 deletions cmake/HPX_SetupBoost.cmake
Expand Up @@ -12,6 +12,7 @@ endif()
# Add additional version to recognize
set(Boost_ADDITIONAL_VERSIONS
${Boost_ADDITIONAL_VERSIONS}
"1.66.0" "1.66"
"1.65.0" "1.65"
"1.64.0" "1.64"
"1.63.0" "1.63"
Expand Down Expand Up @@ -62,13 +63,13 @@ endif()

set(__boost_libraries
${__boost_libraries}
date_time
atomic
filesystem
program_options
regex
system)

find_package(Boost 1.51 REQUIRED COMPONENTS ${__boost_libraries})
find_package(Boost 1.55 REQUIRED COMPONENTS ${__boost_libraries})

if(NOT Boost_FOUND)
hpx_error("Could not find Boost. Please set BOOST_ROOT to point to your Boost installation.")
Expand All @@ -86,7 +87,7 @@ endif()
set(Boost_TMP_LIBRARIES ${Boost_TMP_LIBRARIES} ${Boost_LIBRARIES})

if(HPX_WITH_COMPRESSION_BZIP2 OR HPX_WITH_COMPRESSION_ZLIB)
find_package(Boost 1.51 QUIET COMPONENTS iostreams)
find_package(Boost 1.55 QUIET COMPONENTS iostreams)
if(Boost_IOSTREAMS_FOUND)
hpx_info(" iostreams")
else()
Expand All @@ -96,26 +97,12 @@ if(HPX_WITH_COMPRESSION_BZIP2 OR HPX_WITH_COMPRESSION_ZLIB)
endif()

# attempt to load Boost.Random (if available), it's needed for one example only
find_package(Boost 1.51 QUIET COMPONENTS random)
find_package(Boost 1.55 QUIET COMPONENTS random)
if(Boost_RANDOM_FOUND)
hpx_info(" random")
set(Boost_TMP_LIBRARIES ${Boost_TMP_LIBRARIES} ${Boost_LIBRARIES})
endif()

# If the found Boost installation is < 1.53, we need to include our packaged
# atomic library
if(Boost_VERSION LESS 105300)
set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} "${PROJECT_SOURCE_DIR}/external/atomic")
set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} "${PROJECT_SOURCE_DIR}/external/lockfree")
else()
find_package(Boost 1.53 QUIET REQUIRED COMPONENTS atomic)
if(Boost_ATOMIC_FOUND)
hpx_info(" atomic")
endif()

set(Boost_TMP_LIBRARIES ${Boost_TMP_LIBRARIES} ${Boost_LIBRARIES})
endif()

set(Boost_LIBRARIES ${Boost_TMP_LIBRARIES})

# If we compile natively for the MIC, we need some workarounds for certain
Expand All @@ -141,11 +128,6 @@ hpx_add_config_define(HPX_HAVE_LOG_NO_TSS)
hpx_add_config_define(HPX_HAVE_LOG_NO_TS)
hpx_add_config_cond_define(BOOST_BIGINT_HAS_NATIVE_INT64)

# Disable usage of std::atomics in lockfree
if(Boost_VERSION LESS 105300)
hpx_add_config_cond_define(BOOST_NO_0X_HDR_ATOMIC)
endif()

include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
if((NOT MSVC) OR HPX_WITH_BOOST_ALL_DYNAMIC_LINK OR HPX_WITH_VCPKG)
Expand Down
10 changes: 7 additions & 3 deletions cmake/HPX_SetupTarget.cmake
Expand Up @@ -12,7 +12,7 @@ endif()

function(hpx_setup_target target)
# retrieve arguments
set(options EXPORT NOHPX_INIT INSTALL NOLIBS PLUGIN)
set(options EXPORT NOHPX_INIT INSTALL NOLIBS PLUGIN NONAMEPREFIX)
set(one_value_args TYPE FOLDER NAME SOVERSION VERSION HPX_PREFIX)
set(multi_value_args DEPENDENCIES COMPONENT_DEPENDENCIES COMPILE_FLAGS LINK_FLAGS INSTALL_FLAGS)
cmake_parse_arguments(target "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})
Expand Down Expand Up @@ -132,7 +132,9 @@ function(hpx_setup_target target)
VERSION ${HPX_LIBRARY_VERSION}
SOVERSION ${HPX_SOVERSION})
endif()
hpx_set_lib_name(${target} ${name})
if(NOT target_NONAMEPREFIX)
hpx_set_lib_name(${target} ${name})
endif()
set_target_properties(${target}
PROPERTIES
# create *nix style library versions + symbolic links
Expand All @@ -159,7 +161,9 @@ function(hpx_setup_target target)
VERSION ${HPX_LIBRARY_VERSION}
SOVERSION ${HPX_SOVERSION})
endif()
hpx_set_lib_name(${target} ${name})
if(NOT target_NONAMEPREFIX)
hpx_set_lib_name(${target} ${name})
endif()
set_target_properties(${target}
PROPERTIES
# create *nix style library versions + symbolic links
Expand Down
4 changes: 3 additions & 1 deletion cmake/templates/HPXConfig.cmake.in
Expand Up @@ -41,7 +41,9 @@ set(HPX_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@" CACHE STRING "Fortran compil
set(HPX_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@" CACHE STRING "Fortran compiler id for HPX")
set(HPX_Fortran_COMPILER_VERSION "@CMAKE_Fortran_COMPILER_VERSION@" CACHE STRING "Fortran compiler version for HPX")

set(HPX_BOOST_ROOT @BOOST_ROOT@)
set(HPX_BOOST_ROOT "@BOOST_ROOT@")
set(HPX_BOOST_LIBRARIES "@Boost_LIBRARIES@")

set(HPX_WITH_PSEUDO_DEPENDENCIES @HPX_WITH_PSEUDO_DEPENDENCIES@)
set(HPX_WITH_STATIC_LINKING @HPX_WITH_STATIC_LINKING@)
set(HPX_WITH_MALLOC_DEFAULT @HPX_WITH_MALLOC@)
Expand Down

0 comments on commit 6e5fba6

Please sign in to comment.