STIR 6.4.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
24
26#include <vector>
27#include <algorithm>
28
29START_NAMESPACE_STIR
30
63{
64public:
66 explicit DistributedCachingInformation(const int num_processors);
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
92private:
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
157END_NAMESPACE_STIR
158
159#endif /*__stir_recon_buildblock_DistributedCachingInformation_h__*/
Definition of class stir::ViewSegmentNumbers, alias to stir::ViewgramIndices.
DistributedCachingInformation(const int num_processors)
constructor, calls initialise()
Definition DistributedCachingInformation.cxx:28
bool get_unprocessed_vs_num(ViewSegmentNumbers &vs_num, int proc)
get the next work-package for a given processor
Definition DistributedCachingInformation.cxx:139
void initialise()
initialise all data structures called by the constructor, but should be called before processing a ne...
Definition DistributedCachingInformation.cxx:38
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,...
Definition DistributedCachingInformation.cxx:50
alias for ViewgramIndices
Definition ViewSegmentNumbers.h:34