Skip to content

Commit

Permalink
Merge b90dbb1 into e7c31a4
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser authored Aug 11, 2023
2 parents e7c31a4 + b90dbb1 commit 16ec2ba
Show file tree
Hide file tree
Showing 19 changed files with 260 additions and 88 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/linux_release_static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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:14

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
22 changes: 19 additions & 3 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 @@ -12,14 +12,24 @@ if(HPX_WITH_DISTRIBUTED_RUNTIME)
# add_subdirectory is called before to insure HPX_STATIC_PARCELPORT_PLUGINS
# cache variable is filled
set(_parcelport_export)
set(_parcelport_export_source)
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"
"${_parcelport_export}extern HPX_EXPORT hpx::plugins::parcelport_factory_base *\n"
)
set(_parcelport_export
"${_parcelport_export} std::vector<hpx::plugins::parcelport_factory_base *>& factories);\n"
"${_parcelport_export} (*${parcelport}_factory_init)(\n"
)
set(_parcelport_export
"${_parcelport_export} std::vector<hpx::plugins::parcelport_factory_base *>& factories);\n"
)
set(_parcelport_export_source
"${_parcelport_export_source}hpx::plugins::parcelport_factory_base * (*${parcelport}_factory_init)(\n"
)
set(_parcelport_export_source
"${_parcelport_export_source} std::vector<hpx::plugins::parcelport_factory_base *>& factories) = nullptr;\n"
)
set(_parcelport_init
"${_parcelport_init} ${parcelport}_factory_init(factories);\n"
Expand All @@ -31,4 +41,10 @@ if(HPX_WITH_DISTRIBUTED_RUNTIME)
"${PROJECT_BINARY_DIR}/libs/full/parcelset/include/hpx/parcelset/static_parcelports.hpp"
@ONLY
)

configure_file(
"${PROJECT_SOURCE_DIR}/cmake/templates/static_parcelports_impl.hpp.in"
"${PROJECT_BINARY_DIR}/libs/full/parcelset/include/hpx/parcelset/static_parcelports_impl.hpp"
@ONLY
)
endif()
6 changes: 3 additions & 3 deletions cmake/templates/static_parcelports.hpp.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2012-2015 Thomas Heller
// Copyright (c) 2007-2021 Hartmut Kaiser
// Copyright (c) 2007-2023 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand All @@ -9,15 +9,15 @@

#pragma once

#include <hpx/assert.hpp>
#include <hpx/config.hpp>
#include <hpx/plugin_factories/parcelport_factory_base.hpp>

#include <vector>

@_parcelport_export@
namespace hpx::parcelset
{
void init_static_parcelport_factories(
inline void init_static_parcelport_factories(
std::vector<plugins::parcelport_factory_base *>& factories)
{
@_parcelport_init@ }
Expand Down
18 changes: 18 additions & 0 deletions cmake/templates/static_parcelports_impl.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) 2012-2015 Thomas Heller
// Copyright (c) 2007-2023 Hartmut Kaiser
//
// 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)

// Do not edit this file! It has been generated by the cmake configuration step.

#pragma once

#include <hpx/config.hpp>
#include <hpx/parcelset/static_parcelports.hpp>
#include <hpx/plugin_factories/parcelport_factory_base.hpp>

#include <vector>

@_parcelport_export_source@
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
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
21 changes: 21 additions & 0 deletions libs/full/agas_base/include/hpx/agas_base/route.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) 2007-2023 Hartmut Kaiser
//
// 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)

#pragma once

#include <hpx/config.hpp>

#if defined(HPX_HAVE_NETWORKING)
#include <hpx/agas_base/agas_fwd.hpp>
#include <hpx/parcelset/parcel.hpp>

namespace hpx::agas::server {

extern HPX_EXPORT void (*route)(
primary_namespace& server, parcelset::parcel&& p);
} // namespace hpx::agas::server

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ namespace hpx::agas::server {
using resolved_type =
hpx::tuple<naming::gid_type, gva, naming::gid_type>;

mutex_type& mutex()
{
return mutex_;
}

private:
// REVIEW: Separate mutexes might reduce contention here. This has to be
// investigated carefully.
Expand Down Expand Up @@ -241,6 +246,7 @@ namespace hpx::agas::server {
char const* func_name);
#endif

public:
// helper function
void wait_for_migration_locked(std::unique_lock<mutex_type>& l,
naming::gid_type const& id, error_code& ec);
Expand Down Expand Up @@ -295,10 +301,10 @@ namespace hpx::agas::server {
std::pair<naming::gid_type, naming::gid_type> allocate(
std::uint64_t count);

private:
resolved_type resolve_gid_locked(std::unique_lock<mutex_type>& l,
naming::gid_type const& gid, error_code& ec);

private:
resolved_type resolve_gid_locked_non_local(
std::unique_lock<mutex_type>& l, naming::gid_type const& gid,
error_code& ec);
Expand Down
14 changes: 14 additions & 0 deletions libs/full/agas_base/src/server/primary_namespace_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <hpx/config.hpp>
#include <hpx/agas_base/route.hpp>
#include <hpx/agas_base/server/primary_namespace.hpp>
#include <hpx/assert.hpp>
#include <hpx/components_base/agas_interface.hpp>
Expand Down Expand Up @@ -1119,6 +1120,19 @@ namespace hpx::agas::server {
return resolved_type(naming::invalid_gid, gva(), naming::invalid_gid);
}

#if defined(HPX_HAVE_NETWORKING)
void (*route)(primary_namespace& server, parcelset::parcel&& p) = nullptr;

void primary_namespace::route(parcelset::parcel&& p)
{
util::scoped_timer<std::atomic<std::int64_t>> update(
counter_data_.route_.time_, counter_data_.route_.enabled_);
counter_data_.increment_route_count();

(*server::route)(*this, HPX_MOVE(p));
}
#endif

// access current counter values
std::int64_t primary_namespace::counter_data::get_bind_gid_count(bool reset)
{
Expand Down
5 changes: 3 additions & 2 deletions libs/full/naming/include/hpx/naming/credit_handling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ namespace hpx::naming {
gid_type& id, std::int64_t debit);

HPX_EXPORT std::int64_t fill_credit_for_gid(gid_type& id,
std::int64_t credits = std::int64_t(HPX_GLOBALCREDIT_INITIAL));
std::int64_t credits = static_cast<std::int64_t>(
HPX_GLOBALCREDIT_INITIAL));

///////////////////////////////////////////////////////////////////////
HPX_EXPORT gid_type move_gid(gid_type& id);
Expand All @@ -58,7 +59,7 @@ namespace hpx::naming {
std::unique_lock<gid_type::mutex_type>& l, gid_type& id);

///////////////////////////////////////////////////////////////////////
HPX_EXPORT void decrement_refcnt(id_type_impl* gid) noexcept;
HPX_EXPORT void decrement_refcnt(id_type_impl const* gid) noexcept;

///////////////////////////////////////////////////////////////////////
// credit management (called during serialization), this function
Expand Down
Loading

0 comments on commit 16ec2ba

Please sign in to comment.