Skip to content

Commit

Permalink
Merge 91364b7 into e7c31a4
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser authored Aug 15, 2023
2 parents e7c31a4 + 91364b7 commit 4ca9fcb
Show file tree
Hide file tree
Showing 32 changed files with 417 additions and 136 deletions.
52 changes: 51 additions & 1 deletion cmake/FindHwloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,40 @@ if(NOT TARGET Hwloc::hwloc)
PATH_SUFFIXES lib lib64
)

if(HPX_WITH_STATIC_LINKING AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
# libhwloc.a on Linux depends on libltdl and libudev
pkg_check_modules(PC_LTDL QUIET ltdl)
find_library(
LTDL_LIBRARY
NAMES ltdl libltdl
HINTS ${LTDL_ROOT}
ENV
LTDL_ROOT
${HPX_LTDL_ROOT}
${PC_LTDL_MINIMAL_LIBDIR}
${PC_LTDL_MINIMAL_LIBRARY_DIRS}
${PC_LTDL_LIBDIR}
${PC_LTDL_LIBRARY_DIRS}
PATH_SUFFIXES lib lib64
)

# libhwloc.a on Linux depends on libltdl and libudev
pkg_check_modules(PC_UDEV QUIET udev)
find_library(
UDEV_LIBRARY
NAMES udev libudev
HINTS ${UDEV_ROOT}
ENV
UDEV_ROOT
${HPX_UDEV_ROOT}
${PC_UDEV_MINIMAL_LIBDIR}
${PC_UDEV_MINIMAL_LIBRARY_DIRS}
${PC_UDEV_LIBDIR}
${PC_UDEV_LIBRARY_DIRS}
PATH_SUFFIXES lib lib64
)
endif()

# Set HWLOC_ROOT in case the other hints are used
if(HWLOC_ROOT)
# The call to file is for compatibility with windows paths
Expand Down Expand Up @@ -70,7 +104,23 @@ 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)

if(LTDL_FOUND)
target_link_libraries(Hwloc::hwloc INTERFACE ${LTDL_LIBRARY})
target_include_directories(
Hwloc::hwloc SYSTEM INTERFACE ${LTDL_INCLUDE_DIR}
)
mark_as_advanced(LTDL_ROOT LTDL_LIBRARY LTDL_INCLUDE_DIR)
endif()
if(UDEV_FOUND)
target_link_libraries(Hwloc::hwloc INTERFACE ${UDEV_LIBRARY})
target_include_directories(
Hwloc::hwloc SYSTEM INTERFACE ${UDEV_INCLUDE_DIR}
)
mark_as_advanced(UDEV_ROOT UDEV_LIBRARY UDEV_INCLUDE_DIR)
endif()

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
5 changes: 5 additions & 0 deletions libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,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
1 change: 1 addition & 0 deletions libs/full/agas_base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set(agas_base_headers
hpx/agas_base/gva.hpp
hpx/agas_base/locality_namespace.hpp
hpx/agas_base/primary_namespace.hpp
hpx/agas_base/route.hpp
hpx/agas_base/server/component_namespace.hpp
hpx/agas_base/server/locality_namespace.hpp
hpx/agas_base/server/primary_namespace.hpp
Expand Down
Loading

0 comments on commit 4ca9fcb

Please sign in to comment.