STIR
6.2.0
|
This class implements the logic needed to support caching in a distributed manner. More...
#include "stir/recon_buildblock/DistributedCachingInformation.h"
Public Member Functions | |
DistributedCachingInformation (const int num_processors) | |
constructor, calls initialise() | |
virtual | ~DistributedCachingInformation () |
destructor to clean up data structures | |
void | initialise () |
initialise all data structures called by the constructor, but should be called before processing a new set of data. calls initialise_new_subiteration() with an empty vector | |
void | initialise_new_subiteration (const std::vector< ViewSegmentNumbers > &vs_nums_to_process) |
to be called at the beginning of the processing of a set of data The caching data is kept, such that the cache will be re-used over multiple runs. | |
bool | get_unprocessed_vs_num (ViewSegmentNumbers &vs_num, int proc) |
get the next work-package for a given processor More... | |
This class implements the logic needed to support caching in a distributed manner.
To enable distributed caching, the master needs to store how the view segment numbers or the related viewgrams respectively were distributed between the workers. Doing that, the master is able to send those viegrams to a slave requesting for work, which that specific slave already handled before and still has cached locally. Additionally it is possible to only send the view segment number instead of the whole projection data, if the the worker stores the recieved related viewgrams.
This class stores all needed information to determine a not yet processed view segment number that will be sent to the requesting slave in such a way that the belonging data most likely is stored in the slaves cache.
The function get_unprocessed_vs_num()
can be called by the master, passing the requesting worker and the current subset to determine the next processed view segment number
The logic is a bit sophisticated, as it has to make sure, that every vs_num is only processed once and that load balancing is forced. T
Process numbers are expected to be between 0 and num_workers
Whether to use the cache enabled function or not can be set by the parsing parameter
enable distributed caching := 0
within the parameter specification for the objective function, where 1 activates it and 0 deactivates caching. The default is set to 0.
bool stir::DistributedCachingInformation::get_unprocessed_vs_num | ( | ViewSegmentNumbers & | vs_num, |
int | proc | ||
) |
get the next work-package for a given processor
[out] | vs_num | will be set accordingly |
[in] | proc | the processor for which the View-Segment-Numbers are calculated |
true
if the vs_num was not in the cache of the processor This function updates internal cache values etc. The user can just repeatedly call the function without worrying about the caching algorithm.