Skip to content

Commit

Permalink
Merge pull request #3931 from STEllAR-GROUP/collectives
Browse files Browse the repository at this point in the history
Adding all_to_all
  • Loading branch information
hkaiser committed Jun 28, 2019
2 parents f35e9ef + b8e4d91 commit eb3d35f
Show file tree
Hide file tree
Showing 41 changed files with 1,237 additions and 230 deletions.
48 changes: 26 additions & 22 deletions .circleci/config.yml
Expand Up @@ -804,35 +804,38 @@ jobs:
- store_artifacts:
path: tests.unit.util

tests.unit.libs:
tests.unit.modules:
<<: *defaults
steps:
- attach_workspace:
at: /hpx
- run:
name: Building Unit Tests
name: Building Module Unit Tests
command: |
ninja -j2 -k 0 tests.unit.cache
ninja -j2 -k 0 tests.unit.config
ninja -j2 -k 0 tests.unit.preprocessor
ninja -j2 -k 0 tests.unit.modules.cache
ninja -j2 -k 0 tests.unit.modules.collectives
ninja -j2 -k 0 tests.unit.modules.config
ninja -j2 -k 0 tests.unit.modules.preprocessor
- run:
name: Running Unit Tests
when: always
command: |
ulimit -c unlimited
ctest -T test --no-compress-output --output-on-failure -R tests.unit.cache
ctest -T test --no-compress-output --output-on-failure -R tests.unit.config
ctest -T test --no-compress-output --output-on-failure -R tests.unit.preprocessor
ctest -T test --no-compress-output --output-on-failure -R tests.unit.modules.cache
ctest -T test --no-compress-output --output-on-failure -R tests.unit.modules.collectives
ctest -T test --no-compress-output --output-on-failure -R tests.unit.modules.config
ctest -T test --no-compress-output --output-on-failure -R tests.unit.modules.preprocessor
- run:
<<: *convert_xml
- run:
<<: *move_core_dump
- run:
<<: *move_debug_log
- store_test_results:
path: tests.unit.libs
path: tests.unit.modules
- store_artifacts:
path: tests.unit.libs
path: tests.unit.modules

tests.regressions:
<<: *defaults
steps:
Expand Down Expand Up @@ -1050,23 +1053,24 @@ jobs:
- store_artifacts:
path: tests.headers.util

tests.headers.libs:
tests.headers.modules:
<<: *defaults
steps:
- attach_workspace:
at: /hpx
- run:
name: Building Header Tests
name: Building Modules Header Tests
command: |
ctest -j2 -T test --no-compress-output --output-on-failure -R tests.headers.cache
ctest -j2 -T test --no-compress-output --output-on-failure -R tests.headers.config
ctest -j2 -T test --no-compress-output --output-on-failure -R tests.headers.preprocessor
ctest -j2 -T test --no-compress-output --output-on-failure -R tests.headers.modules.cache
ctest -j2 -T test --no-compress-output --output-on-failure -R tests.headers.modules.collectives
ctest -j2 -T test --no-compress-output --output-on-failure -R tests.headers.modules.config
ctest -j2 -T test --no-compress-output --output-on-failure -R tests.headers.modules.preprocessor
- run:
<<: *convert_xml
- store_test_results:
path: tests.headers.libs
path: tests.headers.modules
- store_artifacts:
path: tests.headers.libs
path: tests.headers.modules

