Permalink
Browse files

Fixing more size_t -> int16_t (and similar) warnings

  • Loading branch information...
hkaiser committed Sep 12, 2018
1 parent a450028 commit 764f535f1f9a5789816129fef1f4e4c469ea6b99
@@ -201,10 +201,12 @@ namespace hpx { namespace lcos { namespace local
return threads::register_thread_nullary(
util::deferred_call(
&base_type::run_impl, std::move(this_)),
util::thread_description(this->f_, "task_object::apply"),
util::thread_description(
this->f_, "task_object::apply"),
threads::pending_do_not_schedule, true,
threads::thread_priority_boost,
threads::thread_schedule_hint(get_worker_thread_num()),
threads::thread_schedule_hint(
static_cast<std::int16_t>(get_worker_thread_num())),
stacksize, ec);
}
else {
@@ -703,9 +703,11 @@ namespace hpx { namespace threads { namespace detail
thread_state_ex_enum new_state_ex, thread_priority priority,
error_code& ec)
{
return detail::set_thread_state(id, new_state, //-V107
return detail::set_thread_state(id, new_state, //-V107
new_state_ex, priority,
thread_schedule_hint(get_worker_thread_num()), ec);
thread_schedule_hint(
static_cast<std::int16_t>(get_worker_thread_num())),
ec);
}
template <typename Scheduler>
@@ -716,7 +718,9 @@ namespace hpx { namespace threads { namespace detail
{
return detail::set_thread_state_timed(*sched_, abs_time, id, newstate,
newstate_ex, priority,
thread_schedule_hint(get_worker_thread_num()), nullptr, ec);
thread_schedule_hint(
static_cast<std::int16_t>(get_worker_thread_num())),
nullptr, ec);
}
///////////////////////////////////////////////////////////////////////////
@@ -519,7 +519,8 @@ namespace hpx { namespace threads { namespace detail
{
next->get_scheduler_base()->schedule_thread(
next,
threads::thread_schedule_hint(num_thread),
threads::thread_schedule_hint(
static_cast<std::int16_t>(num_thread)),
true);
}
}
@@ -593,9 +594,10 @@ namespace hpx { namespace threads { namespace detail
num_thread < params.max_background_threads_ &&
!params.background_.empty())
{
background_thread = create_background_thread(scheduler, params,
background_running,
thread_schedule_hint(num_thread), idle_loop_count);
background_thread =
create_background_thread(scheduler, params, background_running,
thread_schedule_hint(static_cast<std::int16_t>(num_thread)),
idle_loop_count);
}
#endif
@@ -736,7 +738,9 @@ namespace hpx { namespace threads { namespace detail
// schedule this thread again, make sure it ends up at
// the end of the queue
scheduler.SchedulingPolicy::schedule_thread_last(thrd,
threads::thread_schedule_hint(num_thread), true);
threads::thread_schedule_hint(
static_cast<std::int16_t>(num_thread)),
true);
scheduler.SchedulingPolicy::do_some_work(num_thread);
}
else if (HPX_UNLIKELY(state_val == pending_boost))
@@ -762,7 +766,8 @@ namespace hpx { namespace threads { namespace detail
// boosted priority
scheduler.SchedulingPolicy::schedule_thread(
thrd,
threads::thread_schedule_hint(num_thread),
threads::thread_schedule_hint(
static_cast<std::int16_t>(num_thread)),
true,
thread_priority_boost);
scheduler.SchedulingPolicy::do_some_work(
@@ -773,10 +778,10 @@ namespace hpx { namespace threads { namespace detail
{
// schedule this thread again immediately with
// boosted priority
scheduler.SchedulingPolicy::schedule_thread(
thrd, threads::thread_schedule_hint(num_thread),
true,
thread_priority_boost);
scheduler.SchedulingPolicy::schedule_thread(thrd,
threads::thread_schedule_hint(
static_cast<std::int16_t>(num_thread)),
true, thread_priority_boost);
scheduler.SchedulingPolicy::do_some_work(
num_thread);
}
@@ -793,8 +798,9 @@ namespace hpx { namespace threads { namespace detail
// scheduler queue already but the state has not been reset
// yet
scheduler.SchedulingPolicy::schedule_thread(thrd,
threads::thread_schedule_hint(num_thread), true,
thrd->get_priority());
threads::thread_schedule_hint(
static_cast<std::int16_t>(num_thread)),
true, thrd->get_priority());
}
// Remove the mapping from thread_map_ if HPX thread is depleted
@@ -855,7 +861,8 @@ namespace hpx { namespace threads { namespace detail
scheduler.SchedulingPolicy::schedule_thread(
background_thread.get(),
threads::thread_schedule_hint(
num_thread),
static_cast<std::int16_t>(
num_thread)),
true,
background_thread->get_priority());
background_thread.reset();
@@ -900,9 +907,11 @@ namespace hpx { namespace threads { namespace detail
// Create a new one which will replace the current such we
// avoid deadlock situations, if all background threads are
// blocked.
background_thread = create_background_thread(scheduler, params,
background_running,
thread_schedule_hint(num_thread), idle_loop_count);
background_thread = create_background_thread(scheduler,
params, background_running,
thread_schedule_hint(
static_cast<std::int16_t>(num_thread)),
idle_loop_count);
}
#endif
@@ -941,9 +950,11 @@ namespace hpx { namespace threads { namespace detail
// Create a new one which will replace the current such we
// avoid deadlock situations, if all background threads are
// blocked.
background_thread = create_background_thread(scheduler, params,
background_running,
thread_schedule_hint(num_thread), idle_loop_count);
background_thread = create_background_thread(scheduler,
params, background_running,
thread_schedule_hint(
static_cast<std::int16_t>(num_thread)),
idle_loop_count);
}
#endif
@@ -972,8 +983,9 @@ namespace hpx { namespace threads { namespace detail
decrement_background_thread_count();
scheduler.SchedulingPolicy::schedule_thread(
background_thread.get(),
threads::thread_schedule_hint(num_thread), true,
background_thread->get_priority());
threads::thread_schedule_hint(
static_cast<std::int16_t>(num_thread)),
true, background_thread->get_priority());
background_thread.reset();
background_running.reset();
}
@@ -1163,19 +1163,23 @@ namespace policies {
}
// create queue sets for each numa domain
for (std::size_t i=0; i<num_domains_; ++i) {
int queues = (std::max)(q_counts_[i] / cores_per_queue_.high_priority,
for (std::size_t i = 0; i < num_domains_; ++i)
{
std::size_t queues = (std::max)(
q_counts_[i] / cores_per_queue_.high_priority,
std::size_t(1));
hp_queues_[i].init(
q_counts_[i], queues, max_queue_thread_count_);
queues = (std::max)(q_counts_[i] / cores_per_queue_.normal_priority,
queues = (std::max)(
q_counts_[i] / cores_per_queue_.normal_priority,
std::size_t(1));
np_queues_[i].init(
q_counts_[i], queues, max_queue_thread_count_);
queues = (std::max)(q_counts_[i] / cores_per_queue_.low_priority,
std::size_t(1));
queues =
(std::max)(q_counts_[i] / cores_per_queue_.low_priority,
std::size_t(1));
lp_queues_[i].init(
q_counts_[i], queues, max_queue_thread_count_);
}
@@ -73,7 +73,8 @@ namespace hpx { namespace threads { namespace executors { namespace detail
register_thread_nullary(std::move(f), desc, initial_state, run_now,
priority_,
threads::thread_schedule_hint(get_next_thread_num()),
threads::thread_schedule_hint(
static_cast<std::int16_t>(get_next_thread_num())),
stacksize, ec);
}
@@ -90,10 +91,10 @@ namespace hpx { namespace threads { namespace executors { namespace detail
stacksize = stacksize_;
// create new thread
thread_id_type id = register_thread_nullary(
std::move(f), description, suspended, false,
priority_,
threads::thread_schedule_hint(get_next_thread_num()),
thread_id_type id = register_thread_nullary(std::move(f), description,
suspended, false, priority_,
threads::thread_schedule_hint(
static_cast<std::int16_t>(get_next_thread_num())),
stacksize, ec);
if (ec) return;
@@ -433,13 +433,12 @@ namespace hpx { namespace threads { namespace executors { namespace detail
{
++curr_punits_;
register_thread_nullary(
util::bind(
util::one_shot(&thread_pool_executor::run),
this, virt_core, thread_num
),
util::bind(util::one_shot(&thread_pool_executor::run), this,
virt_core, thread_num),
"thread_pool_executor thread", threads::pending, true,
threads::thread_priority_normal,
threads::thread_schedule_hint(thread_num),
threads::thread_schedule_hint(
static_cast<std::int16_t>(thread_num)),
threads::thread_stacksize_default, ec);
}
}
@@ -60,72 +60,72 @@ namespace hpx { namespace threads { namespace detail
return top.get_number_of_pus();
}
void write_to_log(char const* valuename, std::size_t value)
{
void write_to_log(char const* valuename, std::size_t value)
{
LTM_(debug) << "topology: "
<< valuename << ": " << value; //-V128
}
<< valuename << ": " << value; //-V128
}
void write_to_log_mask(char const* valuename, mask_cref_type value)
{
void write_to_log_mask(char const* valuename, mask_cref_type value)
{
LTM_(debug) << "topology: " << valuename
<< ": " HPX_CPU_MASK_PREFIX
<< std::hex << value;
}
<< ": " HPX_CPU_MASK_PREFIX
<< std::hex << value;
}
void write_to_log(char const* valuename,
std::vector<std::size_t> const& values)
{
void write_to_log(char const* valuename,
std::vector<std::size_t> const& values)
{
LTM_(debug) << "topology: "
<< valuename << "s, size: " //-V128
<< values.size();
<< valuename << "s, size: " //-V128
<< values.size();
std::size_t i = 0;
for (std::size_t value : values)
{
std::size_t i = 0;
for (std::size_t value : values)
{
LTM_(debug) << "topology: " << valuename //-V128
<< "(" << i++ << "): " << value;
}
<< "(" << i++ << "): " << value;
}
}
void write_to_log_mask(char const* valuename,
std::vector<mask_type> const& values)
{
void write_to_log_mask(char const* valuename,
std::vector<mask_type> const& values)
{
LTM_(debug) << "topology: "
<< valuename << "s, size: " //-V128
<< values.size();
<< valuename << "s, size: " //-V128
<< values.size();
std::size_t i = 0;
for (mask_cref_type value : values)
{
std::size_t i = 0;
for (mask_cref_type value : values)
{
LTM_(debug) << "topology: " << valuename //-V128
<< "(" << i++ << "): " HPX_CPU_MASK_PREFIX
<< std::hex << value;
}
<< "(" << i++ << "): " HPX_CPU_MASK_PREFIX
<< std::hex << value;
}
}
std::size_t get_index(hwloc_obj_t obj)
{
// on Windows logical_index is always -1
if (obj->logical_index == ~0x0u)
return static_cast<std::size_t>(obj->os_index);
std::size_t get_index(hwloc_obj_t obj)
{
// on Windows logical_index is always -1
if (obj->logical_index == ~0x0u)
return static_cast<std::size_t>(obj->os_index);
return static_cast<std::size_t>(obj->logical_index);
}
return static_cast<std::size_t>(obj->logical_index);
}
hwloc_obj_t adjust_node_obj(hwloc_obj_t node) noexcept
{
hwloc_obj_t adjust_node_obj(hwloc_obj_t node) noexcept
{
#if HWLOC_API_VERSION >= 0x00020000
// www.open-mpi.org/projects/hwloc/doc/hwloc-v2.0.0-letter.pdf:
// Starting with hwloc v2.0, NUMA nodes are not in the main tree
// anymore. They are attached under objects as Memory Children
// on the side of normal children.
while (hwloc_obj_type_is_memory(node->type))
node = node->parent;
HPX_ASSERT(node);
// www.open-mpi.org/projects/hwloc/doc/hwloc-v2.0.0-letter.pdf:
// Starting with hwloc v2.0, NUMA nodes are not in the main tree
// anymore. They are attached under objects as Memory Children
// on the side of normal children.
while (hwloc_obj_type_is_memory(node->type))
node = node->parent;
HPX_ASSERT(node);
#endif
return node;
}
return node;
}
}}}
namespace hpx { namespace threads
@@ -1310,7 +1310,7 @@ namespace hpx { namespace threads
return -1;
}
threads::mask_type mask = bitmap_to_mask(ns, HWLOC_OBJ_NUMANODE);
return threads::find_first(mask);
return static_cast<int>(threads::find_first(mask));
#else
return 0;
#endif

0 comments on commit 764f535

Please sign in to comment.