MADNESS 0.10.1
madness::MacroTask< taskT >::MacroTaskInternal Class Reference
Inheritance diagram for madness::MacroTask< taskT >::MacroTaskInternal:
Collaboration diagram for madness::MacroTask< taskT >::MacroTaskInternal:

Public Member Functions

 MacroTaskInternal (const taskT &task, const std::pair< Batch, double > &batch_prio, const recordlistT &inputrecords, const recordlistT &outputrecords, const long owner_slot=-1)
template<typename resultT1, std::size_t I = 0>
std::enable_if< is_tuple< resultT1 >::value, void >::type accumulate_into_final_result (World &subworld, resultT1 &final_result, const resultT1 &tmp_result, const argtupleT &argtuple)
 accumulate the result of the task into the final result living in the universe
template<typename resultT1>
std::enable_if< notis_tuple< resultT1 >::value, void >::type accumulate_into_final_result (World &subworld, resultT1 &result, const resultT1 &result_tmp, const argtupleT &argtuple)
 accumulate the result of the task into the final result living in the universe
void cleanup () override
void copy_operands_into_subworld (World &subworld, Cloud &cloud, argtupleT &batched_argtuple, const MacroTaskInfo &policy, const bool debug)
 Bring the operand coefficients into the subworld, unless the task does that itself.
void finalize_stage1 (World &subworld, World *nodeworld, Cloud &) override
void finalize_stage2 (World &subworld, World *nodeworld, Cloud &cloud) override
std::pair< long, MacroTaskInternal * > find_next_owned_task (const MacroTaskBase::taskqT &taskq, const long element) const
 the next task in taskq that this task's subworld also owns, or {-1, nullptr}
std::string get_name () const
resultT get_output (World &subworld, Cloud &cloud) const
 return the WorldObjects or the result functions living in the universe
void prefetch_for_next_task (World &subworld, const argtupleT &argtuple, MacroTaskBase::taskqT &taskq, const long element)
 called by the MacroTaskQ when the task is scheduled
void print_me (std::string s="") const override
void print_me_as_table (std::string s="") const override
void run (World &subworld, Cloud &cloud, MacroTaskBase::taskqT &taskq, const long element, const bool debug, const MacroTaskInfo policy) override
bool wants_node_local_reduction () const override
 Bridge the framework's virtual finalize to the task's hooks.
Public Member Functions inherited from madness::MacroTaskIntermediate< MacroTask >
 MacroTaskIntermediate ()
 ~MacroTaskIntermediate ()
Public Member Functions inherited from madness::MacroTaskBase
 MacroTaskBase ()
virtual ~MacroTaskBase ()
long get_owner_slot () const
double get_priority () const
bool is_complete () const
bool is_owned_by (const long slot) const
 an unowned task may be run by any subworld, an owned one only by its own
bool is_running () const
bool is_waiting () const
std::string print_priority_and_status_to_string () const
void set_complete ()
void set_owner_slot (const long owner)
void set_priority (const double p)
void set_running ()
void set_waiting ()

Static Public Member Functions

template<typename T, std::size_t NDIM>
static Function< T, NDIM > pointer2WorldObject (const std::shared_ptr< FunctionImpl< T, NDIM > > impl)
template<typename T>
static ScalarResult< T > pointer2WorldObject (const std::shared_ptr< ScalarResultImpl< T > > sr_impl)
template<typename T, std::size_t NDIM>
static std::vector< Function< T, NDIM > > pointer2WorldObject (const std::vector< std::shared_ptr< FunctionImpl< T, NDIM > > > v_impl)
template<typename T>
static std::vector< ScalarResult< T > > pointer2WorldObject (const std::vector< std::shared_ptr< ScalarResultImpl< T > > > v_sr_impl)

Public Attributes

taskT task
Public Attributes inherited from madness::MacroTaskBase
long owner_slot =-1
 the subworld that should run this task; -1 means any
double priority =1.0
enum madness::MacroTaskBase::Status stat =Unknown

Private Types

