Commit 8834481a by Winter Committed by Marcus Winter

tasks_cpp: add function to query for the maximum number of queues

parent f0088aa7
...@@ -120,6 +120,15 @@ class Node { ...@@ -120,6 +120,15 @@ class Node {
static void Finalize(); static void Finalize();
/** /**
* Returns the number of available queues.
* \return The number of available queues
* \waitfree
*/
mtapi_uint_t GetQueueCount() const {
return queue_count_;
}
/**
* Returns the number of available cores. * Returns the number of available cores.
* \return The number of available cores * \return The number of available cores
* \waitfree * \waitfree
...@@ -218,6 +227,7 @@ class Node { ...@@ -218,6 +227,7 @@ class Node {
mtapi_size_t node_local_data_size, mtapi_size_t node_local_data_size,
mtapi_task_context_t * context); mtapi_task_context_t * context);
mtapi_uint_t queue_count_;
mtapi_uint_t core_count_; mtapi_uint_t core_count_;
mtapi_uint_t worker_thread_count_; mtapi_uint_t worker_thread_count_;
mtapi_action_hndl_t action_handle_; mtapi_action_hndl_t action_handle_;
......
...@@ -74,6 +74,8 @@ Node::Node( ...@@ -74,6 +74,8 @@ Node::Node(
EMBB_THROW(embb::base::ErrorException, EMBB_THROW(embb::base::ErrorException,
"mtapi::Node could not initialize mtapi"); "mtapi::Node could not initialize mtapi");
} }
mtapi_node_get_attribute(node_id, MTAPI_NODE_MAX_QUEUES, &queue_count_, sizeof(queue_count_), &status);
assert(MTAPI_SUCCESS == status);
core_count_ = info.hardware_concurrency; core_count_ = info.hardware_concurrency;
worker_thread_count_ = embb_core_set_count(&attr->core_affinity); worker_thread_count_ = embb_core_set_count(&attr->core_affinity);
action_handle_ = mtapi_action_create(TASKS_CPP_JOB, action_func, action_handle_ = mtapi_action_create(TASKS_CPP_JOB, action_func,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment