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

Remove all locality-related functions and files #823

Merged
merged 1 commit into from
Oct 26, 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
2 changes: 1 addition & 1 deletion .cmake-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@
"kwargs": {
"ARGS": "+",
"EXECUTABLE": 1,
"LOCALITIES": 1,
"RANKS": 1,
},
"pargs": {"flags": ["FAILURE_EXPECTED"], "nargs": "2+"},
},
Expand Down
8 changes: 4 additions & 4 deletions cmake/pika_add_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ endif()

function(pika_add_test category name)
set(options FAILURE_EXPECTED RUN_SERIAL TESTING PERFORMANCE_TESTING VALGRIND)
set(one_value_args EXECUTABLE LOCALITIES THREADS TIMEOUT RUNWRAPPER)
set(one_value_args EXECUTABLE RANKS THREADS TIMEOUT RUNWRAPPER)
set(multi_value_args ARGS)
cmake_parse_arguments(
${name} "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}
)

if(NOT ${name}_LOCALITIES)
set(${name}_LOCALITIES 1)
if(NOT ${name}_RANKS)
set(${name}_RANKS 1)
endif()

if(NOT ${name}_THREADS)
Expand Down Expand Up @@ -78,7 +78,7 @@ function(pika_add_test category name)
set(_preflags_list_ ${MPIEXEC_PREFLAGS})
separate_arguments(_preflags_list_)
list(PREPEND cmd "${MPIEXEC_EXECUTABLE}" "${MPIEXEC_NUMPROC_FLAG}"
"${${name}_LOCALITIES}" ${_preflags_list_}
"${${name}_RANKS}" ${_preflags_list_}
)
endif()

Expand Down
19 changes: 0 additions & 19 deletions examples/1d_stencil/print_time_results.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,6 @@
#include <stdexcept>
#include <string>

///////////////////////////////////////////////////////////////////////////////
void print_time_results(std::uint32_t num_localities, std::uint64_t num_os_threads,
double elapsed_seconds, std::uint64_t nx, std::uint64_t np, std::uint64_t nt, bool header)
{
if (header)
std::cout << "Localities,OS_Threads,Execution_Time_sec,Points_per_Partition,Partitions,"
"Time_Steps\n"
<< std::flush;

std::string const locs_str = fmt::format("{},", num_localities);
std::string const threads_str = fmt::format("{},", num_os_threads);
std::string const nx_str = fmt::format("{},", nx);
std::string const np_str = fmt::format("{},", np);
std::string const nt_str = fmt::format("{} ", nt);

fmt::print(std::cout, "{:6} {:6} {:.14g}, {:21} {:21} {:21}\n", locs_str, threads_str,
elapsed_seconds, nx_str, np_str, nt_str);
}