typedef decay_tuple< typename taskT::argtupleT > argtupleT
typedef taskT::resultT resultT

Private Attributes

recordlistT inputrecords
recordlistT outputrecords

Additional Inherited Members

Public Types inherited from madness::MacroTaskBase
enum  Status { Running , Waiting , Complete , Unknown }
typedef std::vector< std::shared_ptr< MacroTaskBase > > taskqT

Member Typedef Documentation

◆ argtupleT

template<typename taskT>
typedef decay_tuple<typename taskT::argtupleT> madness::MacroTask< taskT >::MacroTaskInternal::argtupleT
private

◆ resultT

template<typename taskT>
typedef taskT::resultT madness::MacroTask< taskT >::MacroTaskInternal::resultT
private

Constructor & Destructor Documentation

◆ MacroTaskInternal()

template<typename taskT>
madness::MacroTask< taskT >::MacroTaskInternal::MacroTaskInternal ( const taskT & task,
const std::pair< Batch, double > & batch_prio,
const recordlistT & inputrecords,
const recordlistT & outputrecords,
const long owner_slot = -1 )
inline

Member Function Documentation

◆ accumulate_into_final_result() [1/2]

template<typename taskT>
template<typename resultT1, std::size_t I = 0>
std::enable_if< is_tuple< resultT1 >::value, void >::type madness::MacroTask< taskT >::MacroTaskInternal::accumulate_into_final_result ( World & subworld,
resultT1 & final_result,
const resultT1 & tmp_result,
const argtupleT & argtuple )
inline

accumulate the result of the task into the final result living in the universe

References accumulate_into_final_result(), and I.

Referenced by accumulate_into_final_result(), and run().

◆ accumulate_into_final_result() [2/2]

template<typename taskT>
template<typename resultT1>
std::enable_if< notis_tuple< resultT1 >::value, void >::type madness::MacroTask< taskT >::MacroTaskInternal::accumulate_into_final_result ( World & subworld,
resultT1 & result,
const resultT1 & result_tmp,
const argtupleT & argtuple )
inline

accumulate the result of the task into the final result living in the universe

References madness::change_tree_state(), madness::compressed, madness::gaxpy(), madness::reconstructed, and madness::TT_FULL.

◆ cleanup()

template<typename taskT>
void madness::MacroTask< taskT >::MacroTaskInternal::cleanup ( )
inlineoverridevirtual

Reimplemented from madness::MacroTaskIntermediate< MacroTask >.

References task.

◆ copy_operands_into_subworld()

template<typename taskT>
void madness::MacroTask< taskT >::MacroTaskInternal::copy_operands_into_subworld ( World & subworld,
Cloud & cloud,
argtupleT & batched_argtuple,
const MacroTaskInfo & policy,
const bool debug )
inline

◆ finalize_stage1()

template<typename taskT>
void madness::MacroTask< taskT >::MacroTaskInternal::finalize_stage1 ( World & subworld,
World * nodeworld,
Cloud &  )
inlineoverridevirtual

◆ finalize_stage2()

template<typename taskT>
void madness::MacroTask< taskT >::MacroTaskInternal::finalize_stage2 ( World & subworld,
World * nodeworld,
Cloud & cloud )
inlineoverridevirtual

◆ find_next_owned_task()

template<typename taskT>
std::pair< long, MacroTaskInternal * > madness::MacroTask< taskT >::MacroTaskInternal::find_next_owned_task ( const MacroTaskBase::taskqT & taskq,
const long element ) const
inline

the next task in taskq that this task's subworld also owns, or {-1, nullptr}

A task that prefetches needs to know which batch it will be asked for next. With owner-pinned scheduling that is decidable locally: the queue order is fixed and ownership is already assigned, so the next owned entry is just the next match.

References madness::MacroTaskBase::get_owner_slot(), madness::MacroTaskBase::is_owned_by(), and madness::MacroTaskBase::owner_slot.

Referenced by prefetch_for_next_task().

◆ get_name()

