Skip to content

Commit

Permalink
Fixing cyclic dependencies
Browse files Browse the repository at this point in the history
- Fixing cyclic dependencies related to parcelport symbols
- Fixing cyclic dependencies in naming and agas modules
- Adding linux static github builder

- flyby: fixing compression filter linking order
  • Loading branch information
hkaiser committed Aug 17, 2023
1 parent e7c31a4 commit 4f676fe
Show file tree
Hide file tree
Showing 33 changed files with 430 additions and 144 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/linux_release_static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright (c) 2020 ETH Zurich
# Copyright (c) 2023 The STE||AR Group
#
# SPDX-License-Identifier: BSL-1.0
# 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)

name: Linux CI (Release, Static)

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
container: stellargroup/build_env:16

steps:
- uses: actions/checkout@v3
- name: Configure
shell: bash
run: |
cmake \
. \
-Bbuild \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DHPX_WITH_STATIC_LINKING=ON \
-DHPX_WITH_MALLOC=system \
-DHPX_WITH_FETCH_ASIO=ON \
-DHPX_WITH_EXAMPLES=ON \
-DHPX_WITH_TESTS=ON \
-DHPX_WITH_TESTS_MAX_THREADS_PER_LOCALITY=2 \
-DHPX_WITH_CHECK_MODULE_DEPENDENCIES=On
- name: Build
shell: bash
run: |
cmake --build build --target all
cmake --build build --target examples
- name: Test
shell: bash
run: |
cd build
ctest \
--output-on-failure \
--tests-regex tests.examples \
--exclude-regex tests.examples.transpose.transpose_block_numa \
--exclude-regex tests.examples.quickstart.distributed.tcp.custom_serialization
5 changes: 3 additions & 2 deletions cmake/FindHwloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if(NOT TARGET Hwloc::hwloc)

find_library(
HWLOC_LIBRARY
NAMES hwloc libhwloc
NAMES libhwloc.so hwloc
HINTS ${HWLOC_ROOT}
ENV
HWLOC_ROOT
Expand Down Expand Up @@ -70,7 +70,8 @@ if(NOT TARGET Hwloc::hwloc)

add_library(Hwloc::hwloc INTERFACE IMPORTED)
target_include_directories(Hwloc::hwloc SYSTEM INTERFACE ${HWLOC_INCLUDE_DIR})
target_link_libraries(Hwloc::hwloc INTERFACE ${HWLOC_LIBRARIES})

target_link_libraries(Hwloc::hwloc INTERFACE ${HWLOC_LIBRARIES})
mark_as_advanced(HWLOC_ROOT HWLOC_LIBRARY HWLOC_INCLUDE_DIR)

endif()
11 changes: 5 additions & 6 deletions cmake/HPX_AddModule.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,9 @@ function(add_hpx_module libname modulename)
endforeach()
else()
foreach(file_to_generate ${${modulename}_GENERATED_HEADERS})
if(EXISTS ${file_to_generate})
hpx_warn("Removing zombie generated header: ${file_to_generate}")
file(REMOVE ${file_to_generate})
endif()
set(generated_headers ${generated_headers}
${generated_file_base}/${file_to_generate}
)
endforeach()
endif()
endif()
Expand Down Expand Up @@ -284,8 +283,8 @@ function(add_hpx_module libname modulename)
list(FIND _hpx_${libname}_modules ${dep} dep_index)
if(${dep_index} EQUAL -1)
hpx_error(
"The module ${dep} should not be be listed in MODULE_DEPENDENCIES "
"for module hpx_${modulename}"
"The module hpx_${dep} should not be be listed in MODULE_DEPENDENCIES "
"for '${libname}' module hpx_${modulename}"
)
endif()
endif()
Expand Down
26 changes: 3 additions & 23 deletions cmake/HPX_ParcelPorts.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Hartmut Kaiser
# Copyright (c) 2021-2023 Hartmut Kaiser
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand All @@ -9,26 +9,6 @@ if(HPX_WITH_DISTRIBUTED_RUNTIME)
${HPX_STATIC_PARCELPORT_PLUGINS}
)

