Skip to content

Commit

Permalink
Unified threadmanager_base and threadmanager_impl
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Jul 25, 2017
1 parent 60bad95 commit dec1b36
Show file tree
Hide file tree
Showing 25 changed files with 481 additions and 741 deletions.
1 change: 0 additions & 1 deletion examples/balancing/os_thread_num.cpp
Expand Up @@ -23,7 +23,6 @@ using boost::program_options::value;

using hpx::lcos::local::barrier;

using hpx::threads::threadmanager_base;
using hpx::threads::pending;
using hpx::threads::thread_priority_normal;

Expand Down
2 changes: 1 addition & 1 deletion examples/resource_partitioner/system_characteristics.h
Expand Up @@ -22,7 +22,7 @@ void print_system_characteristics()
hpx::runtime* rt = hpx::get_runtime_ptr();
hpx::util::runtime_configuration cfg = rt->get_config();
const hpx::threads::topology& topo = rt->get_topology();
hpx::threads::threadmanager_base& thrd_manager = rt->get_thread_manager();
hpx::threads::threadmanager& thrd_manager = rt->get_thread_manager();

// -------------------------------------- //
// print runtime characteristics //
Expand Down
2 changes: 1 addition & 1 deletion hpx/runtime.hpp
Expand Up @@ -191,7 +191,7 @@ namespace hpx
virtual parcelset::parcelhandler& get_parcel_handler() = 0;
virtual parcelset::parcelhandler const& get_parcel_handler() const = 0;

virtual threads::threadmanager_base& get_thread_manager() = 0;
virtual threads::threadmanager& get_thread_manager() = 0;

virtual naming::resolver_client& get_agas_client() = 0;