tests.performance:
<<: *defaults
Expand Down Expand Up @@ -1135,7 +1139,7 @@ jobs:
docker create -v /hpx --name sources stellargroup/hpx:dev /bin/true
docker cp ./source/examples/quickstart/hello_world_distributed.cpp sources:/hpx
docker run --volumes-from sources -w /hpx ${TARGET_IMAGE_NAME} \
hpxcxx --exe=hello_world_distributed_test_build \
hpxcxx --exe=hello_world_distributed_test_build \
hello_world_distributed.cpp -g -lhpx_iostreamsd
docker run --volumes-from sources -w /hpx ${TARGET_IMAGE_NAME} \
./hello_world_distributed_test_build --hpx:bind=none
Expand Down Expand Up @@ -1244,7 +1248,7 @@ workflows:
<<: *core_dependency
- tests.unit.util:
<<: *core_dependency
- tests.unit.libs:
- tests.unit.modules:
<<: *core_dependency
- tests.regressions:
<<: *core_dependency
Expand Down Expand Up @@ -1274,7 +1278,7 @@ workflows:
<<: *core_dependency
- tests.headers.util:
<<: *core_dependency
- tests.headers.libs:
- tests.headers.modules:
<<: *core_dependency
- examples:
<<: *core_dependency
Expand Down Expand Up @@ -1311,7 +1315,7 @@ workflows:
- tests.unit.topology
- tests.unit.traits
- tests.unit.util
- tests.unit.libs
- tests.unit.modules
- tests.headers.compat
- tests.headers.components
- tests.headers.compute
Expand All @@ -1324,7 +1328,7 @@ workflows:
- tests.headers.runtime
- tests.headers.traits
- tests.headers.util
- tests.headers.libs
- tests.headers.modules
- tests.performance
- tests.regressions
- examples
Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Expand Up @@ -1828,7 +1828,7 @@ if (HPX_WITH_TESTS)
add_hpx_pseudo_target(tests.headers)
add_hpx_pseudo_dependencies(tests tests.headers)
endif()
if (HPX_WITH_TESTS_EXAMPLES)
if (HPX_WITH_EXAMPLES AND HPX_WITH_TESTS_EXAMPLES)
add_hpx_pseudo_target(tests.examples)
add_hpx_pseudo_dependencies(tests tests.examples)
endif()
Expand All @@ -1837,6 +1837,10 @@ if (HPX_WITH_TESTS)
include(CTest)
endif()

if(HPX_WITH_EXAMPLES)
add_hpx_pseudo_target(examples)
endif()

################################################################################
# Debug library postfix
################################################################################
Expand Down Expand Up @@ -1899,7 +1903,6 @@ if(HPX_WITH_TESTS)
endif()

if(HPX_WITH_EXAMPLES)
add_hpx_pseudo_target(examples)
include_directories(examples)
add_subdirectory(examples)
endif()
Expand Down
31 changes: 17 additions & 14 deletions cmake/HPX_AddCompileTest.cmake
Expand Up @@ -50,11 +50,14 @@ function(add_hpx_headers_compile_test category name)
add_hpx_compile_test("tests.headers.${category}" ${name} ${ARGN})
endfunction()

function(add_hpx_lib_header_tests lib)
file(GLOB_RECURSE headers ${DO_CONFIGURE_DEPENDS} "${PROJECT_SOURCE_DIR}/include/hpx/*hpp")
function(add_hpx_module_header_tests lib)
file(GLOB_RECURSE headers ${DO_CONFIGURE_DEPENDS}
"${PROJECT_SOURCE_DIR}/include/hpx/*hpp")

set(all_headers)
add_custom_target(tests.headers.${lib})
add_dependencies(tests.headers tests.headers.${lib})
add_custom_target(tests.headers.modules.${lib})
add_dependencies(tests.headers.modules tests.headers.modules.${lib})

foreach(header ${headers})

# skip all headers in directories containing 'detail'
Expand All @@ -80,14 +83,14 @@ function(add_hpx_lib_header_tests lib)

set(all_headers ${all_headers} "#include <hpx/${relpath}>\n")

add_library(tests.headers.${lib}.${test_name} ${CMAKE_CURRENT_BINARY_DIR}/${full_test_file})
target_link_libraries(tests.headers.${lib}.${test_name} hpx_${lib})
add_dependencies(tests.headers.${lib} tests.headers.${lib}.${test_name})
add_library(tests.headers.modules.${lib}.${test_name} ${CMAKE_CURRENT_BINARY_DIR}/${full_test_file})
target_link_libraries(tests.headers.modules.${lib}.${test_name} hpx_${lib})
add_dependencies(tests.headers.modules.${lib} tests.headers.modules.${lib}.${test_name})