# add_subdirectory is called before to insure HPX_STATIC_PARCELPORT_PLUGINS
# cache variable is filled
set(_parcelport_export)
set(_parcelport_init)

foreach(parcelport ${HPX_STATIC_PARCELPORT_PLUGINS})
set(_parcelport_export
"${_parcelport_export}HPX_EXPORT hpx::plugins::parcelport_factory_base *${parcelport}_factory_init(\n"
)
set(_parcelport_export
"${_parcelport_export} std::vector<hpx::plugins::parcelport_factory_base *>& factories);\n"
)
set(_parcelport_init
"${_parcelport_init} ${parcelport}_factory_init(factories);\n"
)
endforeach()

configure_file(
"${PROJECT_SOURCE_DIR}/cmake/templates/static_parcelports.hpp.in"
"${PROJECT_BINARY_DIR}/libs/full/parcelset/include/hpx/parcelset/static_parcelports.hpp"
@ONLY
)
# handle parcelports module to create proper dependencies
add_subdirectory(libs/full/parcelports)
endif()
7 changes: 4 additions & 3 deletions components/parcel_plugins/binary_filter/bzip2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ add_hpx_library(
"hpx/binary_filter/bzip2_serialization_filter.hpp"
"hpx/binary_filter/bzip2_serialization_filter_registration.hpp"
PREPEND_HEADER_ROOT INSTALL_HEADERS
FOLDER "Core/Plugins/Compression"
DEPENDENCIES ${BZIP2_LIBRARIES} ${HPX_WITH_UNITY_BUILD_OPTION}
FOLDER "Core/Plugins/Compression" ${HPX_WITH_UNITY_BUILD_OPTION}
)

target_include_directories(
compression_bzip2 SYSTEM PRIVATE ${BZIP2_INCLUDE_DIR}
)
target_link_libraries(compression_bzip2 PUBLIC Boost::iostreams)
target_link_libraries(
compression_bzip2 PUBLIC Boost::iostreams ${BZIP2_LIBRARIES}
)