///////////////////////////////////////////////////////////////////////////////
void print_time_results(std::uint64_t num_os_threads, double elapsed_seconds, std::uint64_t nx,
std::uint64_t np, std::uint64_t nt, bool header)
Expand Down
6 changes: 3 additions & 3 deletions libs/pika/async_mpi/tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ set(tests # algorithm_transform_mpi
set(mpi_ring_async_sender_receiver_PARAMETERS
ARGS "--in-flight-limit=32" "--rounds=10" "--iterations=100"
"--pika:ignore-process-mask"
THREADS 4 LOCALITIES 2 RUNWRAPPER mpi
THREADS 4 RANKS 2 RUNWRAPPER mpi
)

set(mpi_async_storage_PARAMETERS
ARGS "--in-flight-limit=256" "--localMB=256" "--transferKB=1024" "--seconds=1"
"--pika:ignore-process-mask"
THREADS 4 LOCALITIES 2 RUNWRAPPER mpi
THREADS 4 RANKS 2 RUNWRAPPER mpi
)
# cmake-format: on

set(algorithm_transform_mpi_PARAMETERS LOCALITIES 2 RUNWRAPPER mpi)
set(algorithm_transform_mpi_PARAMETERS RANKS 2 RUNWRAPPER mpi)
set(algorithm_transform_mpi_DEPENDENCIES pika_execution_test_utilities)

foreach(test ${tests})
Expand Down
8 changes: 4 additions & 4 deletions libs/pika/async_mpi/tests/unit/mpi_async_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static pika::debug::detail::print_threshold<Level, debug_level> nws_deb("STORAGE

//----------------------------------------------------------------------------
//
// Each locality allocates a buffer of memory which is used to host transfers
// Each rank allocates a buffer of memory which is used to host transfers
//
using local_storage_type = std::vector<char>;
static local_storage_type local_send_storage;
Expand Down Expand Up @@ -335,7 +335,7 @@ void test_send_recv(std::uint32_t rank, std::uint32_t nranks, std::mt19937& gen,
}

//----------------------------------------------------------------------------
// Main test loop which randomly sends packets of data from one locality to
// Main test loop which randomly sends packets of data from one rank to
// another looping over the entire buffer address space and timing the total
// transmit/receive time to see how well we're doing.
int pika_main(pika::program_options::variables_map& vm)
Expand All @@ -359,8 +359,8 @@ int pika_main(pika::program_options::variables_map& vm)
if (rank == 0)
{
constexpr char const* msg =
"hello world from OS-thread {:02} on locality {:04} rank {:04} hostname {}\n\n";
fmt::print(std::cout, msg, current, pika::get_locality_id(), rank, name.c_str());
"hello world from OS-thread {:02} on rank {:04} hostname {}\n\n";
fmt::print(std::cout, msg, current, rank, name.c_str());
}

// extract command line argument
Expand Down
8 changes: 4 additions & 4 deletions libs/pika/command_line_handling/src/parse_command_line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,12 @@ namespace pika::detail {
"print to the console the bit masks calculated from the "
"arguments specified to all --pika:bind options.")
("pika:threads", value<std::string>(),
"the number of operating system threads to spawn for this pika "
"locality (default: 1, using 'all' will spawn one thread for "
"the number of operating system threads to spawn for the pika "
"runtime (default: cores, using 'all' will spawn one thread for "
"each processing unit")
("pika:cores", value<std::string>(),
"the number of cores to utilize for this pika "
"locality (default: 'all', i.e. the number of cores is based on "
"the number of cores to utilize for the pika "
"runtime (default: 'all', i.e. the number of cores is based on "
"the number of total cores in the system)")
("pika:queuing", value<std::string>(),
"the queue scheduling policy to use, options are "
Expand Down
6 changes: 2 additions & 4 deletions libs/pika/errors/include/pika/errors/exception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,8 @@ namespace pika {
/// can be one of the following types: \a pika::exception,
/// \a pika::error_code, or \a std::exception_ptr.
///
/// \returns The error value code of the locality where the exception was
/// thrown. If the exception instance does not hold
/// this information, the function will return
/// \a pika::naming#invalid_locality_id.
/// \returns The error value code of the process where the exception was
/// thrown.
///
/// \throws nothing
///
Expand Down
2 changes: 1 addition & 1 deletion libs/pika/errors/include/pika/errors/throw_exception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ namespace pika {
/// The purpose of this macro is to prepend the source file name and line number
/// of the position where the exception is thrown to the error message.
/// Moreover, this associates additional diagnostic information with the
/// exception, such as file name and line number, locality id and thread id,
/// exception, such as file name and line number, thread id,
/// and stack backtrace from the point where the exception was thrown.
///
/// The parameter \p errcode holds the pika::error code the new exception should
Expand Down
43 changes: 0 additions & 43 deletions libs/pika/init_runtime/src/init_logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#if defined(PIKA_HAVE_LOGGING)
# include <pika/assert.hpp>
# include <pika/init_runtime/detail/init_logging.hpp>
# include <pika/runtime/get_locality_id.hpp>
# include <pika/runtime/get_worker_thread_num.hpp>
# include <pika/runtime_configuration/runtime_configuration.hpp>
# include <pika/threading_base/thread_data.hpp>
Expand Down Expand Up @@ -44,26 +43,6 @@ namespace pika::detail {
}
};

///////////////////////////////////////////////////////////////////////////
// custom formatter: locality prefix
struct locality_prefix : pika::util::logging::formatter::manipulator
{
void operator()(std::ostream& to) const override
{
std::uint32_t locality_id = pika::get_locality_id();

if (~static_cast<std::uint32_t>(0) != locality_id)
{
fmt::print(to, "{:08x}", locality_id);
}
else
{
// called from outside a pika thread
to << std::string(8, '-');
}
}
};

///////////////////////////////////////////////////////////////////////////
// custom formatter: pika thread id
struct thread_id : pika::util::logging::formatter::manipulator
Expand Down Expand Up @@ -111,26 +90,6 @@ namespace pika::detail {
}
};

///////////////////////////////////////////////////////////////////////////
// custom formatter: locality prefix of parent thread
struct parent_thread_locality : pika::util::logging::formatter::manipulator
{
void operator()(std::ostream& to) const override
{
std::uint32_t parent_locality_id = threads::detail::get_parent_locality_id();
if (~static_cast<std::uint32_t>(0) != parent_locality_id)
{
// called from inside a pika thread
fmt::print(to, "{:08x}", parent_locality_id);
}
else
{
// called from outside a pika thread
to << std::string(8, '-');
}
}
};

///////////////////////////////////////////////////////////////////////////
// custom formatter: pika parent thread id
struct parent_thread_id : pika::util::logging::formatter::manipulator
Expand Down Expand Up @@ -258,12 +217,10 @@ namespace pika::detail {
void define_common_formatters(logger_writer_type& writer)
{
writer.set_formatter("osthread", shepherd_thread_id());
writer.set_formatter("locality", locality_prefix());
writer.set_formatter("pikathread", thread_id());
writer.set_formatter("pikaphase", thread_phase());
writer.set_formatter("pikaparent", parent_thread_id());
writer.set_formatter("pikaparentphase", parent_thread_phase());
writer.set_formatter("parentloc", parent_thread_locality());
}

void define_formatters_local(logger_writer_type& writer)
Expand Down
2 changes: 0 additions & 2 deletions libs/pika/init_runtime/src/init_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <pika/runtime/config_entry.hpp>
#include <pika/runtime/custom_exception_info.hpp>
#include <pika/runtime/debugging.hpp>
#include <pika/runtime/get_locality_id.hpp>
#include <pika/runtime/runtime.hpp>
#include <pika/runtime/runtime_handlers.hpp>
#include <pika/runtime/shutdown_function.hpp>
Expand Down Expand Up @@ -417,7 +416,6 @@ namespace pika {
}

pika::threads::detail::set_get_default_pool(&pika::detail::get_default_pool);
pika::threads::detail::set_get_locality_id(&get_locality_id);
pika::parallel::execution::detail::set_get_pu_mask(&pika::detail::get_pu_mask);
pika::parallel::execution::detail::set_get_os_thread_count(
[]() { return pika::get_os_thread_count(); });
Expand Down
4 changes: 0 additions & 4 deletions libs/pika/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ set(runtime_headers
pika/runtime/custom_exception_info.hpp
pika/runtime/debugging.hpp
pika/runtime/detail/runtime_fwd.hpp
pika/runtime/get_locality_id.hpp
pika/runtime/get_locality_name.hpp
pika/runtime/get_num_all_localities.hpp
pika/runtime/get_os_thread_count.hpp
pika/runtime/get_thread_name.hpp
pika/runtime/get_worker_thread_num.hpp
Expand All @@ -34,7 +31,6 @@ set(runtime_headers
set(runtime_sources
custom_exception_info.cpp
debugging.cpp
get_locality_name.cpp
os_thread_type.cpp
runtime_handlers.cpp
runtime.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ namespace pika {
/// \cond NODETAIL
namespace detail {
///////////////////////////////////////////////////////////////////////
// Stores the information about the locality id the exception has been
// raised on. This information will show up in error messages under the
// [locality] tag.
PIKA_DEFINE_ERROR_INFO(throw_locality, std::uint32_t);

// Stores the information about the hostname of the locality the exception
// Stores the information about the hostname of the process the exception
// has been raised on. This information will show up in error messages
// under the [hostname] tag.
PIKA_DEFINE_ERROR_INFO(throw_hostname, std::string);
Expand Down Expand Up @@ -61,12 +56,12 @@ namespace pika {
// messages under the [stack_trace] tag.
PIKA_DEFINE_ERROR_INFO(throw_stacktrace, std::string);

// Stores the full execution environment of the locality the exception
// Stores the full execution environment of the process the exception
// has been raised in. This information will show up in error messages
// under the [env] tag.
PIKA_DEFINE_ERROR_INFO(throw_env, std::string);

// Stores the full pika configuration information of the locality the
// Stores the full pika configuration information of the process the
// exception has been raised in. This information will show up in error
// messages under the [config] tag.
PIKA_DEFINE_ERROR_INFO(throw_config, std::string);
Expand Down Expand Up @@ -128,7 +123,7 @@ namespace pika {
/// formatted string. This simplifies debug output as it composes the
/// diagnostics into one, easy to use function call. This includes
/// the name of the source file and line number, the sequence number of the
/// OS-thread and the pika-thread id, the locality id and the stack backtrace
/// OS-thread and the pika-thread id and the stack backtrace
/// of the point where the original exception was thrown.
///
/// \param xi The parameter \p e will be inspected for all diagnostic
Expand All @@ -145,7 +140,7 @@ namespace pika {
/// \throws std#bad_alloc (if any of the required allocation operations
/// fail)
///
/// \see \a pika::get_error_locality_id(), \a pika::get_error_host_name(),
/// \see \a pika::get_error_host_name(),
/// \a pika::get_error_process_id(), \a pika::get_error_function_name(),
/// \a pika::get_error_file_name(), \a pika::get_error_line_number(),
/// \a pika::get_error_os_thread(), \a pika::get_error_thread_id(),
Expand All @@ -170,48 +165,7 @@ namespace pika {
// Extract elements of the diagnostic information embedded in the given
// exception.

/// \brief Return the locality id where the exception was thrown.
///
/// The function \a pika::get_error_locality_id can be used to extract the
/// diagnostic information element representing the locality id as stored
/// in the given exception instance.
///
/// \param xi The parameter \p e will be inspected for the requested
/// diagnostic information elements which have been stored at
/// the point where the exception was thrown. This parameter
/// can be one of the following types: \a pika::exception_info,
/// \a pika::error_code, \a std::exception, or
/// \a std::exception_ptr.
///
/// \returns The locality id of the locality where the exception was
/// thrown. If the exception instance does not hold
/// this information, the function will return
/// \a pika::naming#invalid_locality_id.
///
/// \throws nothing
///
/// \see \a pika::diagnostic_information(), \a pika::get_error_host_name(),
/// \a pika::get_error_process_id(), \a pika::get_error_function_name(),
/// \a pika::get_error_file_name(), \a pika::get_error_line_number(),
/// \a pika::get_error_os_thread(), \a pika::get_error_thread_id(),
/// \a pika::get_error_thread_description(), \a pika::get_error(),
/// \a pika::get_error_backtrace(), \a pika::get_error_env(),
/// \a pika::get_error_what(), \a pika::get_error_config(),
/// \a pika::get_error_state()
///
PIKA_EXPORT std::uint32_t get_error_locality_id(pika::exception_info const& xi);

/// \cond NOINTERNAL
template <typename E>
std::uint32_t get_error_locality_id(E const& e)
{
return invoke_with_exception_info(e, [](exception_info const* xi) {
return xi ? get_error_locality_id(*xi) : ~static_cast<std::uint32_t>(0);
});
}
/// \endcond

/// \brief Return the hostname of the locality where the exception was
/// \brief Return the hostname of the process where the exception was
/// thrown.
///
/// The function \a pika::get_error_host_name can be used to extract the
Expand All @@ -225,7 +179,7 @@ namespace pika {
/// \a pika::error_code, \a std::exception, or
/// \a std::exception_ptr.
///
/// \returns The hostname of the locality where the exception was
/// \returns The hostname of the process where the exception was
/// thrown. If the exception instance does not hold
/// this information, the function will return and empty string.
///
Expand All @@ -251,7 +205,7 @@ namespace pika {
}
/// \endcond

/// \brief Return the (operating system) process id of the locality where
/// \brief Return the (operating system) process id of the process where
/// the exception was thrown.
///
/// The function \a pika::get_error_process_id can be used to extract the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,4 @@ namespace pika {
/// specific) runtime instance.
PIKA_EXPORT runtime& get_runtime();
PIKA_EXPORT runtime*& get_runtime_ptr();

/// Return true if networking is enabled.
///
/// \note Networking is enabled if `-DPIKA_WITH_NETWORKING=On` was used at
/// configuration time and more than one locality is used or the
/// command line option `--pika:expect-connecting-localities` was
/// specified
PIKA_EXPORT bool is_networking_enabled();
} // namespace pika
Loading