Expand Down
6 changes: 3 additions & 3 deletions hpx/runtime/applier/applier.hpp
Expand Up @@ -39,7 +39,7 @@ namespace hpx { namespace applier

public:
// constructor
applier(parcelset::parcelhandler &ph, threads::threadmanager_base& tm);
applier(parcelset::parcelhandler &ph, threads::threadmanager& tm);

// destructor
~applier()
Expand All @@ -66,7 +66,7 @@ namespace hpx { namespace applier
///
/// This function returns a reference to the thread manager this
/// applier instance has been created with.
threads::threadmanager_base& get_thread_manager();
threads::threadmanager& get_thread_manager();

/// \brief Allow access to the locality of the locality this applier
/// instance is associated with.
Expand Down Expand Up @@ -172,7 +172,7 @@ namespace hpx { namespace applier

private:
parcelset::parcelhandler& parcel_handler_;
threads::threadmanager_base& thread_manager_;
threads::threadmanager& thread_manager_;
naming::id_type runtime_support_id_;
naming::id_type memory_id_;
};
Expand Down
4 changes: 2 additions & 2 deletions hpx/runtime/parcelset/parcelhandler.hpp
Expand Up @@ -99,7 +99,7 @@ namespace hpx { namespace parcelset
/// transport operations the parcelhandler carries out.
parcelhandler(
util::runtime_configuration& cfg,
threads::threadmanager_base* tm,
threads::threadmanager* tm,
util::function_nonser<void(std::size_t, char const*)> const& on_start_thread,
util::function_nonser<void()> const& on_stop_thread);

Expand Down Expand Up @@ -477,7 +477,7 @@ namespace hpx { namespace parcelset
endpoints_type endpoints_;

/// the thread-manager to use (optional)
threads::threadmanager_base* tm_;
threads::threadmanager* tm_;

/// Allow to use alternative parcel-ports (this is enabled only after
/// the runtime systems of all localities are guaranteed to have
Expand Down
52 changes: 25 additions & 27 deletions hpx/runtime/resource_partitioner.hpp
Expand Up @@ -25,6 +25,7 @@
#include <boost/format.hpp>

#include <algorithm>
#include <cstddef>
#include <iosfwd>
#include <stdexcept>
#include <string>
Expand All @@ -38,35 +39,35 @@ namespace resource {

// if the resource partitioner is accessed before the HPX runtime has started
// then on first access, this function should be used, to ensure that command line
// affinity binding options are honoured. Use this function signature only once
// affinity binding options are honored. Use this function signature only once
// and thereafter use the parameter free version.
extern HPX_EXPORT hpx::resource::resource_partitioner &get_resource_partitioner(
int argc, char **argv);
extern HPX_EXPORT hpx::resource::resource_partitioner &get_resource_partitioner(
extern HPX_EXPORT resource::resource_partitioner& get_resource_partitioner(
int argc, char** argv);
extern HPX_EXPORT resource::resource_partitioner& get_resource_partitioner(
boost::program_options::options_description desc_cmdline, int argc,
char **argv, bool check = true);
extern HPX_EXPORT hpx::resource::resource_partitioner &get_resource_partitioner(
int argc, char **argv, std::vector<std::string> ini_config);
extern HPX_EXPORT hpx::resource::resource_partitioner &get_resource_partitioner(
int argc, char **argv, runtime_mode mode);
extern HPX_EXPORT hpx::resource::resource_partitioner &get_resource_partitioner(
char** argv, bool check = true);
extern HPX_EXPORT resource::resource_partitioner& get_resource_partitioner(
int argc, char** argv, std::vector<std::string> ini_config);
extern HPX_EXPORT resource::resource_partitioner& get_resource_partitioner(
int argc, char** argv, runtime_mode mode);
extern HPX_EXPORT resource::resource_partitioner& get_resource_partitioner(
boost::program_options::options_description desc_cmdline, int argc,
char **argv, std::vector<std::string> ini_config);
extern HPX_EXPORT hpx::resource::resource_partitioner &get_resource_partitioner(
char** argv, std::vector<std::string> ini_config);
extern HPX_EXPORT resource::resource_partitioner& get_resource_partitioner(
boost::program_options::options_description desc_cmdline, int argc,
char **argv, runtime_mode mode);
extern HPX_EXPORT hpx::resource::resource_partitioner &get_resource_partitioner(
int argc, char **argv, std::vector<std::string> ini_config,
char** argv, runtime_mode mode);
extern HPX_EXPORT resource::resource_partitioner& get_resource_partitioner(
int argc, char** argv, std::vector<std::string> ini_config,
runtime_mode mode);
extern HPX_EXPORT hpx::resource::resource_partitioner &get_resource_partitioner(
extern HPX_EXPORT resource::resource_partitioner& get_resource_partitioner(
boost::program_options::options_description desc_cmdline, int argc,
char **argv, std::vector<std::string> ini_config, runtime_mode mode,
char** argv, std::vector<std::string> ini_config, runtime_mode mode,
bool check = true);

// may be used anywhere in code and returns a reference to the
// single, global resource partitioner
extern HPX_EXPORT hpx::resource::resource_partitioner &
get_resource_partitioner();
extern HPX_EXPORT hpx::resource::resource_partitioner&
get_resource_partitioner();

namespace resource {

Expand Down Expand Up @@ -239,8 +240,9 @@ namespace resource {
// stuff that has to be done during hpx_init ...
void set_scheduler(
scheduling_policy sched, const std::string &pool_name);
void set_threadmanager(threads::threadmanager_base *thrd_manag);
threads::threadmanager_base *get_thread_manager() const;

void set_threadmanager(threads::threadmanager *thrd_manag);
threads::threadmanager *get_thread_manager() const;

// called by constructor of scheduler_base
threads::policies::detail::affinity_data *get_affinity_data()
Expand All @@ -254,11 +256,7 @@ namespace resource {
void configure_pools();

// called in runtime::assign_cores()
size_t init()
{
thread_manager_->init();
return cores_needed_;
}
std::size_t init();

////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -328,7 +326,7 @@ namespace resource {
std::vector<init_pool_data> initial_thread_pools_;

// pointer to the threadmanager instance
hpx::threads::threadmanager_base *thread_manager_;
hpx::threads::threadmanager *thread_manager_;

// reference to the topology and affinity data
threads::hwloc_topology_info &topology_;
Expand Down
1 change: 0 additions & 1 deletion hpx/runtime/threads/detail/thread_pool_impl.hpp
Expand Up @@ -14,7 +14,6 @@
#include <hpx/runtime/threads/policies/affinity_data.hpp>
#include <hpx/runtime/threads/policies/scheduler_base.hpp>
#include <hpx/runtime/threads/policies/schedulers.hpp>
#include <hpx/runtime/threads/threadmanager_impl.hpp>
#include <hpx/util/high_resolution_clock.hpp>
#include <hpx/util/unlock_guard.hpp>

Expand Down
3 changes: 1 addition & 2 deletions hpx/runtime/threads/executors/customized_pool_executors.hpp
Expand Up @@ -8,12 +8,11 @@

#include <hpx/compat/mutex.hpp>
#include <hpx/runtime/threads/detail/thread_pool.hpp>
#include <hpx/runtime/threads/thread_executor.hpp>
#include <hpx/util/steady_clock.hpp>
#include <hpx/util/thread_description.hpp>
#include <hpx/util/unique_function.hpp>

#include <hpx/runtime/threads/threadmanager_impl.hpp>

#include <string>

#include <hpx/config/warnings_prefix.hpp>
Expand Down
6 changes: 2 additions & 4 deletions hpx/runtime/threads/thread_data_fwd.hpp
Expand Up @@ -32,11 +32,9 @@ namespace hpx
namespace hpx { namespace threads
{
/// \cond NOINTERNAL
struct HPX_EXPORT threadmanager_base;
class HPX_EXPORT threadmanager;
struct HPX_EXPORT topology;

class HPX_EXPORT threadmanager_impl;

class HPX_EXPORT executor;

typedef coroutines::coroutine coroutine_type;
Expand Down Expand Up @@ -123,7 +121,7 @@ namespace hpx { namespace threads
/// \cond NOINTERNAL
// The function get_thread_manager returns a reference to the
// current thread manager.
HPX_API_EXPORT threadmanager_base& get_thread_manager();
HPX_API_EXPORT threadmanager& get_thread_manager();
/// \endcond

/// The function \a get_thread_count returns the number of currently
Expand Down

0 comments on commit dec1b36

Please sign in to comment.