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

Libcds module #4909

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .jenkins/lsu/env-gcc-9.sh
Expand Up @@ -18,3 +18,4 @@ configure_extra_options+=" -DHPX_WITH_MALLOC=system"
configure_extra_options+=" -DHPX_WITH_COMPILER_WARNINGS=ON"
configure_extra_options+=" -DHPX_WITH_COMPILER_WARNINGS_AS_ERRORS=ON"
configure_extra_options+=" -DHPX_WITH_PARCELPORT_MPI=ON"
configure_extra_options+=" -DHPX_LIBCDS_WITH_LIBCDS=ON"
26 changes: 0 additions & 26 deletions CMakeLists.txt
Expand Up @@ -1033,32 +1033,6 @@ if(HPX_WITH_APEX)
)
endif()

# cmake-format: off
# LibCDS option
# NOTE: The libcds option is disabled for the 1.5.0 release as it is not ready
# for public consumption yet.
# hpx_option(
# HPX_WITH_LIBCDS BOOL "Enable LibCDS support (experimental)." OFF
# CATEGORY "Thread Manager" ADVANCED
# )
# if(HPX_WITH_LIBCDS)
# hpx_option(
# HPX_WITH_LIBCDS_GIT_REPOSITORY STRING
# "Define the LibCDS git repository to use."
# https://github.com/STEllAR-GROUP/libcds CATEGORY "Thread Manager" ADVANCED
# )
# hpx_option(
# HPX_WITH_LIBCDS_GIT_TAG STRING "Define the LibCDS git tag to use." hpx-1.5
# CATEGORY "Thread Manager" ADVANCED
# )
# include(HPX_SetupLibCDS)
# if(NOT libcds_POPULATED)
# hpx_error("HPX_WITH_LIBCDS was set to ON, but HPX failed to fetch LibCDS")
# endif()
# hpx_add_config_define(HPX_HAVE_LIBCDS) # tell HPX that we use LibCDS
# endif()
# cmake-format: on

hpx_option(
HPX_WITH_PAPI BOOL "Enable the PAPI based performance counter." OFF
CATEGORY "Profiling"
Expand Down
52 changes: 0 additions & 52 deletions cmake/HPX_SetupLibCDS.cmake

This file was deleted.

37 changes: 37 additions & 0 deletions examples/libcds/CMakeLists.txt
@@ -0,0 +1,37 @@
# Copyright (c) 2007-2013 Hartmut Kaiser
# Copyright (c) 2011 Bryce Adelstein-Lelbach
# Copyright (c) 2020 Weile Wei
#
# 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)

set(example_programs libcds_deque)
set(libcds_deque DEPENDENCIES iostreams_component)

foreach(example_program ${example_programs})
set(${example_program}_FLAGS COMPONENT_DEPENDENCIES iostreams)
set(${example_program}_PARAMETERS THREADS_PER_LOCALITY 4)

set(sources ${example_program}.cpp)

source_group("Source Files" FILES ${sources})

# add example executable
add_hpx_executable(
${example_program} INTERNAL_FLAGS
SOURCES ${sources} ${${example_program}_FLAGS}
FOLDER "Examples/libcds/${example_program}"
)

add_hpx_example_target_dependencies("libcds" ${example_program})

if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES)
add_hpx_example_test(
"libcds" ${example_program} ${${example_program}_PARAMETERS}
)
endif()

endforeach()