add_hpx_pseudo_dependencies(
components.parcel_plugins.binary_filter.bzip2 compression_bzip2
Expand Down
7 changes: 4 additions & 3 deletions components/parcel_plugins/binary_filter/snappy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@ add_hpx_library(
"hpx/binary_filter/snappy_serialization_filter.hpp"
"hpx/binary_filter/snappy_serialization_filter_registration.hpp"
PREPEND_HEADER_ROOT INSTALL_HEADERS
FOLDER "Core/Plugins/Compression"
DEPENDENCIES ${SNAPPY_LIBRARY} ${HPX_WITH_UNITY_BUILD_OPTION}
FOLDER "Core/Plugins/Compression" ${HPX_WITH_UNITY_BUILD_OPTION}
)

target_include_directories(
compression_snappy SYSTEM PRIVATE ${SNAPPY_INCLUDE_DIR}
)
target_link_directories(compression_snappy PRIVATE ${SNAPPY_LIBRARY_DIR})

target_link_libraries(compression_snappy PUBLIC Boost::iostreams)
target_link_libraries(
compression_snappy PUBLIC Boost::iostreams ${SNAPPY_LIBRARY}
)

add_hpx_pseudo_dependencies(
components.parcel_plugins.binary_filter.snappy compression_snappy
Expand Down
7 changes: 4 additions & 3 deletions components/parcel_plugins/binary_filter/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ add_hpx_library(
"hpx/binary_filter/zlib_serialization_filter.hpp"
"hpx/binary_filter/zlib_serialization_filter_registration.hpp"
PREPEND_HEADER_ROOT INSTALL_HEADERS
FOLDER "Core/Plugins/Compression"
DEPENDENCIES ${ZLIB_LIBRARIES} ${HPX_WITH_UNITY_BUILD_OPTION}
FOLDER "Core/Plugins/Compression" ${HPX_WITH_UNITY_BUILD_OPTION}
)

target_include_directories(compression_zlib SYSTEM PRIVATE ${ZLIB_INCLUDE_DIRS})
target_link_libraries(compression_zlib PUBLIC Boost::iostreams)
target_link_libraries(
compression_zlib PUBLIC Boost::iostreams ${ZLIB_LIBRARIES}
)

add_hpx_pseudo_dependencies(
components.parcel_plugins.binary_filter.zlib compression_zlib
Expand Down
13 changes: 6 additions & 7 deletions libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,7 @@ target_include_directories(
)

target_link_libraries(hpx_full PUBLIC hpx_base_libraries)

if((NOT HPX_WITH_STATIC_LINKING) AND (("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
OR (APPLE))
)
set_target_properties(hpx_full PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()

set_target_properties(hpx_full PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(hpx_full PRIVATE HPX_COMPONENT_NAME=hpx HPX_EXPORTS)

# ##############################################################################
Expand Down Expand Up @@ -340,6 +334,11 @@ foreach(lib ${HPX_LIBS})
endif()

add_subdirectory(${lib})

set(_hpx_${lib}_modules
${_hpx_${lib}_modules}
PARENT_SCOPE
)
endforeach()

# add_hpx_module populates HPX_ENABLED_MODULES
Expand Down
5 changes: 5 additions & 0 deletions libs/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,8 @@ hpx_info(" Configuring libhpx_core modules:")
foreach(module ${_hpx_core_modules})
add_subdirectory(${module})
endforeach()

set(_hpx_core_modules
${_hpx_core_modules}
PARENT_SCOPE
)
20 changes: 11 additions & 9 deletions libs/core/include_local/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ set(include_local_headers
hpx/experimental/task_group.hpp
)

set(generated_include_local_headers
hpx/algorithm.hpp
hpx/barrier.hpp
hpx/channel.hpp
hpx/compute.hpp
hpx/future.hpp
hpx/latch.hpp
hpx/runtime.hpp
)
if(NOT HPX_WITH_DISTRIBUTED_RUNTIME)
set(generated_include_local_headers
hpx/algorithm.hpp
hpx/barrier.hpp
hpx/channel.hpp
hpx/compute.hpp
hpx/future.hpp
hpx/latch.hpp
hpx/runtime.hpp
)
endif()

# The headers in hpx/local/ were deprecated in HPX V1.9.1
# cmake-format: off
Expand Down
4 changes: 3 additions & 1 deletion libs/core/init_runtime_local/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ set(init_runtime_local_headers hpx/init_runtime_local/detail/init_logging.hpp
hpx/init_runtime_local/init_runtime_local.hpp
)

set(generated_init_runtime_local_headers hpx/init.hpp)
if(NOT HPX_WITH_DISTRIBUTED_RUNTIME)
set(generated_init_runtime_local_headers hpx/init.hpp)
endif()

set(init_runtime_local_sources init_logging.cpp init_runtime_local.cpp)

Expand Down
11 changes: 6 additions & 5 deletions libs/create_module_skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'''
Copyright (c) 2019-2020 ETH Zurich
Copyright (c) 2018 Thomas Heller
Copyright (c) 2022-2023 Hartmut Kaiser
SPDX-License-Identifier: BSL-1.0
Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand All @@ -24,14 +25,14 @@
header_str = '=' * len(module_name)


cmake_root_header = f'''# Copyright (c) 2019-2021 The STE||AR-Group
cmake_root_header = f'''# Copyright (c) 2019-2023 The STE||AR-Group
#
# SPDX-License-Identifier: BSL-1.0
# 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)
'''

cmake_header = f'''# Copyright (c) 2020-2021 The STE||AR-Group
cmake_header = f'''# Copyright (c) 2020-2023 The STE||AR-Group
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand All @@ -40,7 +41,7 @@

readme_template = f'''
..
Copyright (c) 2020-2021 The STE||AR-Group
Copyright (c) 2020-2023 The STE||AR-Group
SPDX-License-Identifier: BSL-1.0
Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand All @@ -57,7 +58,7 @@
'''

index_rst = f'''..
Copyright (c) 2020-2021 The STE||AR-Group
Copyright (c) 2020-2023 The STE||AR-Group
SPDX-License-Identifier: BSL-1.0
Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down Expand Up @@ -255,7 +256,7 @@ def mkdir(path):
header_underline_str = '=' * len(header_name_str)

modules_rst = f'''..
Copyright (c) 2018-2021 The STE||AR-Group
Copyright (c) 2018-2023 The STE||AR-Group
SPDX-License-Identifier: BSL-1.0
Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down
12 changes: 11 additions & 1 deletion libs/full/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ set(_hpx_full_modules
parcelport_libfabric
parcelport_mpi
parcelport_tcp
parcelports
parcelset
parcelset_base
performance_counters
Expand All @@ -51,5 +52,14 @@ hpx_info("")
hpx_info(" Configuring libhpx modules:")

foreach(module ${_hpx_full_modules})
add_subdirectory(${module})
# the parcelports module is handled explicitly after all other modules have
# been processed (see HPX_ParcelPorts.cmake)
if(NOT (${module} STREQUAL "parcelports"))
add_subdirectory(${module})
endif()
endforeach()

set(_hpx_full_modules
${_hpx_full_modules}
PARENT_SCOPE
)
28 changes: 18 additions & 10 deletions libs/full/agas/src/route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#if defined(HPX_HAVE_NETWORKING)
#include <hpx/actions_base/plain_action.hpp>
#include <hpx/agas/addressing_service.hpp>
#include <hpx/agas_base/route.hpp>
#include <hpx/agas_base/server/primary_namespace.hpp>
#include <hpx/assert.hpp>
#include <hpx/async_distributed/continuation.hpp>
Expand Down Expand Up @@ -41,32 +42,28 @@ HPX_PLAIN_ACTION_ID(hpx::detail::update_agas_cache, update_agas_cache_action,

namespace hpx::agas::server {

void primary_namespace::route(parcelset::parcel&& p)
void route_impl(primary_namespace& server, parcelset::parcel&& p)
{
LPT_(debug).format("primary_namespace::route: {}", p.parcel_id());

util::scoped_timer<std::atomic<std::int64_t>> update(
counter_data_.route_.time_, counter_data_.route_.enabled_);
counter_data_.increment_route_count();
LPT_(debug).format("agas::server::route_impl: {}", p.parcel_id());

naming::gid_type const& gid = p.destination();
naming::address& addr = p.addr();
resolved_type cache_address;
primary_namespace::resolved_type cache_address;

// resolve destination addresses, we should be able to resolve all of
// them, otherwise it's an error
{
std::unique_lock<mutex_type> l(mutex_);
std::unique_lock<primary_namespace::mutex_type> l(server.mutex());

error_code& ec = throws;

// wait for any migration to be completed
if (naming::detail::is_migratable(gid))
{
wait_for_migration_locked(l, gid, ec);
server.wait_for_migration_locked(l, gid, ec);
}

cache_address = resolve_gid_locked(l, gid, ec);
cache_address = server.resolve_gid_locked(l, gid, ec);

if (ec || hpx::get<0>(cache_address) == naming::invalid_gid)
{
Expand Down Expand Up @@ -133,6 +130,17 @@ namespace hpx::agas::server {
}
}
}

///////////////////////////////////////////////////////////////////////////
struct init_route_function
{
init_route_function()
{
server::route = &route_impl;
}
};

init_route_function init;
} // namespace hpx::agas::server

#endif
Loading

0 comments on commit 4f676fe

Please sign in to comment.