MADNESS  version 0.9
Public Member Functions | List of all members
madness::SystolicMatrixAlgorithm< T > Class Template Referenceabstract

Base class for parallel algorithms that employ a systolic loop to generate all row pairs in parallel. More...

#include <systolic.h>

Inheritance diagram for madness::SystolicMatrixAlgorithm< T >:
Inheritance graph
[legend]
Collaboration diagram for madness::SystolicMatrixAlgorithm< T >:
Collaboration graph
[legend]

Public Member Functions

 SystolicMatrixAlgorithm (DistributedMatrix< T > &A, int tag, int nthread=ThreadPool::size()+1)
 A must be a column distributed matrix with an even column tile >= 2. More...
 
virtual ~SystolicMatrixAlgorithm ()
 
virtual void kernel (int i, int j, T *rowi, T *rowj)=0
 Threadsafe routine to apply the operation to rows i and j of the matrix. More...
 
virtual bool converged (const TaskThreadEnv &env) const =0
 Invoked simultaneously by all threads after each sweep to test for convergence. More...
 
virtual void start_iteration_hook (const TaskThreadEnv &env)
 Invoked by all threads at the start of each iteration. More...
 
virtual void end_iteration_hook (const TaskThreadEnv &env)
 Invoked by all threads at the end of each iteration. More...
 
void run (World &world, const TaskThreadEnv &env)
 Invoked by the task queue to run the algorithm with multiple threads. More...
 
void solve ()
 Invoked by the user to run the algorithm with one thread. More...
 
int get_rowdim () const
 Returns length of row. More...
 
int get_coldim () const
 Returns length of column. More...
 
Worldget_world () const
 Returns a reference to the world. More...
 
ProcessID get_rank () const
 Returns rank of this process in the world. More...
 
 SystolicMatrixAlgorithm (DistributedMatrix< T > &A, int tag, int nthread=ThreadPool::size()+1)
 A must be a column distributed matrix with an even column tile >= 2. More...
 
virtual ~SystolicMatrixAlgorithm ()
 
virtual void kernel (int i, int j, T *rowi, T *rowj)=0
 Threadsafe routine to apply the operation to rows i and j of the matrix. More...
 
virtual bool converged (const TaskThreadEnv &env) const =0
 Invoked simultaneously by all threads after each sweep to test for convergence. More...
 
virtual void start_iteration_hook (const TaskThreadEnv &env)
 Invoked by all threads at the start of each iteration. More...
 
virtual void end_iteration_hook (const TaskThreadEnv &env)
 Invoked by all threads at the end of each iteration before convergence test. More...
 
void run (World &world, const TaskThreadEnv &env)
 Invoked by the task queue to run the algorithm with multiple threads. More...
 
void solve_sequential ()
 Invoked by the user to run the algorithm with one thread mostly for debugging. More...
 
int64_t get_rowdim () const
 Returns length of row. More...
 
int64_t get_coldim () const
 Returns length of column. More...
 
Worldget_world () const
 Returns a reference to the world. More...
 
ProcessID get_rank () const
 Returns rank of this process in the world. More...
 
- Public Member Functions inherited from madness::TaskInterface
 TaskInterface (int ndepend=0, const TaskAttributes attr=TaskAttributes())
 Create a new task with ndepend dependencies (default 0) and given attributes. More...
 
 TaskInterface (const TaskAttributes &attr)
 Create a new task with zero dependencies and given attributes. More...
 
virtual void run (World &)
 Runs a single-threaded task ... derived classes must implement this. More...
 
Worldget_world () const
 
virtual ~TaskInterface ()
 
- Public Member Functions inherited from madness::PoolTaskInterface
 PoolTaskInterface ()
 
 PoolTaskInterface (const TaskAttributes &attr)
 
void set_nthread (int nthread)
 Call this to reset the number of threads before the task is submitted. More...
 
virtual ~PoolTaskInterface ()
 
- Public Member Functions inherited from madness::TaskAttributes
 TaskAttributes (unsigned long flags=0)
 
 TaskAttributes (const TaskAttributes &attr)
 
virtual ~TaskAttributes ()
 
bool is_generator () const
 
bool is_stealable () const
 
bool is_high_priority () const
 
void set_generator (bool generator_hint)
 
void set_stealable (bool stealable)
 
void set_highpriority (bool hipri)
 
void set_nthread (int nthread)
 Are you sure this is what you want to call? More...
 
int get_nthread () const
 
template<typename Archive >
void serialize (Archive &ar)
 
- Public Member Functions inherited from madness::DependencyInterface
 DependencyInterface (int ndep=0)
 
int ndep () const
 Returns the number of unsatisfied dependencies. More...
 
bool probe () const
 Returns true if ndepend == 0. More...
 
void notify ()
 Invoked by callbacks to notifiy of dependencies being satisfied. More...
 
void register_callback (CallbackInterface *callback)
 Registers a callback for when ndepend==0 , immediately invoked if ndepend==0. More...
 
void inc ()
 Increment the number of dependencies. More...
 
void dec ()
 Decrement the number of dependencies and invoke callback if ndepend=0. More...
 
virtual ~DependencyInterface ()
 
- Public Member Functions inherited from madness::CallbackInterface
virtual ~CallbackInterface ()
 

Additional Inherited Members

- Static Public Member Functions inherited from madness::PoolTaskInterface
static void operator delete (void *p, std::size_t size) throw ()
 Destroy task object. More...
 
- Static Public Member Functions inherited from madness::TaskAttributes
static TaskAttributes generator ()
 
static TaskAttributes hipri ()
 
static TaskAttributes multi_threaded (int nthread)
 
- Static Public Attributes inherited from madness::TaskInterface
static bool debug = false
 
- Static Public Attributes inherited from madness::TaskAttributes
static const unsigned long NTHREAD = 0xff
 
static const unsigned long GENERATOR = 1ul<<8
 
static const unsigned long STEALABLE = GENERATOR<<1
 
static const unsigned long HIGHPRIORITY = GENERATOR<<2
 
- Protected Member Functions inherited from madness::TaskInterface
virtual void run (const TaskThreadEnv &env)
 Override this method to implement a multi-threaded task. More...
 
- Static Protected Member Functions inherited from madness::PoolTaskInterface
template<typename fnT >
static enable_if_c
< detail::function_traits< fnT >
::value||detail::memfunc_traits
< fnT >::value >::type 
make_id (std::pair< void *, unsigned short > &id, fnT fn)
 
template<typename fnobjT >
static disable_if_c
< detail::function_traits
< fnobjT >::value||detail::memfunc_traits
< fnobjT >::value >::type 
make_id (std::pair< void *, unsigned short > &id, const fnobjT &)
 

Detailed Description

template<typename T>
class madness::SystolicMatrixAlgorithm< T >

Base class for parallel algorithms that employ a systolic loop to generate all row pairs in parallel.

Constructor & Destructor Documentation

template<typename T>
madness::SystolicMatrixAlgorithm< T >::SystolicMatrixAlgorithm ( DistributedMatrix< T > &  A,
int  tag,
int  nthread = ThreadPool::size()+1 
)
inline

A must be a column distributed matrix with an even column tile >= 2.

template<typename T>
virtual madness::SystolicMatrixAlgorithm< T >::~SystolicMatrixAlgorithm ( )
inlinevirtual
template<typename T>
madness::SystolicMatrixAlgorithm< T >::SystolicMatrixAlgorithm ( DistributedMatrix< T > &  A,
int  tag,
int  nthread = ThreadPool::size()+1 
)
inline

A must be a column distributed matrix with an even column tile >= 2.

It is assumed that it is the main thread invoking this.

Parameters
[in,out]AThe matrix on which the algorithm is performed and modified in-place
[in]tagThe MPI tag used for communication (obtain from world.mpi.comm().unique_tag() )
[in]nthreadThe number of local threads to use (default is main thread all threads in the pool)
template<typename T>
virtual madness::SystolicMatrixAlgorithm< T >::~SystolicMatrixAlgorithm ( )
inlinevirtual

Member Function Documentation

template<typename T>
virtual bool madness::SystolicMatrixAlgorithm< T >::converged ( const TaskThreadEnv env) const
pure virtual

Invoked simultaneously by all threads after each sweep to test for convergence.

There is a thread barrier before and after the invocation of this routine

Parameters
[in]envThe madness thread environment in case synchronization between threads is needed during computation of the convergence condition.

Implemented in madness::LocalizeBoys< T >.

template<typename T>
virtual bool madness::SystolicMatrixAlgorithm< T >::converged ( const TaskThreadEnv env) const
pure virtual

Invoked simultaneously by all threads after each sweep to test for convergence.

There is a thread barrier before and after the invocation of this routine

Implemented in madness::LocalizeBoys< T >.

Referenced by madness::SystolicMatrixAlgorithm< double >::run().

template<typename T>
virtual void madness::SystolicMatrixAlgorithm< T >::end_iteration_hook ( const TaskThreadEnv env)
inlinevirtual

Invoked by all threads at the end of each iteration before convergence test.

There is a thread barrier before and after the invocation of this routine. Note that the converged() method is const whereas this can modify the class.

Parameters
[in]envThe madness thread environment in case synchronization between threads is needed during startup.

Reimplemented in madness::LocalizeBoys< T >.

template<typename T>
virtual void madness::SystolicMatrixAlgorithm< T >::end_iteration_hook ( const TaskThreadEnv env)
inlinevirtual

Invoked by all threads at the end of each iteration.

There is a thread barrier before and after the invocation of this routine

Reimplemented in madness::LocalizeBoys< T >.

template<typename T>
int64_t madness::SystolicMatrixAlgorithm< T >::get_coldim ( ) const
inline

Returns length of column.

template<typename T>
int madness::SystolicMatrixAlgorithm< T >::get_coldim ( ) const
inline

Returns length of column.

template<typename T>
ProcessID madness::SystolicMatrixAlgorithm< T >::get_rank ( ) const
inline

Returns rank of this process in the world.

template<typename T>
ProcessID madness::SystolicMatrixAlgorithm< T >::get_rank ( ) const
inline

Returns rank of this process in the world.

template<typename T>
int64_t madness::SystolicMatrixAlgorithm< T >::get_rowdim ( ) const
inline

Returns length of row.

template<typename T>
int madness::SystolicMatrixAlgorithm< T >::get_rowdim ( ) const
inline

Returns length of row.

template<typename T>
World& madness::SystolicMatrixAlgorithm< T >::get_world ( ) const
inline

Returns a reference to the world.

template<typename T>
World& madness::SystolicMatrixAlgorithm< T >::get_world ( ) const
inline

Returns a reference to the world.

template<typename T>
virtual void madness::SystolicMatrixAlgorithm< T >::kernel ( int  i,
int  j,
T *  rowi,
T *  rowj 
)
pure virtual

Threadsafe routine to apply the operation to rows i and j of the matrix.

Parameters
[in]iFirst row index in the matrix
[in]jSecond row index in the matrix
[in]rowiPointer to row i of the matrix (to be modified by kernel in-place)
[in]rowjPointer to row j of the matrix (to be modified by kernel in-place)

Implemented in madness::LocalizeBoys< T >.

template<typename T>
virtual void madness::SystolicMatrixAlgorithm< T >::kernel ( int  i,
int  j,
T *  rowi,
T *  rowj 
)
pure virtual

Threadsafe routine to apply the operation to rows i and j of the matrix.

Implemented in madness::LocalizeBoys< T >.

template<typename T>
void madness::SystolicMatrixAlgorithm< T >::run ( World world,
const TaskThreadEnv env 
)
inlinevirtual

Invoked by the task queue to run the algorithm with multiple threads.

This is a collective call ... all processes in world should submit this task

Reimplemented from madness::TaskInterface.

template<typename T>
void madness::SystolicMatrixAlgorithm< T >::run ( World world,
const TaskThreadEnv env 
)
inlinevirtual

Invoked by the task queue to run the algorithm with multiple threads.

Reimplemented from madness::TaskInterface.

Referenced by madness::SystolicMatrixAlgorithm< double >::solve(), and madness::SystolicMatrixAlgorithm< double >::solve_sequential().

template<typename T>
void madness::SystolicMatrixAlgorithm< T >::solve ( )
inline

Invoked by the user to run the algorithm with one thread.

This is a collective call ... all processes in world should call this routine, though processes without data will immediately return without any synchronization.

Referenced by plocalize_boys().

template<typename T>
void madness::SystolicMatrixAlgorithm< T >::solve_sequential ( )
inline

Invoked by the user to run the algorithm with one thread mostly for debugging.

This is a collective call ... all processes in world should call this routine.

template<typename T>
virtual void madness::SystolicMatrixAlgorithm< T >::start_iteration_hook ( const TaskThreadEnv env)
inlinevirtual

Invoked by all threads at the start of each iteration.

There is a thread barrier before and after the invocation of this routine

Parameters
[in]envThe madness thread environment in case synchronization between threads is needed during startup.

Reimplemented in madness::LocalizeBoys< T >.

template<typename T>
virtual void madness::SystolicMatrixAlgorithm< T >::start_iteration_hook ( const TaskThreadEnv env)
inlinevirtual

Invoked by all threads at the start of each iteration.

There is a thread barrier before and after the invocation of this routine

Reimplemented in madness::LocalizeBoys< T >.


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