template<typename taskT>
std::string madness::MacroTask< taskT >::MacroTaskInternal::get_name ( ) const
inline

◆ get_output()

template<typename taskT>
resultT madness::MacroTask< taskT >::MacroTaskInternal::get_output ( World & subworld,
Cloud & cloud ) const
inline

return the WorldObjects or the result functions living in the universe

read the pointers to the universe WorldObjects from the cloud, convert them to actual WorldObjects and return them

References madness::check_tuple_is_valid_task_result(), madness::Cloud::consuming_load(), doit(), MADNESS_EXCEPTION, pointer2WorldObject(), and madness::unary_tuple_loop().

Referenced by finalize_stage2(), and run().

◆ pointer2WorldObject() [1/4]

template<typename taskT>
template<typename T, std::size_t NDIM>
Function< T, NDIM > madness::MacroTask< taskT >::MacroTaskInternal::pointer2WorldObject ( const std::shared_ptr< FunctionImpl< T, NDIM > > impl)
inlinestatic

◆ pointer2WorldObject() [2/4]

template<typename taskT>
template<typename T>
ScalarResult< T > madness::MacroTask< taskT >::MacroTaskInternal::pointer2WorldObject ( const std::shared_ptr< ScalarResultImpl< T > > sr_impl)
inlinestatic

◆ pointer2WorldObject() [3/4]

template<typename taskT>
template<typename T, std::size_t NDIM>
std::vector< Function< T, NDIM > > madness::MacroTask< taskT >::MacroTaskInternal::pointer2WorldObject ( const std::vector< std::shared_ptr< FunctionImpl< T, NDIM > > > v_impl)
inlinestatic

References madness::set_impl().

◆ pointer2WorldObject() [4/4]

template<typename taskT>
template<typename T>
std::vector< ScalarResult< T > > madness::MacroTask< taskT >::MacroTaskInternal::pointer2WorldObject ( const std::vector< std::shared_ptr< ScalarResultImpl< T > > > v_sr_impl)
inlinestatic

◆ prefetch_for_next_task()

template<typename taskT>
void madness::MacroTask< taskT >::MacroTaskInternal::prefetch_for_next_task ( World & subworld,
const argtupleT & argtuple,
MacroTaskBase::taskqT & taskq,
const long element )
inline

called by the MacroTaskQ when the task is scheduled

Let this task start the transfer its successor will need. Called before the task body so the request overlaps this task's compute. The successor is the next task in the queue this rank owns; a task that declares no prefetch hook does nothing here.

References find_next_owned_task(), madness::MacroTask< taskT >::has_sym_pipeline_advance_v, and task.

Referenced by run().

◆ print_me()

template<typename taskT>
void madness::MacroTask< taskT >::MacroTaskInternal::print_me ( std::string s = "") const
inlineoverridevirtual

Reimplemented from madness::MacroTaskBase.

References get_name(), madness::print(), and task.

◆ print_me_as_table()

template<typename taskT>
void madness::MacroTask< taskT >::MacroTaskInternal::print_me_as_table ( std::string s = "") const
inlineoverridevirtual

◆ run()

◆ wants_node_local_reduction()

template<typename taskT>
bool madness::MacroTask< taskT >::MacroTaskInternal::wants_node_local_reduction ( ) const
inlineoverridevirtual

Bridge the framework's virtual finalize to the task's hooks.

A task that does not accumulate its own output has nothing to finalize, so the guard keeps every existing task on the queue's own accumulation path.

Reimplemented from madness::MacroTaskBase.

References madness::MacroTask< taskT >::has_wants_node_local_reduction_v, and task.

Member Data Documentation

◆ inputrecords

template<typename taskT>
recordlistT madness::MacroTask< taskT >::MacroTaskInternal::inputrecords
private

Referenced by MacroTaskInternal(), and run().

◆ outputrecords

template<typename taskT>
recordlistT madness::MacroTask< taskT >::MacroTaskInternal::outputrecords
private

Referenced by MacroTaskInternal().

◆ task


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