target_link_libraries(libcds_deque PRIVATE cds)
22 changes: 1 addition & 21 deletions libs/core/coroutines/include/hpx/coroutines/coroutine.hpp
Expand Up @@ -96,17 +96,7 @@ namespace hpx { namespace threads { namespace coroutines {
return impl_.set_thread_data(data);
}

#if defined(HPX_HAVE_LIBCDS)
std::size_t get_libcds_data() const
{
return impl_.get_libcds_data();
}

std::size_t set_libcds_data(std::size_t data)
{
return impl_.set_libcds_data(data);
}

#if defined(HPX_HAVE_MODULE_LIBCDS)
std::size_t get_libcds_hazard_pointer_data() const
{
return impl_.get_libcds_hazard_pointer_data();
Expand All @@ -116,16 +106,6 @@ namespace hpx { namespace threads { namespace coroutines {
{
return impl_.set_libcds_hazard_pointer_data(data);
}

std::size_t get_libcds_dynamic_hazard_pointer_data() const
{
return impl_.get_libcds_dynamic_hazard_pointer_data();
}

std::size_t set_libcds_dynamic_hazard_pointer_data(std::size_t data)
{
return impl_.set_libcds_dynamic_hazard_pointer_data(data);
}
#endif

void rebind(functor_type&& f, thread_id_type id)
Expand Down
Expand Up @@ -86,10 +86,8 @@ namespace hpx { namespace threads { namespace coroutines { namespace detail {
#else
, m_thread_data(0)
#endif
#if defined(HPX_HAVE_LIBCDS)
, libcds_data_(0)
#if defined(HPX_HAVE_MODULE_LIBCDS)
, libcds_hazard_pointer_data_(0)
, libcds_dynamic_hazard_pointer_data_(0)
#endif
, m_type_info()
, m_thread_id(id)
Expand All @@ -104,10 +102,8 @@ namespace hpx { namespace threads { namespace coroutines { namespace detail {
#else
m_thread_data = 0;
#endif
#if defined(HPX_HAVE_LIBCDS)
libcds_data_ = 0;
#if defined(HPX_HAVE_MODULE_LIBCDS)
libcds_hazard_pointer_data_ = 0;
libcds_dynamic_hazard_pointer_data_ = 0;
#endif
}

Expand Down Expand Up @@ -215,10 +211,8 @@ namespace hpx { namespace threads { namespace coroutines { namespace detail {
#else
m_thread_data = 0;
#endif
#if defined(HPX_HAVE_LIBCDS)
libcds_data_ = 0;
#if defined(HPX_HAVE_MODULE_LIBCDS)
libcds_hazard_pointer_data_ = 0;
libcds_dynamic_hazard_pointer_data_ = 0;
#endif
}

Expand All @@ -244,18 +238,7 @@ namespace hpx { namespace threads { namespace coroutines { namespace detail {
#endif
}

#if defined(HPX_HAVE_LIBCDS)
std::size_t get_libcds_data() const
{
return libcds_data_;
}

std::size_t set_libcds_data(std::size_t data)
{
std::swap(data, libcds_data_);
return data;
}

#if defined(HPX_HAVE_MODULE_LIBCDS)
std::size_t get_libcds_hazard_pointer_data() const
{
return libcds_hazard_pointer_data_;
Expand All @@ -266,17 +249,6 @@ namespace hpx { namespace threads { namespace coroutines { namespace detail {
std::swap(data, libcds_hazard_pointer_data_);
return data;
}

std::size_t get_libcds_dynamic_hazard_pointer_data() const
{
return libcds_dynamic_hazard_pointer_data_;
}

std::size_t set_libcds_dynamic_hazard_pointer_data(std::size_t data)
{
std::swap(data, libcds_dynamic_hazard_pointer_data_);
return data;
}
#endif

#if defined(HPX_HAVE_THREAD_LOCAL_STORAGE)
Expand Down Expand Up @@ -335,10 +307,8 @@ namespace hpx { namespace threads { namespace coroutines { namespace detail {
#else
HPX_ASSERT(m_thread_data == 0);
#endif
#if defined(HPX_HAVE_LIBCDS)
HPX_ASSERT(libcds_data_ == 0);
#if defined(HPX_HAVE_MODULE_LIBCDS)
HPX_ASSERT(libcds_hazard_pointer_data_ == 0);
HPX_ASSERT(libcds_dynamic_hazard_pointer_data_ == 0);
#endif
// NOLINTNEXTLINE(bugprone-throw-keyword-missing)
m_type_info = std::exception_ptr();
Expand Down Expand Up @@ -401,10 +371,8 @@ namespace hpx { namespace threads { namespace coroutines { namespace detail {
#else
mutable std::size_t m_thread_data;
#endif
#if defined(HPX_HAVE_LIBCDS)
mutable std::size_t libcds_data_;
#if defined(HPX_HAVE_MODULE_LIBCDS)
mutable std::size_t libcds_hazard_pointer_data_;
mutable std::size_t libcds_dynamic_hazard_pointer_data_;
#endif

// This is used to generate a meaningful exception trace.
Expand Down
Expand Up @@ -129,17 +129,10 @@ namespace hpx { namespace threads { namespace coroutines { namespace detail {
virtual std::size_t get_thread_data() const = 0;
virtual std::size_t set_thread_data(std::size_t data) = 0;

#if defined(HPX_HAVE_LIBCDS)
virtual std::size_t get_libcds_data() const = 0;
virtual std::size_t set_libcds_data(std::size_t data) = 0;

#if defined(HPX_HAVE_MODULE_LIBCDS)
virtual std::size_t get_libcds_hazard_pointer_data() const = 0;
virtual std::size_t set_libcds_hazard_pointer_data(
std::size_t data) = 0;

virtual std::size_t get_libcds_dynamic_hazard_pointer_data() const = 0;
virtual std::size_t set_libcds_dynamic_hazard_pointer_data(
std::size_t data) = 0;
#endif

virtual tss_storage* get_thread_tss_data() = 0;
Expand Down
Expand Up @@ -81,18 +81,7 @@ namespace hpx { namespace threads { namespace coroutines { namespace detail {
return pimpl_->set_thread_data(data);
}

#if defined(HPX_HAVE_LIBCDS)
std::size_t get_libcds_data() const override
{
HPX_ASSERT(pimpl_);
return pimpl_->get_libcds_data();
}
std::size_t set_libcds_data(std::size_t data) override
{
HPX_ASSERT(pimpl_);
return pimpl_->set_libcds_data(data);
}

#if defined(HPX_HAVE_MODULE_LIBCDS)
std::size_t get_libcds_hazard_pointer_data() const override
{
HPX_ASSERT(pimpl_);
Expand All @@ -103,18 +92,6 @@ namespace hpx { namespace threads { namespace coroutines { namespace detail {
HPX_ASSERT(pimpl_);
return pimpl_->set_libcds_hazard_pointer_data(data);
}

std::size_t get_libcds_dynamic_hazard_pointer_data() const override
{
HPX_ASSERT(pimpl_);
return pimpl_->get_libcds_dynamic_hazard_pointer_data();
}
std::size_t set_libcds_dynamic_hazard_pointer_data(
std::size_t data) override
{
HPX_ASSERT(pimpl_);
return pimpl_->set_libcds_dynamic_hazard_pointer_data(data);
}
#endif

tss_storage* get_thread_tss_data() override
Expand Down
Expand Up @@ -73,18 +73,7 @@ namespace hpx { namespace threads { namespace coroutines { namespace detail {
return pimpl_->set_thread_data(data);
}

#if defined(HPX_HAVE_LIBCDS)
std::size_t get_libcds_data() const override
{
HPX_ASSERT(pimpl_);
return pimpl_->get_libcds_data();
}
std::size_t set_libcds_data(std::size_t data) override
{
HPX_ASSERT(pimpl_);
return pimpl_->set_libcds_data(data);
}

#if defined(HPX_HAVE_MODULE_LIBCDS)
std::size_t get_libcds_hazard_pointer_data() const override
{
HPX_ASSERT(pimpl_);
Expand All @@ -95,18 +84,6 @@ namespace hpx { namespace threads { namespace coroutines { namespace detail {
HPX_ASSERT(pimpl_);
return pimpl_->set_libcds_hazard_pointer_data(data);
}

std::size_t get_libcds_dynamic_hazard_pointer_data() const override
{
HPX_ASSERT(pimpl_);
return pimpl_->get_libcds_dynamic_hazard_pointer_data();
}
std::size_t set_libcds_dynamic_hazard_pointer_data(
std::size_t data) override
{
HPX_ASSERT(pimpl_);
return pimpl_->set_libcds_dynamic_hazard_pointer_data(data);
}
#endif

tss_storage* get_thread_tss_data() override
Expand Down