STIR
6.2.0
|
Namespace for distributed computation with MPI. More...
Functions | |
void | test_viewgram_slave (const stir::shared_ptr< stir::ProjDataInfo > &proj_data_info_ptr) |
void | test_viewgram_master (stir::Viewgram< float > viewgram, const stir::shared_ptr< stir::ProjDataInfo > &proj_data_info_ptr) |
void | test_image_estimate_master (const stir::DiscretisedDensity< 3, float > *input_image_ptr, int slave) |
void | test_image_estimate_slave () |
void | test_related_viewgrams_master (const stir::shared_ptr< stir::ProjDataInfo > &proj_data_info_ptr, const stir::shared_ptr< stir::DataSymmetriesForViewSegmentNumbers > symmetries_sptr, stir::RelatedViewgrams< float > *y, int slave) |
void | test_related_viewgrams_slave (const stir::shared_ptr< stir::ProjDataInfo > &proj_data_info_ptr, const stir::shared_ptr< stir::DataSymmetriesForViewSegmentNumbers > symmetries_sptr) |
void | test_parameter_info_master (const std::string str, int slave, char const *const text) |
void | test_parameter_info_slave (const std::string str) |
void | test_bool_value_master (bool value, int slave) |
void | test_bool_value_slave () |
void | test_int_value_master (int value, int slave) |
void | test_int_value_slave () |
void | test_int_values_master (int slave) |
void | test_int_values_slave () |
Variables | |
int | length |
int | processor |
int | iteration_counter = 0 |
int | image_buffer_size |
MPI_Status | status |
float | parameters [6] |
int | sizes [6] |
stir::HighResWallClockTimer | t |
Tag-names currently used by functions in the distributed namespace | |
const int | INT_TAG = 7 |
const int | ARBITRARY_TAG = 8 |
special tag, equivalent to MPI_ANY_TAG in some functions | |
const int | STIR_MPI_CONF_TAG = 9 |
const int | IMAGE_ESTIMATE_TAG = 23 |
const int | IMAGE_PARAMETER_TAG = 24 |
const int | VIEWGRAM_DIMENSIONS_TAG = 27 |
const int | VIEWGRAM_TAG = 28 |
const int | VIEWGRAM_COUNT_TAG = 29 |
const int | PROJECTION_DATA_INFO_TAG = 30 |
const int | PARAMETER_INFO_TAG = 21 |
const int | REGISTERED_NAME_TAG = 25 |
Global variables used for STIR_MPI | |
int | num_processors |
the number of processes used for distributed computation | |
bool | first_iteration |
some stuff in distributable_computation needs to be done only in the first iteration | |
bool | test = false |
enable/disable tests | |
bool | rpc_time = false |
bool | test_send_receive_times = false |
enable timings for PRC_process_related_viewgrams_gradient() computation | |
double | total_rpc_time = 0 |
enable timings for every single send/receive operation | |
double | total_rpc_time_2 = 0.0 |
adding up the time used for PRC_process_related_viewgrams_gradient() computation at all slaves | |
double | total_rpc_time_slaves = 0.0 |
adding up the time used for PRC_process_related_viewgrams_gradient() computation at a single slave | |
double | min_threshold = 0.1 |
value to reduce the total_rpc_time values | |
void | send_int_value (int value, int destination) |
threshold for displaying send/receive times, initially set to 0.1 seconds More... | |
void | send_string (const std::string &str, int tag, int destination) |
sends or broadcasts a string More... | |
void | send_bool_value (bool value, int tag, int destination) |
send or broadcast a bool value More... | |
void | send_int_values (int *values, int count, int tag, int destination) |
sends or broadcasts some integer values More... | |
void | send_double_values (double *values, int count, int tag, int destination) |
send or broadcast double values More... | |
void | send_view_segment_numbers (const stir::ViewSegmentNumbers &vs_num, int tag, int destination) |
send or broadcast ViewSegmentNumbers object More... | |
void | send_projectors (const stir::shared_ptr< stir::ProjectorByBinPair > &proj_pair_sptr, int destination) |
send or broadcast a projector-pair object More... | |
void | send_image_parameters (const stir::DiscretisedDensity< 3, float > *input_image_ptr, int tag, int destination) |
sends or broadcasts the parameters of a DiscretisedDensity object More... | |
void | send_image_estimate (const stir::DiscretisedDensity< 3, float > *input_image_ptr, int destination) |
sends or broadcasts the values of a DiscretisedDensity object More... | |
void | send_exam_and_proj_data_info (const stir::ExamInfo &exam_info, const stir::ProjDataInfo &proj_data_info, int destination) |
sends or broadcasts the information from ExamInfo and ProjDataInfo More... | |
void | send_related_viewgrams (stir::RelatedViewgrams< float > *viewgrams, int destination) |
sends a RelatedViegrams object More... | |
void | send_viewgram (const stir::Viewgram< float > &viewgram, int destination) |
sends a Viewgram object More... | |
int | receive_int_value (int source) |
receives a single integer value More... | |
std::string | receive_string (int tag, int source) |
receives a string More... | |
void | receive_and_initialize_projectors (stir::shared_ptr< stir::ProjectorByBinPair > &projector_pair_ptr, int source) |
receives all needed information to subsequently construct a ProjectorByBinPair object More... | |
bool | receive_bool_value (int tag, int source) |
receives a bool value More... | |
MPI_Status | receive_int_values (int *values, int count, int tag) |
receives some integer values More... | |
MPI_Status | receive_double_values (double *values, int count, int tag) |
receives some double values More... | |
MPI_Status | receive_view_segment_numbers (stir::ViewSegmentNumbers &vs_num, int tag) |
receive a ViewSegmentNumbers object More... | |
void | receive_and_set_image_parameters (stir::shared_ptr< stir::DiscretisedDensity< 3, float >> &image_ptr, int &buffer, int tag, int source) |
receives the parameters of a DiscretisedDensity object More... | |
MPI_Status | receive_image_values_and_fill_image_ptr (stir::shared_ptr< stir::DiscretisedDensity< 3, float >> &image_ptr, int buffer_size, int source) |
receives the values of a DiscretisedDensity object More... | |
void | receive_and_construct_exam_and_proj_data_info_ptr (stir::shared_ptr< stir::ExamInfo > &exam_info_sptr, stir::shared_ptr< stir::ProjDataInfo > &proj_data_info_sptr, int source) |
receives information of ExamInfo and ProjDataInfo objects and constructs new ones from it More... | |
void | receive_and_construct_related_viewgrams (stir::RelatedViewgrams< float > *&viewgrams, const stir::shared_ptr< stir::ProjDataInfo > &proj_data_info_ptr, const stir::shared_ptr< stir::DataSymmetriesForViewSegmentNumbers > symmetries_sptr, int source) |
receives and constructs a RelatedViewgrams object More... | |
void | receive_and_construct_viewgram (stir::Viewgram< float > *&viewgram, const stir::shared_ptr< stir::ProjDataInfo > &proj_data_info_ptr, int source) |
receives a Viewgram object More... | |
void | reduce_received_output_image (stir::DiscretisedDensity< 3, float > *output_image_ptr, int destination) |
the function called by the master to reduce the output image More... | |
void | reduce_output_image (stir::shared_ptr< stir::DiscretisedDensity< 3, float >> &output_image_ptr, int image_buffer_size, int my_rank, int destination) |
the function called by the slaves to reduce the output image More... | |
Namespace for distributed computation with MPI.
This is a collection of functions to send and receive objects and data needed for distributed computation with MPI. They all come in a separate namespace "distributed". There was no need to have an object providing this functionality as that would have been more costly.
Note that every send function has a corresponding receive function.
Compilation instructions are in the Users Guide.
void distributed::send_int_value | ( | int | value, |
int | destination | ||
) |
threshold for displaying send/receive times, initially set to 0.1 seconds
sends or broadcasts an integer value
value | the int value to be sent |
destination | the process id where to send the interger value. If set to -1 a Broadcast will be done |
References min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
Referenced by stir::end_distributable_computation(), stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >::set_up_before_sensitivity(), and stir::setup_distributable_computation().
void distributed::send_string | ( | const std::string & | str, |
int | tag, | ||
int | destination | ||
) |
sends or broadcasts a string
str | the string to be sent |
tag | identifier to associate messages |
destination | the process id where to send the string. If set to -1 a Broadcast will be done |
References min_threshold, num_processors, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
Referenced by send_projectors().
void distributed::send_bool_value | ( | bool | value, |
int | tag, | ||
int | destination | ||
) |
send or broadcast a bool value
value | the bool value to be sent |
tag | identifier to associate messages. If the tag is -1 a Broadcast will be done |
destination | the process id where to send the bool value. If set to -1 a Broadcast will be done |
This function actually sends an integer value (0 or 1) as there is no bool datatype in MPI
References min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
Referenced by stir::distributable_computation_cache_enabled().
void distributed::send_int_values | ( | int * | values, |
int | count, | ||
int | tag, | ||
int | destination | ||
) |
sends or broadcasts some integer values
values | pointer to integer values to be sent |
count | the count of integer values to be sent |
tag | identifier to associate messages |
destination | the process id where to send the int values. If set to -1 a Broadcast will be done |
References min_threshold, num_processors, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
Referenced by send_related_viewgrams(), send_view_segment_numbers(), and send_viewgram().
void distributed::send_double_values | ( | double * | values, |
int | count, | ||
int | tag, | ||
int | destination | ||
) |
send or broadcast double values
values | pointer to the double values to be sent |
count | the count of double values to be sent |
tag | identifier to associate messages |
destination | the process id where to send the double values. If set to -1 a Broadcast will be done |
References min_threshold, num_processors, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
void distributed::send_view_segment_numbers | ( | const stir::ViewSegmentNumbers & | vs_num, |
int | tag, | ||
int | destination | ||
) |
send or broadcast ViewSegmentNumbers object
vs_num | value to be sent |
tag | identifier to associate messages |
destination | the process id where to send the double values. If set to -1 a Broadcast will be done |
References stir::SegmentIndices::segment_num(), send_int_values(), and stir::ViewgramIndices::view_num().
void distributed::send_projectors | ( | const stir::shared_ptr< stir::ProjectorByBinPair > & | proj_pair_sptr, |
int | destination | ||
) |
send or broadcast a projector-pair object
proj_pair_sptr | value to be sent |
destination | the process id where to send the double values. If set to -1 a Broadcast will be done |
References send_string().
void distributed::send_image_parameters | ( | const stir::DiscretisedDensity< 3, float > * | input_image_ptr, |
int | tag, | ||
int | destination | ||
) |
sends or broadcasts the parameters of a DiscretisedDensity object
input_image_ptr | the image_ptr to be sent |
tag | identifier to associate messages |
destination | the process id where to send the image parameters. If set to -1 a Broadcast will be done |
This function sends all parameters needed to construct a corresponding image object at the slave. The image values are sent separately. This is done, as sending the parameters is not needed everytime the values are sent. The slave needs to receive the current_image_estimate every iteration, but he already knows the parameters.
The actual parameters sent are the image dimensions, the origin and the grid_spacing
References stir::DiscretisedDensityOnCartesianGrid< 3, elemT >::get_grid_spacing(), stir::DiscretisedDensity< num_dimensions, elemT >::get_origin(), min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
void distributed::send_image_estimate | ( | const stir::DiscretisedDensity< 3, float > * | input_image_ptr, |
int | destination | ||
) |
sends or broadcasts the values of a DiscretisedDensity object
input_image_ptr | the image_ptr to be sent |
destination | the process id where to send the image values. If set to -1 a Broadcast will be done |
This function sends the values of an image. The values are serialized to a one-dimensional array as MPI only sends that kind of data structures.
References stir::Array< num_dimensions, elemT >::begin_all(), stir::Array< num_dimensions, elemT >::end_all(), min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
void distributed::send_exam_and_proj_data_info | ( | const stir::ExamInfo & | exam_info, |
const stir::ProjDataInfo & | proj_data_info, | ||
int | destination | ||
) |
sends or broadcasts the information from ExamInfo and ProjDataInfo
exam_info | the ExamInfo pointer to be sent |
proj_data_info | the ProjDataInfo pointer to be sent |
destination | the process id where to send the values. If set to -1 a Broadcast will be done |
For sending the objects a rather "dirty trick" is used: Instead of sending all needed data for constructing the objects, the information is temporarily stored as ProjDataInterfile and then buffered as text from the file. Afterwards, that is sent to the slave.
Doing this, the slave is able to construct the objects by using the received information. The sent char-array is used as stream-input to the parse() function of InterfileHeader.
References stir::ProjDataInfo::create_shared_clone(), min_threshold, num_processors, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), stir::HighResWallClockTimer::value(), and stir::warning().
void distributed::send_related_viewgrams | ( | stir::RelatedViewgrams< float > * | viewgrams, |
int | destination | ||
) |
sends a RelatedViegrams object
viewgrams | the viewgrams to be sent |
destination | the process id where to send the related viewgrams |
This function iterates through the relatedviewgrams object and calls send_viewgram()
for each comprised viewgram. The only value sent is the count of viewgrams contained within the related_viewgrams object to make sure that the worker knows how many viewgrams he has to receive.
References stir::RelatedViewgrams< elemT >::begin(), stir::RelatedViewgrams< elemT >::end(), stir::RelatedViewgrams< elemT >::get_num_viewgrams(), send_int_values(), and send_viewgram().
void distributed::send_viewgram | ( | const stir::Viewgram< float > & | viewgram, |
int | destination | ||
) |
sends a Viewgram object
viewgram | the viewgrams to be sent |
destination | the process id where to send the viewgram |
This function sends all parameters needed for the construction of the viewgram at the worker, as well as the actual values of the viewgram. That would mean that 2 Messages are sent:
References stir::Array< num_dimensions, elemT >::begin_all(), stir::Array< num_dimensions, elemT >::end_all(), stir::Viewgram< elemT >::get_max_axial_pos_num(), stir::Viewgram< elemT >::get_max_tangential_pos_num(), stir::Viewgram< elemT >::get_min_axial_pos_num(), stir::Viewgram< elemT >::get_min_tangential_pos_num(), stir::Viewgram< elemT >::get_segment_num(), stir::Viewgram< elemT >::get_timing_pos_num(), stir::Viewgram< elemT >::get_view_num(), min_threshold, stir::HighResWallClockTimer::reset(), send_int_values(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
Referenced by send_related_viewgrams().
int distributed::receive_int_value | ( | int | source | ) |
receives a single integer value
source | the process id from which to receive the interger value. If set to -1 the receive will be done from broadcast |
References min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
Referenced by stir::DistributedWorker< TargetT >::start().
std::string distributed::receive_string | ( | int | tag, |
int | source | ||
) |
receives a string
tag | unique identifier to associate messages |
source | the process id from which to receive the string |
References min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
void distributed::receive_and_initialize_projectors | ( | stir::shared_ptr< stir::ProjectorByBinPair > & | projector_pair_ptr, |
int | source | ||
) |
receives all needed information to subsequently construct a ProjectorByBinPair object
projector_pair_ptr | address pointer of the new ProjectorByBinPair pointer |
source | the process id from which to receive the ProjectorByBinPair |
First the registered_name string of the ProjectorByBinPair is received. Then the parameter_info() of the masters ProjectorByBinPair is received. Using the registered_name and the parameter_info() as stream, both can be used as input to the read_registered_object function, which then constructs the new ProjectorByBinPair pointer.
The passed address pointer parameter will then be redirected to the address of ProjectorByBinPair created using the received parameters.
References min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
bool distributed::receive_bool_value | ( | int | tag, |
int | source | ||
) |
receives a bool value
tag | unique identifier to associate messages |
source | the process id from which to receive the bool value |
This function actually receives an integer value (0 or 1) as there is no bool datatype in MPI, but it will return a bool value
References min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
Referenced by stir::DistributedWorker< TargetT >::setup_distributable_computation().
MPI_Status distributed::receive_int_values | ( | int * | values, |
int | count, | ||
int | tag | ||
) |
receives some integer values
values | pointer to the receive buffer |
count | the count of integer values to be received |
tag | identifier to associate messages |
The tag needs to be set to ARBITRARY_TAG (=8) if MPI_ANY_TAG shall be used
References ARBITRARY_TAG, min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
Referenced by receive_and_construct_related_viewgrams(), receive_and_construct_viewgram(), and receive_view_segment_numbers().
MPI_Status distributed::receive_double_values | ( | double * | values, |
int | count, | ||
int | tag | ||
) |
receives some double values
values | pointer to the receive buffer |
count | the count of double values to be received |
tag | identifier to associate messages |
The tag needs to be set to ARBITRARY_TAG (=8) if MPI_ANY_TAG shall be used
References ARBITRARY_TAG, min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
MPI_Status distributed::receive_view_segment_numbers | ( | stir::ViewSegmentNumbers & | vs_num, |
int | tag | ||
) |
receive a ViewSegmentNumbers object
[out] | vs_num | value that will be set |
tag | identifier to associate messages |
The tag needs to be set to ARBITRARY_TAG (=8) if MPI_ANY_TAG shall be used
References receive_int_values(), stir::SegmentIndices::segment_num(), and stir::ViewgramIndices::view_num().
void distributed::receive_and_set_image_parameters | ( | stir::shared_ptr< stir::DiscretisedDensity< 3, float >> & | image_ptr, |
int & | buffer, | ||
int | tag, | ||
int | source | ||
) |
receives the parameters of a DiscretisedDensity object
image_ptr | address pointer of the new DiscretisedDensity |
buffer | saves the image buffer size to be reused when receiving the image values |
tag | identifier to associate messages. If set to -1 a Broadcast will be done |
source | the process id from which to receive the image parameters. |
This function receives all parameters needed to construct an image object at the slave. The image values are sent separately.
The actual parameters received are the image dimensions, the origin and the grid_spacing
The function currently only supports VoxelsOnCartesianGrid
References min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
Referenced by stir::DistributedWorker< TargetT >::setup_distributable_computation().
MPI_Status distributed::receive_image_values_and_fill_image_ptr | ( | stir::shared_ptr< stir::DiscretisedDensity< 3, float >> & | image_ptr, |
int | buffer_size, | ||
int | source | ||
) |
receives the values of a DiscretisedDensity object
image_ptr | the image_ptr to be sent |
buffer_size | gives the needed size of the receive buffer |
source | the process id from which to receive the image values. |
The image_ptr is filled by iterating through the target pointer and copying the single values from the receive buffer.
The buffer_size is used again to reduce the image values
References stir::error(), min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
void distributed::receive_and_construct_exam_and_proj_data_info_ptr | ( | stir::shared_ptr< stir::ExamInfo > & | exam_info_sptr, |
stir::shared_ptr< stir::ProjDataInfo > & | proj_data_info_sptr, | ||
int | source | ||
) |
receives information of ExamInfo and ProjDataInfo objects and constructs new ones from it
exam_info_sptr | the new ExamInfo pointer to be set up |
proj_data_info_sptr | the new ProjDataInfo pointer to be set up |
source | the process id from which to receive from |
The parameter info is received as a Interfile Header string. That way the slave is able to construct a ProjDataInfo within a InterfilePDFSHeader using the received char-array as stream-input to the parse() function of InterfilePDFSHeader.
References stir::error(), min_threshold, stir::KeyParser::parse(), stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
void distributed::receive_and_construct_related_viewgrams | ( | stir::RelatedViewgrams< float > *& | viewgrams, |
const stir::shared_ptr< stir::ProjDataInfo > & | proj_data_info_ptr, | ||
const stir::shared_ptr< stir::DataSymmetriesForViewSegmentNumbers > | symmetries_sptr, | ||
int | source | ||
) |
receives and constructs a RelatedViewgrams object
viewgrams | object that will be filled with the data |
proj_data_info_ptr | the ProjDataInfo pointer describing the data |
symmetries_sptr | the symmetries pointer constructed when setting up the projectors |
source | the process id from which to receive the ProjDataInfo |
First of all it is important to notice, that this function is not independent. To construct a new RelatedViegrams object, the symmetries_ptr must be available. That would mean, that the slave has to call receive_and_initialize_projectors()
to set up the symmetries_ptr before the related_vewgrams can be received. Additionally the ProjDataInfo-pointer must be available for receiving a single viewgrams. That implies calling receive_and_construct_proj_data_info_ptr()
before. To make this function independent, both of these objects have to be sent here. On the other hand that would lead to the overhead of sending it everytime a related_viewgram is sent, which is really expensive.
This function receives the count of viewgrams to be received and calls receive_and_construct_viewgram
that often. Every received viewgram is pushed back to a viewgram vector, which afterwards is used with the symmetries to construct a RelatedViewgrams object.
References receive_and_construct_viewgram(), and receive_int_values().
void distributed::receive_and_construct_viewgram | ( | stir::Viewgram< float > *& | viewgram, |
const stir::shared_ptr< stir::ProjDataInfo > & | proj_data_info_ptr, | ||
int | source | ||
) |
receives a Viewgram object
viewgram | the viewgrams to be constructed |
proj_data_info_ptr | the ProjDataInfo pointer describing the data |
source | the process id from which to receive the ProjDataInfo |
This function received all parameters needed for the construction of the viewgram at the worker, as well as the actual values of the viewgram. That would mean that 2 Messages are received:
The buffer_size needed to receive the values is calculated from the dimensions received. The viewgram is filled by iterating througn it and copying the values of the received values.
References stir::Array< num_dimensions, elemT >::begin_all(), min_threshold, receive_int_values(), stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
Referenced by receive_and_construct_related_viewgrams().
void distributed::reduce_received_output_image | ( | stir::DiscretisedDensity< 3, float > * | output_image_ptr, |
int | destination | ||
) |
the function called by the master to reduce the output image
output_image_ptr | the image pointer where the reduced image is saved |
destination | the process id where the output_image is reduced |
References stir::Array< num_dimensions, elemT >::begin_all(), min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().
void distributed::reduce_output_image | ( | stir::shared_ptr< stir::DiscretisedDensity< 3, float >> & | output_image_ptr, |
int | image_buffer_size, | ||
int | my_rank, | ||
int | destination | ||
) |
the function called by the slaves to reduce the output image
output_image_ptr | the image pointer where the reduced image is saved |
image_buffer_size | the buffer size needed for the image |
my_rank | rank of the slave, only used for screen output |
destination | the process id where the output_image is reduced |
The buffer size was calculated in receive_image_values_and_fill_image_ptr()
. Alternatively it can be calculated by the image parameters.
References min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().