MADNESS  0.10.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
madness::TaskAttributes Class Reference

Contains attributes of a task. More...

#include <thread.h>

Inheritance diagram for madness::TaskAttributes:
Inheritance graph
[legend]

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...
 
void set_generator (bool generator_hint)
 Sets the generator attribute. More...
 
void set_highpriority (bool hipri)
 Sets the high priority attribute. More...
 
void set_nthread (int nthread)
 Set the number of threads. More...
 
void 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...
 

Detailed Description

Contains attributes of a task.

The current attributes are:

Constructor & Destructor Documentation

◆ TaskAttributes() [1/2]

madness::TaskAttributes::TaskAttributes ( unsigned long  flags = 0)
inlineexplicit

Sets the attributes to the desired values.

flags, if unspecified sets all attributes to their default values.

Parameters
[in]flagsThe attribute values.

Referenced by generator(), and hipri().

◆ TaskAttributes() [2/2]

madness::TaskAttributes::TaskAttributes ( const TaskAttributes attr)
inline

Copy constructor.

Parameters
[in]attrThe attributes to copy.

◆ ~TaskAttributes()

virtual madness::TaskAttributes::~TaskAttributes ( )
inlinevirtual

Member Function Documentation

◆ generator()

static TaskAttributes madness::TaskAttributes::generator ( )
inlinestatic
Todo:
Brief description needed.
Todo:
Descriptions needed.
Returns
Description needed.

References TaskAttributes(), and GENERATOR.

Referenced by madness::FunctionImpl< T, NDIM >::truncate_spawn().

◆ get_nthread()

int madness::TaskAttributes::get_nthread ( ) const
inline

Get the number of threads.

Returns
The number of threads.

References flags, and NTHREAD.

Referenced by TestBarrier::TestBarrier(), TimeBarrier::TimeBarrier(), madness::PoolTaskInterface::execute(), and madness::PoolTaskInterface::set_nthread().

◆ hipri()

static TaskAttributes madness::TaskAttributes::hipri ( )
inlinestatic
Todo:
Brief description needed.
Todo:
Descriptions needed.
Returns
Description needed.

References TaskAttributes(), and HIGHPRIORITY.

Referenced by madness::CoeffTracker< T, NDIM >::activate(), madness::FunctionImpl< T, NDIM >::apply_1d_realspace_push_op(), madness::FunctionImpl< R, NDIM >::autorefine_square_test(), 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::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(), madness::FunctionImpl< R, NDIM >::sum_down(), and madness::FunctionImpl< T, NDIM >::truncate_reconstructed_spawn().

◆ is_generator()

bool madness::TaskAttributes::is_generator ( ) const
inline

Test if the generator attribute is true.

Returns
True if this task is a generator, false otherwise.

References flags, and GENERATOR.

◆ is_high_priority()

bool madness::TaskAttributes::is_high_priority ( ) const
inline

Test if the high priority attribute is true.

Returns
True if this task is a high priority, false otherwise.

References flags, and HIGHPRIORITY.

◆ is_stealable()

bool madness::TaskAttributes::is_stealable ( ) const
inline

Test if the stealable attribute is true.

Returns
True if this task is stealable, false otherwise.

References flags, and STEALABLE.

◆ multi_threaded()

static TaskAttributes madness::TaskAttributes::multi_threaded ( int  nthread)
inlinestatic
Todo:
Brief description needed.
Todo:
Descriptions needed.
Returns
Description needed.

References set_nthread().

Referenced by test_multi().

◆ serialize()

template<typename Archive >
void madness::TaskAttributes::serialize ( Archive &  ar)
inline

Serializes the attributes for I/O.

tparam Archive The archive type.

Parameters
[in,out]arThe archive.

References flags.

◆ set_generator()

void madness::TaskAttributes::set_generator ( bool  generator_hint)
inline

Sets the generator attribute.

Parameters
[in]generator_hintThe new value for the generator attribute.

References flags, and GENERATOR.

◆ set_highpriority()

void madness::TaskAttributes::set_highpriority ( bool  hipri)
inline

Sets the high priority attribute.

Parameters
[in]hipriThe new value for the high priority attribute.

References flags, HIGHPRIORITY, and hipri().

◆ set_nthread()

void madness::TaskAttributes::set_nthread ( int  nthread)
inline

Set the number of threads.

Attention
Are you sure this is what you want to call? Only call this for a 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.
Todo:
Perhaps investigate a way to make this function only accessible from the intended functions (using the so-called voodoo)?
Parameters
[in]nthreadThe new number of threads.

References flags, MADNESS_ASSERT, and NTHREAD.

Referenced by multi_threaded(), and madness::PoolTaskInterface::set_nthread().

◆ set_stealable()

void madness::TaskAttributes::set_stealable ( bool  stealable)
inline

Sets the stealable attribute.

Parameters
[in]stealableThe new value for the stealable attribute.

References flags, and STEALABLE.

Referenced by main().

Member Data Documentation

◆ flags

unsigned long madness::TaskAttributes::flags
private

◆ GENERATOR

const unsigned long madness::TaskAttributes::GENERATOR = 1ul<<8
static

Mask for generator bit.

Referenced by generator(), is_generator(), and set_generator().

◆ HIGHPRIORITY

const unsigned long madness::TaskAttributes::HIGHPRIORITY = GENERATOR<<2
static

Mask for priority bit.

Referenced by hipri(), is_high_priority(), and set_highpriority().

◆ NTHREAD

const unsigned long madness::TaskAttributes::NTHREAD = 0xff
static

Mask for nthread byte.

Referenced by get_nthread(), and set_nthread().

◆ STEALABLE

const unsigned long madness::TaskAttributes::STEALABLE = GENERATOR<<1
static

Mask for stealable bit.

Referenced by is_stealable(), and set_stealable().


The documentation for this class was generated from the following file: