Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing cyclic dependencies in naming and agas modules #6320

Merged
merged 3 commits into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
2 changes: 2 additions & 0 deletions cmake/HPX_SetupTarget.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ function(hpx_setup_target target)
hpx_debug("setup_target.${target} UNITY_BUILD: OFF")
endif()

set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE ON)

get_target_property(target_EXCLUDE_FROM_ALL ${target} EXCLUDE_FROM_ALL)

if(target_EXPORT AND NOT target_EXCLUDE_FROM_ALL)
Expand Down
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
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
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright (c) 2007-2012 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
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <hpx/config.hpp>

#if !defined(HPX_COMPUTE_DEVICE_CODE)
#include <hpx/hpx.hpp>
#include <hpx/include/components.hpp>
#include <hpx/serialization.hpp>
#include <hpx/include/serialization.hpp>

#include "server/cancelable_action.hpp"

Expand All @@ -17,8 +17,8 @@
HPX_REGISTER_COMPONENT_MODULE()

///////////////////////////////////////////////////////////////////////////////
typedef hpx::components::component<examples::server::cancelable_action>
cancelable_action_component_type;
using cancelable_action_component_type =
hpx::components::component<examples::server::cancelable_action>;

HPX_REGISTER_COMPONENT(cancelable_action_component_type, cancelable_action)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2007-2011 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 @@ -11,21 +11,21 @@
#include <hpx/assert.hpp>
#include <hpx/include/components.hpp>

#include "stubs/cancelable_action.hpp"
#include "server/cancelable_action.hpp"

#include <utility>

namespace examples {

///////////////////////////////////////////////////////////////////////////
// Client side representation for for the \a server::cancelable_action
// component.
class cancelable_action
: public hpx::components::client_base<cancelable_action,
stubs::cancelable_action>
server::cancelable_action>
{
typedef hpx::components::client_base<cancelable_action,
stubs::cancelable_action>
base_type;
using base_type = hpx::components::client_base<cancelable_action,
server::cancelable_action>;

public:
// Default construct an empty client side representation (not
Expand All @@ -45,16 +45,18 @@ namespace examples {
}

///////////////////////////////////////////////////////////////////////
void do_it(hpx::error_code& ec = hpx::throws)
void do_it(hpx::error_code& ec = hpx::throws) const
{
using action_type = server::cancelable_action::do_it_action;
HPX_ASSERT(this->get_id());
this->base_type::do_it(this->get_id(), ec);
hpx::async<action_type>(this->get_id()).get(ec);
}

void cancel_it()
void cancel_it() const
{
using action_type = server::cancelable_action::cancel_it_action;
HPX_ASSERT(this->get_id());
this->base_type::cancel_it(this->get_id());
hpx::post<action_type>(this->get_id());
}
};
} // namespace examples
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2007-2022 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 @@ -7,18 +7,22 @@
#pragma once

#include <hpx/config.hpp>

#if !defined(HPX_COMPUTE_DEVICE_CODE)
#include <hpx/hpx.hpp>
#include <hpx/assert.hpp>

#include <hpx/include/actions.hpp>
#include <hpx/include/components.hpp>
#include <hpx/include/lcos.hpp>
#include <hpx/include/threads.hpp>
#include <hpx/include/util.hpp>

#include <memory>
#include <mutex>

///////////////////////////////////////////////////////////////////////////////
namespace examples { namespace server {
namespace examples::server {

///////////////////////////////////////////////////////////////////////////
inline void delay(int c)
{
Expand Down Expand Up @@ -50,24 +54,29 @@ namespace examples { namespace server {
explicit reset_id(cancelable_action& this_)
: outer_(this_)
{
std::lock_guard<hpx::mutex> l(outer_.mtx_);
hpx::thread::id old_value = outer_.id_;
auto const mtx = outer_.mtx_;
std::lock_guard<hpx::mutex> l(*mtx);

[[maybe_unused]] hpx::thread::id const old_value = outer_.id_;
outer_.id_ = hpx::this_thread::get_id();
HPX_ASSERT(old_value == hpx::thread::id());
HPX_UNUSED(old_value);
}
~reset_id()
{
hpx::thread::id old_value = outer_.id_;
[[maybe_unused]] hpx::thread::id const old_value = outer_.id_;
outer_.id_ = hpx::thread::id();
HPX_ASSERT(old_value != hpx::thread::id());
HPX_UNUSED(old_value);
}

cancelable_action& outer_;
};

public:
cancelable_action()
: mtx_(std::make_shared<hpx::mutex>())
{
}

// Do some lengthy work
void do_it()
{
Expand All @@ -85,15 +94,17 @@ namespace examples { namespace server {
}

// Cancel the lengthy action above
void cancel_it()
void cancel_it() const
{
// Make sure id_ has been set
hpx::util::yield_while([this]() {
std::lock_guard<hpx::mutex> l(mtx_);
auto const mtx = mtx_;
std::lock_guard<hpx::mutex> l(*mtx);
return id_ == hpx::thread::id();
});

std::lock_guard<hpx::mutex> l(mtx_);
auto const mtx = mtx_;
std::lock_guard<hpx::mutex> l(*mtx);
HPX_ASSERT(id_ != hpx::thread::id());
hpx::thread::interrupt(id_);
}
Expand All @@ -103,10 +114,10 @@ namespace examples { namespace server {
cancelable_action, cancel_it, cancel_it_action)

private:
hpx::mutex mtx_;
std::shared_ptr<hpx::mutex> mtx_;
hpx::thread::id id_;
};
}} // namespace examples::server
} // namespace examples::server

///////////////////////////////////////////////////////////////////////////////
HPX_REGISTER_ACTION_DECLARATION(
Expand Down
Loading