SG++
sgpp::datadriven::clusteringmpi::SimpleQueue< T > Class Template Reference

#include <MPIEnviroment.hpp>

Public Member Functions

bool is_finished ()
 Checks whether the queue has already finished. More...
 
size_t receive_result (int &startid, T *partial_result)
 Wait for a result from any of the other workers, send a new workpackage and return said result. More...
 
 SimpleQueue (size_t startindex, size_t workitem_count, size_t node_packagesize, MPI_Comm &comm, int commsize, bool verbose=false, bool prefetching=false)
 Constructor for a simple queue. More...
 
virtual ~SimpleQueue ()
 

Protected Attributes

MPI_Comm & comm
 
int commsize
 
MPI_Datatype mpi_typ
 Datatyp for MPI_SEND and MPI_RECV, only supports float, double and int right now. More...
 
unsigned int packagecount
 Number of all workpackages. More...
 
int packageinfo [2]
 Array with for sending indices and packagesizes. More...
 
size_t packagesize
 
bool prefetching
 Prefetching activated? More...
 
unsigned int received_packageindex
 Number of received workapckages. More...
 
unsigned int * secondary_indices
 Stores the current starting indices for each prefetched work package. More...
 
unsigned int send_packageindex
 Number of sent workapckages. More...
 
size_t startindex
 Start index for the entire problem chunk of this queue. More...
 
unsigned int * startindices
 Stores the current starting indices for each work package. More...
 
bool verbose
 
size_t workitem_count
 

Constructor & Destructor Documentation

template<class T>
sgpp::datadriven::clusteringmpi::SimpleQueue< T >::SimpleQueue ( size_t  startindex,
size_t  workitem_count,
size_t  node_packagesize,
MPI_Comm &  comm,
int  commsize,
bool  verbose = false,
bool  prefetching = false 
)
inline

Constructor for a simple queue.

This constructor check whether there are enough packages for all subworkers (workers which receive workpackages from this queue). If there are not enough packages, the packagesize will be modified such that every worker receives at least 1 package (2 if prefetching is activated). This constructor will also already send the first workpackages with a blocking send so use with care!

Parameters
startindexIndex where the chunk of the problem begins
workitem_countNumber of subworkers
node_packagesizePrefered packagesize - will be modified if to small
commCommunicator to the subworkers
commsizeSize of the communictor
verboseVerbosity on or off
prefetchingActivates package prefetching if this parameter is true
Returns
template<class T>
virtual sgpp::datadriven::clusteringmpi::SimpleQueue< T >::~SimpleQueue ( )
inlinevirtual

Member Function Documentation

template<class T>
bool sgpp::datadriven::clusteringmpi::SimpleQueue< T >::is_finished ( )
inline

Checks whether the queue has already finished.

Returns
Returns true if the queue has received results for all packages

Referenced by sgpp::datadriven::clusteringmpi::GraphCreationWorker::divide_workpackages(), and sgpp::datadriven::clusteringmpi::MPIWorkerPackageBase< int >::divide_workpackages().

template<class T>
size_t sgpp::datadriven::clusteringmpi::SimpleQueue< T >::receive_result ( int &  startid,
T *  partial_result 
)
inline

Wait for a result from any of the other workers, send a new workpackage and return said result.

Parameters
startidReturns the starting index of the package result
partial_resultBuffer containing the package result
Returns
Size of the result array

Referenced by sgpp::datadriven::clusteringmpi::GraphCreationWorker::divide_workpackages(), and sgpp::datadriven::clusteringmpi::MPIWorkerPackageBase< int >::divide_workpackages().

Member Data Documentation

template<class T>
MPI_Comm& sgpp::datadriven::clusteringmpi::SimpleQueue< T >::comm
protected
template<class T>
int sgpp::datadriven::clusteringmpi::SimpleQueue< T >::commsize
protected
template<class T>
MPI_Datatype sgpp::datadriven::clusteringmpi::SimpleQueue< T >::mpi_typ
protected

Datatyp for MPI_SEND and MPI_RECV, only supports float, double and int right now.

template<class T>
unsigned int sgpp::datadriven::clusteringmpi::SimpleQueue< T >::packagecount
protected

Number of all workpackages.

template<class T>
int sgpp::datadriven::clusteringmpi::SimpleQueue< T >::packageinfo[2]
protected

Array with for sending indices and packagesizes.

template<class T>
size_t sgpp::datadriven::clusteringmpi::SimpleQueue< T >::packagesize
protected
template<class T>
bool sgpp::datadriven::clusteringmpi::SimpleQueue< T >::prefetching
protected

Prefetching activated?

template<class T>
unsigned int sgpp::datadriven::clusteringmpi::SimpleQueue< T >::received_packageindex
protected

Number of received workapckages.

template<class T>
unsigned int* sgpp::datadriven::clusteringmpi::SimpleQueue< T >::secondary_indices
protected

Stores the current starting indices for each prefetched work package.

template<class T>
unsigned int sgpp::datadriven::clusteringmpi::SimpleQueue< T >::send_packageindex
protected

Number of sent workapckages.

template<class T>
size_t sgpp::datadriven::clusteringmpi::SimpleQueue< T >::startindex
protected

Start index for the entire problem chunk of this queue.

template<class T>
unsigned int* sgpp::datadriven::clusteringmpi::SimpleQueue< T >::startindices
protected

Stores the current starting indices for each work package.

template<class T>
size_t sgpp::datadriven::clusteringmpi::SimpleQueue< T >::workitem_count
protected

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