SG++-Doxygen-Documentation
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

◆ SimpleQueue()

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

References create_dataset::dest.

◆ ~SimpleQueue()

template<class T>
virtual sgpp::datadriven::clusteringmpi::SimpleQueue< T >::~SimpleQueue ( )
inlinevirtual

Member Function Documentation

◆ is_finished()

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().

◆ receive_result()

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

◆ comm

template<class T>
MPI_Comm& sgpp::datadriven::clusteringmpi::SimpleQueue< T >::comm
protected

◆ commsize

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

◆ mpi_typ

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.

◆ packagecount

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

Number of all workpackages.

◆ packageinfo

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

Array with for sending indices and packagesizes.

◆ packagesize

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

◆ prefetching

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

Prefetching activated?

◆ received_packageindex

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

Number of received workapckages.

◆ secondary_indices

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

Stores the current starting indices for each prefetched work package.

◆ send_packageindex

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

Number of sent workapckages.

◆ startindex

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

Start index for the entire problem chunk of this queue.

◆ startindices

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

Stores the current starting indices for each work package.

◆ verbose

◆ workitem_count

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

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