STIR  6.2.0
DistributedCachingInformation.h
1 //
2 //
3 /*
4  Copyright (C) 2007- 2011, Hammersmith Imanet Ltd
5  This file is part of STIR.
6 
7  SPDX-License-Identifier: Apache-2.0
8 
9  See STIR/LICENSE.txt for details
10 */
11 
12 #ifndef __stir_recon_buildblock_DistributedCachingInformation_h__
13 #define __stir_recon_buildblock_DistributedCachingInformation_h__
14 
26 #include <vector>
27 #include <algorithm>
28 
29 START_NAMESPACE_STIR
30 
63 {
64 public:
67 
70 
75  void initialise();
79  void initialise_new_subiteration(const std::vector<ViewSegmentNumbers>& vs_nums_to_process);
80 
90  bool get_unprocessed_vs_num(ViewSegmentNumbers& vs_num, int proc);
91 
92 private:
94  int num_workers;
95 
97  std::vector<ViewSegmentNumbers> vs_nums_to_process;
98 
100  std::vector<std::vector<ViewSegmentNumbers>> proc_vs_nums;
101 
103 
104  std::vector<bool> still_to_process;
105 
107  int find_vs_num_position_in_list_to_process(const ViewSegmentNumbers& vs_num) const;
108 
110  int find_position_of_first_unprocessed() const;
111 
113  int get_num_remaining_cached_data_to_process(int proc) const;
114 
120  void add_vs_num_to_proc(int proc, const ViewSegmentNumbers& vs_num);
121 
128  bool get_oldest_unprocessed_vs_num(ViewSegmentNumbers& vs_num, int proc) const;
129 
139  ViewSegmentNumbers get_vs_num_of_proc_with_most_work_left(int proc) const;
140 
144  void set_processed(const ViewSegmentNumbers& vs_num);
145 
148  void set_all_vs_num_unprocessed();
149 
154  bool is_still_to_be_processed(const ViewSegmentNumbers& vs_num) const;
155 };
156 
157 END_NAMESPACE_STIR
158 
159 #endif /*__stir_recon_buildblock_DistributedCachingInformation_h__*/
This class implements the logic needed to support caching in a distributed manner.
Definition: DistributedCachingInformation.h:62
int num_processors
the number of processes used for distributed computation
Definition: distributed_functions.cxx:50
Definition of class stir::ViewSegmentNumbers, alias to stir::ViewgramIndices.
alias for ViewgramIndices
Definition: ViewSegmentNumbers.h:33