MADNESS
0.10.1
|
Contains attributes of a task. More...
#include <thread.h>
Public Member Functions | |
TaskAttributes (const TaskAttributes &attr) | |
Copy constructor. More... | |
TaskAttributes (unsigned long flags=0) | |
Sets the attributes to the desired values. More... | |
virtual | ~TaskAttributes () |
int | get_nthread () const |
Get the number of threads. More... | |
bool | is_generator () const |
Test if the generator attribute is true. More... | |
bool | is_high_priority () const |
Test if the high priority attribute is true. More... | |
bool | is_stealable () const |
Test if the stealable attribute is true. More... | |
template<typename Archive > | |
void | serialize (Archive &ar) |
Serializes the attributes for I/O. More... | |
TaskAttributes & | set_generator (bool generator_hint) |
Sets the generator attribute. More... | |
TaskAttributes & | set_highpriority (bool hipri) |
Sets the high priority attribute. More... | |
void | set_nthread (int nthread) |
Set the number of threads. More... | |
TaskAttributes & | set_stealable (bool stealable) |
Sets the stealable attribute. More... | |
Static Public Member Functions | |
static TaskAttributes | generator () |
static TaskAttributes | hipri () |
static TaskAttributes | multi_threaded (int nthread) |
Static Public Attributes | |
static const unsigned long | GENERATOR = 1ul<<8 |
Mask for generator bit. More... | |
static const unsigned long | HIGHPRIORITY = GENERATOR<<2 |
Mask for priority bit. More... | |
static const unsigned long | NTHREAD = 0xff |
Mask for nthread byte. More... | |
static const unsigned long | STEALABLE = GENERATOR<<1 |
Mask for stealable bit. More... | |
Private Attributes | |
unsigned long | flags |
Byte-string storing the specified attributes. More... | |
Contains attributes of a task.
The current attributes are:
generator
: Setting this hints that a task will produce additional tasks and is used by the scheduler to increase/throttle parallelism. The default is false.stealable
: Setting this indicates that a task may be migrated to another process for dynamic load balancing. The default value is false.highpriority
: indicates a high priority task. The default value is false.nthread
: indicates number of threads. 0 threads is interpreted as 1 thread for backward compatibility and ease of specifying defaults. The default value is 0 (==1).
|
inlineexplicit |
Sets the attributes to the desired values.
flags
, if unspecified sets all attributes to their default values.
[in] | flags | The attribute values. |
Referenced by generator(), and hipri().
|
inline |
Copy constructor.
[in] | attr | The attributes to copy. |
|
inlinevirtual |
|
inlinestatic |
References TaskAttributes(), and GENERATOR.
Referenced by madness::FunctionImpl< T, NDIM >::truncate_spawn().
|
inline |
Get the number of threads.
References flags, and NTHREAD.
Referenced by TestBarrier::TestBarrier(), TimeBarrier::TimeBarrier(), madness::PoolTaskInterface::execute(), and madness::PoolTaskInterface::set_nthread().
|
inlinestatic |
References TaskAttributes(), and HIGHPRIORITY.
Referenced by madness::CoeffTracker< T, NDIM >::activate(), madness::FunctionImpl< T, NDIM >::apply_1d_realspace_push_op(), madness::WorldGopInterface::bcast_handler(), madness::WorldGopInterface::bcast_internal(), madness::FunctionImpl< T, NDIM >::diff(), madness::FunctionImpl< T, NDIM >::dirac_convolution_op(), madness::FunctionImpl< T, NDIM >::do_apply_kernel(), madness::FunctionImpl< T, NDIM >::do_apply_kernel2(), madness::FunctionImpl< T, NDIM >::do_apply_kernel3(), madness::FunctionImpl< T, NDIM >::do_project_out(), madness::FunctionImpl< T, NDIM >::eval(), madness::FunctionImpl< T, NDIM >::evaldepthpt(), madness::FunctionImpl< T, NDIM >::evalR(), madness::FunctionImpl< T, NDIM >::find_me(), madness::DerivativeBase< T, NDIM >::find_neighbor(), madness::DerivativeBase< T, NDIM >::forward_do_diff1(), madness::FunctionImpl< T, NDIM >::get_norm_tree_recursive(), madness::WorldGopInterface::group_bcast_handler(), madness::WorldGopInterface::lazy_sync(), madness::WorldGopInterface::lazy_sync_internal(), madness::FunctionImpl< T, NDIM >::project_out_op< LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::partial_inner_contract(), madness::FunctionImpl< T, NDIM >::project_out2(), madness::WorldGopInterface::reduce_internal(), madness::FunctionImpl< T, NDIM >::refine(), madness::FunctionImpl< T, NDIM >::refine_spawn(), madness::WorldGopInterface::send_internal(), set_highpriority(), madness::FunctionImpl< T, NDIM >::sock_it_to_me(), madness::FunctionImpl< T, NDIM >::sock_it_to_me_too(), and madness::FunctionImpl< T, NDIM >::truncate_reconstructed_spawn().
|
inline |
|
inline |
Test if the high priority attribute is true.
References flags, and HIGHPRIORITY.
|
inline |
|
inlinestatic |
References set_nthread().
Referenced by test_multi().
|
inline |
Serializes the attributes for I/O.
tparam Archive The archive type.
[in,out] | ar | The archive. |
References flags.
|
inline |
|
inline |
Sets the high priority attribute.
[in] | hipri | The new value for the high priority attribute. |
References flags, HIGHPRIORITY, and hipri().
|
inline |
Set the number of threads.
TaskAttributes
that is not a base class of a task object. If
you are trying to set the number of threads in an existing task you should call TaskInterface::set_nthread()
instead. No doubt there is some virtual/protected/something voodoo to prevent you from doing harm.[in] | nthread | The new number of threads. |
References flags, MADNESS_ASSERT, and NTHREAD.
Referenced by multi_threaded(), and madness::PoolTaskInterface::set_nthread().
|
inline |
|
private |
Byte-string storing the specified attributes.
Referenced by get_nthread(), is_generator(), is_high_priority(), is_stealable(), serialize(), set_generator(), set_highpriority(), set_nthread(), and set_stealable().
|
static |
Mask for generator bit.
Referenced by generator(), is_generator(), and set_generator().
|
static |
Mask for priority bit.
Referenced by hipri(), is_high_priority(), and set_highpriority().
|
static |
Mask for nthread byte.
Referenced by get_nthread(), and set_nthread().
|
static |
Mask for stealable bit.
Referenced by is_stealable(), and set_stealable().