Skip to content

Commit

Permalink
Merge pull request #1290 from msimberg/remove-itt-notify
Browse files Browse the repository at this point in the history
Remove `itt_notify` module
  • Loading branch information
msimberg authored Nov 13, 2024
2 parents b252c0b + 8cd2180 commit a7ca257
Show file tree
Hide file tree
Showing 56 changed files with 164 additions and 2,081 deletions.
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -616,12 +616,6 @@ if(PIKA_WITH_SPINLOCK_DEADLOCK_DETECTION)
pika_add_config_define(PIKA_HAVE_SPINLOCK_DEADLOCK_DETECTION)
endif()

pika_option(
PIKA_WITH_ITTNOTIFY BOOL "Enable Amplifier (ITT) instrumentation support." OFF
CATEGORY "Profiling"
ADVANCED
)

pika_option(
PIKA_WITH_MPI BOOL
"Enable support for returning futures from MPI asynchronous calls (default: ON)" OFF
Expand Down
59 changes: 0 additions & 59 deletions cmake/FindAmplifier.cmake

This file was deleted.

18 changes: 9 additions & 9 deletions cmake/pika_add_config_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,6 @@ function(pika_check_for_unistd_h)
)
endfunction()

# ##################################################################################################
function(pika_check_for_libfun_std_experimental_optional)
pika_add_config_test(
PIKA_WITH_LIBFUN_EXPERIMENTAL_OPTIONAL
SOURCE cmake/tests/libfun_std_experimental_optional.cpp
FILE ${ARGN}
)
endfunction()

# ##################################################################################################
function(pika_check_for_cxx11_std_atomic)
# Make sure PIKA_HAVE_LIBATOMIC is removed from the cache if necessary
Expand Down Expand Up @@ -518,3 +509,12 @@ function(pika_check_for_mpix_continuations)
FILE ${ARGN}
)
endfunction()

# ##################################################################################################
function(pika_check_for_pthread_setname_np)
pika_add_config_test(
PIKA_WITH_PTHREAD_SETNAME_NP
SOURCE cmake/tests/pthread_setname_np.cpp
FILE ${ARGN}
)
endfunction()
2 changes: 2 additions & 0 deletions cmake/pika_perform_cxx_feature_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ function(pika_perform_cxx_feature_tests)
)

pika_check_for_stdexec_continues_on(DEFINITIONS PIKA_HAVE_STDEXEC_CONTINUES_ON)

pika_check_for_pthread_setname_np(DEFINITIONS PIKA_HAVE_PTHREAD_SETNAME_NP)
endfunction()
14 changes: 0 additions & 14 deletions cmake/pika_setup_allocator.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,6 @@ if(NOT TARGET pika_dependencies_allocator)

pika_info("Using ${PIKA_WITH_MALLOC} allocator.")

# Setup Intel amplifier
if((NOT PIKA_WITH_APEX) AND PIKA_WITH_ITTNOTIFY)

find_package(Amplifier)
if(NOT AMPLIFIER_FOUND)
pika_error(
"Intel Amplifier could not be found and PIKA_WITH_ITTNOTIFY=On, please specify AMPLIFIER_ROOT to point to the root of your Amplifier installation"
)
endif()

pika_add_config_define(PIKA_HAVE_ITTNOTIFY 1)
pika_add_config_define(PIKA_HAVE_THREAD_DESCRIPTION)
endif()

# convey selected allocator type to the build configuration
if(NOT PIKA_FIND_PACKAGE)
pika_add_config_define(PIKA_HAVE_MALLOC "\"${PIKA_WITH_MALLOC}\"")
Expand Down
11 changes: 11 additions & 0 deletions cmake/tests/pthread_setname_np.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2024 ETH Zurich
//
// 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 <pthread.h>

int main() { pthread_setname_np(pthread_self(), "test"); }
4 changes: 0 additions & 4 deletions libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,3 @@ configure_file(
if(MSVC AND PIKA_WITH_SWAP_CONTEXT_EMULATION)
target_link_options(pika PRIVATE "/EXPORT:switch_to_fiber")
endif()

if(PIKA_WITH_ITTNOTIFY)
target_link_libraries(pika PUBLIC pika_internal::amplifier)
endif()
1 change: 0 additions & 1 deletion libs/pika/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ set(_pika_modules
ini
init_runtime
iterator_support
itt_notify
lock_registration
logging
memory
Expand Down
1 change: 0 additions & 1 deletion libs/pika/concurrency/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ pika_add_module(
pika_execution_base
pika_errors
pika_hashing
pika_itt_notify
pika_lock_registration
pika_thread_support
CMAKE_SUBDIRS examples tests
Expand Down
17 changes: 2 additions & 15 deletions libs/pika/concurrency/include/pika/concurrency/spinlock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <pika/config.hpp>
#include <pika/execution_base/this_thread.hpp>
#include <pika/lock_registration/detail/register_locks.hpp>
#include <pika/modules/itt_notify.hpp>
#include <pika/thread_support/spinlock.hpp>

#include <atomic>
Expand All @@ -26,18 +25,15 @@ namespace pika::concurrency::detail {
std::atomic<bool> v_;

public:
spinlock(char const* const desc = "pika::concurrency::detail::spinlock")
spinlock(char const* const = "pika::concurrency::detail::spinlock")
: v_(false)
{
PIKA_ITT_SYNC_CREATE(this, desc, "");
}

~spinlock() { PIKA_ITT_SYNC_DESTROY(this); }
~spinlock() {}

void lock()
{
PIKA_ITT_SYNC_PREPARE(this);

// Checking for the value in is_locked() ensures that
// acquire_lock is only called when is_locked computes
// to false. This way we spin only on a load operation
Expand Down Expand Up @@ -66,34 +62,25 @@ namespace pika::concurrency::detail {
"pika::concurrency::detail::spinlock::lock", false);
} while (!acquire_lock());

PIKA_ITT_SYNC_ACQUIRED(this);
util::register_lock(this);
}

bool try_lock()
{
PIKA_ITT_SYNC_PREPARE(this);

bool r = acquire_lock(); //-V707

if (r)
{
PIKA_ITT_SYNC_ACQUIRED(this);
util::register_lock(this);
return true;
}

PIKA_ITT_SYNC_CANCEL(this);
return false;
}

void unlock()
{
PIKA_ITT_SYNC_RELEASING(this);

relinquish_lock();

PIKA_ITT_SYNC_RELEASED(this);
util::unregister_lock(this);
}

Expand Down
39 changes: 0 additions & 39 deletions libs/pika/concurrency/include/pika/concurrency/spinlock_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,16 @@
#include <pika/concurrency/cache_line_data.hpp>
#include <pika/hashing/fibhash.hpp>
#include <pika/lock_registration/detail/register_locks.hpp>
#include <pika/modules/itt_notify.hpp>
#include <pika/thread_support/spinlock.hpp>

#include <cstddef>

namespace pika::concurrency::detail {
#if PIKA_HAVE_ITTNOTIFY != 0
template <typename Tag, std::size_t N>
struct itt_spinlock_init
{
itt_spinlock_init();
~itt_spinlock_init();
};
#endif

template <typename Tag, std::size_t N = PIKA_HAVE_SPINLOCK_POOL_NUM>
class spinlock_pool
{
private:
static pika::concurrency::detail::cache_aligned_data<::pika::detail::spinlock> pool_[N];
#if PIKA_HAVE_ITTNOTIFY != 0
static detail::itt_spinlock_init<Tag, N> init_;
#endif

public:
static ::pika::detail::spinlock& spinlock_for(void const* pv)
Expand All @@ -51,30 +38,4 @@ namespace pika::concurrency::detail {
template <typename Tag, std::size_t N>
pika::concurrency::detail::cache_aligned_data<::pika::detail::spinlock>
spinlock_pool<Tag, N>::pool_[N];

#if PIKA_HAVE_ITTNOTIFY != 0
template <typename Tag, std::size_t N>
itt_spinlock_init<Tag, N>::itt_spinlock_init()
{
for (int i = 0; i < N; ++i)
{
PIKA_ITT_SYNC_CREATE(
(&spinlock_pool<Tag, N>::pool_[i].data_), "pika::concurrency::detail::spinlock", 0);
PIKA_ITT_SYNC_RENAME(
(&spinlock_pool<Tag, N>::pool_[i].data_), "pika::concurrency::detail::spinlock");
}
}

template <typename Tag, std::size_t N>
itt_spinlock_init<Tag, N>::~itt_spinlock_init()
{
for (int i = 0; i < N; ++i)
{
PIKA_ITT_SYNC_DESTROY((&spinlock_pool<Tag, N>::pool_[i].data_));
}
}

template <typename Tag, std::size_t N>
util::detail::itt_spinlock_init<Tag, N> spinlock_pool<Tag, N>::init_;
#endif
} // namespace pika::concurrency::detail
1 change: 0 additions & 1 deletion libs/pika/executors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pika_add_module(
pika_async_base
pika_config
pika_execution
pika_itt_notify
pika_properties
pika_threading
pika_timing
Expand Down
1 change: 0 additions & 1 deletion libs/pika/functional/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ pika_add_module(
pika_datastructures
pika_debugging
pika_errors
pika_itt_notify
pika_tag_invoke
pika_type_support
CMAKE_SUBDIRS examples tests
Expand Down
23 changes: 0 additions & 23 deletions libs/pika/functional/include/pika/functional/bind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,6 @@ namespace pika::util::detail {
#endif
}

#if PIKA_HAVE_ITTNOTIFY != 0 && !defined(PIKA_HAVE_APEX)
util::itt::string_handle get_function_annotation_itt() const
{
# if defined(PIKA_HAVE_THREAD_DESCRIPTION)
return pika::detail::get_function_annotation_itt<F>::call(_f);
# else
static util::itt::string_handle sh("bound");
return sh;
# endif
}
#endif

private:
F _f;
util::detail::member_pack_for<Ts...> _args;
Expand Down Expand Up @@ -229,16 +217,5 @@ namespace pika::detail {
return f.get_function_annotation();
}
};

# if PIKA_HAVE_ITTNOTIFY != 0 && !defined(PIKA_HAVE_APEX)
template <typename F, typename... Ts>
struct get_function_annotation_itt<pika::util::detail::bound<F, Ts...>>
{
static util::itt::string_handle call(pika::util::detail::bound<F, Ts...> const& f) noexcept
{
return f.get_function_annotation_itt();
}
};
# endif
#endif
} // namespace pika::detail
24 changes: 0 additions & 24 deletions libs/pika/functional/include/pika/functional/bind_back.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,6 @@ namespace pika::util::detail {
#endif
}

#if PIKA_HAVE_ITTNOTIFY != 0 && !defined(PIKA_HAVE_APEX)
util::itt::string_handle get_function_annotation_itt() const
{
# if defined(PIKA_HAVE_THREAD_DESCRIPTION)
return pika::detail::get_function_annotation_itt<F>::call(_f);
# else
static util::itt::string_handle sh("bound_back");
return sh;
# endif
}
#endif

private:
F _f;
util::detail::member_pack_for<Ts...> _args;
Expand Down Expand Up @@ -177,17 +165,5 @@ namespace pika::detail {
return f.get_function_annotation();
}
};

# if PIKA_HAVE_ITTNOTIFY != 0 && !defined(PIKA_HAVE_APEX)
template <typename F, typename... Ts>
struct get_function_annotation_itt<pika::util::detail::bound_back<F, Ts...>>
{
static util::itt::string_handle call(
pika::util::detail::bound_back<F, Ts...> const& f) noexcept
{
return f.get_function_annotation_itt();
}
};
# endif
#endif
} // namespace pika::detail
Loading

0 comments on commit a7ca257

Please sign in to comment.