add_test(NAME "tests.headers.${lib}.${test_name}"
add_test(NAME "tests.headers.modules.${lib}.${test_name}"
COMMAND ${CMAKE_COMMAND}
--build ${CMAKE_BINARY_DIR}
--target tests.headers.${lib}.${test_name}
--target tests.headers.modules.${lib}.${test_name}
--config $<CONFIGURATION>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif()
Expand All @@ -101,14 +104,14 @@ function(add_hpx_lib_header_tests lib)
"int main(int argc, char** argv) { return 0; }\n"
"#endif\n")

add_library(tests.headers.${lib}.${test_name} "${CMAKE_CURRENT_BINARY_DIR}/${test_name}.cpp")
target_link_libraries(tests.headers.${lib}.${test_name} hpx_${lib})
add_dependencies(tests.headers.${lib} tests.headers.${lib}.${test_name})
add_library(tests.headers.modules.${lib}.${test_name} "${CMAKE_CURRENT_BINARY_DIR}/${test_name}.cpp")
target_link_libraries(tests.headers.modules.${lib}.${test_name} hpx_${lib})
add_dependencies(tests.headers.modules.${lib} tests.headers.modules.${lib}.${test_name})

add_test(NAME "tests.headers.${lib}.${test_name}"
add_test(NAME "tests.headers.modules.${lib}.${test_name}"
COMMAND ${CMAKE_COMMAND}
--build ${CMAKE_BINARY_DIR}
--target tests.headers.${lib}.${test_name}
--target tests.headers.modules.${lib}.${test_name}
--config $<CONFIGURATION>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endfunction()
84 changes: 72 additions & 12 deletions cmake/HPX_AddModule.cmake
Expand Up @@ -6,7 +6,7 @@
function(add_hpx_module name)
# Retrieve arguments
set(options DEPRECATION_WARNINGS)
set(one_value_args COMPATIBILITY_HEADERS GLOBAL_HEADER_GEN INSTALL_BINARIES)
set(one_value_args COMPATIBILITY_HEADERS GLOBAL_HEADER_GEN FORCE_LINKING_GEN INSTALL_BINARIES)
set(multi_value_args SOURCES HEADERS COMPAT_HEADERS DEPENDENCIES CMAKE_SUBDIRS)
cmake_parse_arguments(${name} "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})

Expand All @@ -17,6 +17,7 @@ function(add_hpx_module name)

hpx_info(" ${name}")

# Global headers should be always generated except if explicitly disabled
if ("${${name}_GLOBAL_HEADER_GEN}" STREQUAL "")
set(${name}_GLOBAL_HEADER_GEN ON)
endif()
Expand Down Expand Up @@ -76,16 +77,21 @@ function(add_hpx_module name)
prepend(compat_headers ${COMPAT_HEADER_ROOT} ${${name}_COMPAT_HEADERS})
endif()

set(copyright
"// Copyright (c) 2019 The STE||AR GROUP\n"
"//\n"
"// Distributed under the Boost Software License, Version 1.0. (See accompanying\n"
"// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n"
"\n"
)

# This header generation is disabled for config module specific generated
# headers are included
if (${name}_GLOBAL_HEADER_GEN)
set(global_header "${CMAKE_BINARY_DIR}/hpx/${name}.hpp")
# Add a global include file that include all module headers
FILE(WRITE ${global_header}
"// Copyright (c) 2019 The STE||AR GROUP\n"
"//\n"
"// Distributed under the Boost Software License, Version 1.0. (See accompanying\n"
"// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\n"
${copyright}
"#ifndef HPX_${name_upper}_HPP\n"
"#define HPX_${name_upper}_HPP\n\n"
)
Expand All @@ -95,16 +101,49 @@ function(add_hpx_module name)
)
endforeach(header_file)
FILE(APPEND ${global_header}
"\n#endif"
"\n#endif\n"
)
endif()

if(${name}_FORCE_LINKING_GEN)
# Add a header to force linking of modules on Windows
set(force_linking_header "${CMAKE_BINARY_DIR}/hpx/${name}/force_linking.hpp")
FILE(WRITE ${force_linking_header}
${copyright}
"#if !defined(HPX_${name_upper}_FORCE_LINKING_HPP)\n"
"#define HPX_${name_upper}_FORCE_LINKING_HPP\n"
"\n"
"namespace hpx { namespace ${name}\n"
"{\n"
" void force_linking();\n"
"}}\n"
"\n"
"#endif\n"
)

# Add a source file implementing the above function
set(force_linking_source "${CMAKE_BINARY_DIR}/libs/${name}/force_linking.cpp")
FILE(WRITE ${force_linking_source}
${copyright}
"#include <hpx/${name}/force_linking.hpp>\n"
"\n"
"namespace hpx { namespace ${name}\n"
"{\n"
" void force_linking() {}\n"
"}}\n"
"\n"
)
endif()

foreach(header_file ${headers})
hpx_debug(${header_file})
endforeach(header_file)

add_library(hpx_${name} STATIC ${sources} ${headers} ${global_header} ${compat_headers})

add_library(hpx_${name} STATIC
${sources} ${force_linking_source}
${headers} ${global_header} ${compat_headers}
${force_linking_header})

target_link_libraries(hpx_${name} ${${name}_DEPENDENCIES})
target_include_directories(hpx_${name} PUBLIC
$<BUILD_INTERFACE:${HEADER_ROOT}>
Expand Down Expand Up @@ -139,8 +178,29 @@ function(add_hpx_module name)
TARGETS ${compat_headers})
endif()

if (${name}_GLOBAL_HEADER_GEN)
add_hpx_source_group(
NAME hpx_{name}
ROOT ${CMAKE_BINARY_DIR}/hpx
CLASS "Generated Files"
TARGETS ${global_header})
endif()
if (${name}_FORCE_LINKING_GEN)
add_hpx_source_group(
NAME hpx_{name}
ROOT ${CMAKE_BINARY_DIR}/hpx
CLASS "Generated Files"
TARGETS ${force_linking_header})
add_hpx_source_group(
NAME hpx_{name}
ROOT ${CMAKE_BINARY_DIR}/libs
CLASS "Generated Files"
TARGETS ${force_linking_source})
endif()

set_target_properties(hpx_${name} PROPERTIES
FOLDER "Core/Modules")
FOLDER "Core/Modules"
POSITION_INDEPENDENT_CODE ON)

if(${name}_INSTALL_BINARIES)
install(TARGETS hpx_${name} EXPORT HPXTargets
Expand All @@ -149,8 +209,8 @@ function(add_hpx_module name)
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT ${name}
)
hpx_export_targets(hpx_${name})
endif()
hpx_export_targets(hpx_${name})

install(
DIRECTORY include/hpx
Expand All @@ -172,7 +232,7 @@ function(add_hpx_module name)
COMPONENT ${name}
)
endif()

write_config_defines_file(
NAMESPACE ${name_upper}
FILENAME "${CMAKE_BINARY_DIR}/hpx/${name}/config/defines.hpp")
Expand All @@ -184,5 +244,5 @@ function(add_hpx_module name)
foreach(dir ${${name}_CMAKE_SUBDIRS})
add_subdirectory(${dir})
endforeach(dir)

endfunction(add_hpx_module)
7 changes: 4 additions & 3 deletions hpx/lcos/gather.hpp
Expand Up @@ -191,9 +191,10 @@ namespace hpx { namespace lcos
}}
#else

#include <hpx/config.hpp>

#if !defined(HPX_COMPUTE_DEVICE_CODE)

#include <hpx/config.hpp>
#include <hpx/dataflow.hpp>
#include <hpx/lcos/future.hpp>
#include <hpx/lcos/local/and_gate.hpp>
Expand Down Expand Up @@ -267,7 +268,7 @@ namespace hpx { namespace lcos
{
std::unique_lock<mutex_type> l(mtx_);

hpx::future<std::vector<T> > f = gate_.get_future().then(
hpx::future<std::vector<T> > f = gate_.get_future(l).then(
util::bind_front(&gather_server::on_ready, this));

set_result_locked(which, std::move(t), l);
Expand Down Expand Up @@ -324,7 +325,7 @@ namespace hpx { namespace lcos
{
HPX_THROW_EXCEPTION(bad_parameter,
"hpx::lcos::detail::register_gather_name",
"the given base name for gather opration was "
"the given base name for the gather operation was "
"already registered: " + basename);
}
return target;
Expand Down

0 comments on commit eb3d35f

Please sign in to comment.