STIR  6.2.0
Functions | Variables
distributed Namespace Reference

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

Detailed Description

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.

See also
STIR_MPI
STIR_MPI_TIMINGS

Compilation instructions are in the Users Guide.

Function Documentation

◆ send_int_value()

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

Parameters
valuethe int value to be sent
destinationthe 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().

◆ send_string()

void distributed::send_string ( const std::string &  str,
int  tag,
int  destination 
)

sends or broadcasts a string

Parameters
strthe string to be sent
tagidentifier to associate messages
destinationthe 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().

◆ send_bool_value()

void distributed::send_bool_value ( bool  value,
int  tag,
int  destination 
)

send or broadcast a bool value

Parameters
valuethe bool value to be sent
tagidentifier to associate messages. If the tag is -1 a Broadcast will be done
destinationthe 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().

◆ send_int_values()

void distributed::send_int_values ( int *  values,
int  count,
int  tag,
int  destination 
)

sends or broadcasts some integer values

Parameters
valuespointer to integer values to be sent
countthe count of integer values to be sent
tagidentifier to associate messages
destinationthe 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().

◆ send_double_values()

void distributed::send_double_values ( double *  values,
int  count,
int  tag,
int  destination 
)

send or broadcast double values

Parameters
valuespointer to the double values to be sent
countthe count of double values to be sent
tagidentifier to associate messages
destinationthe 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().

◆ send_view_segment_numbers()

void distributed::send_view_segment_numbers ( const stir::ViewSegmentNumbers vs_num,
int  tag,
int  destination 
)

send or broadcast ViewSegmentNumbers object

Parameters
vs_numvalue to be sent
tagidentifier to associate messages
destinationthe 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().

◆ send_projectors()

void distributed::send_projectors ( const stir::shared_ptr< stir::ProjectorByBinPair > &  proj_pair_sptr,
int  destination 
)

send or broadcast a projector-pair object

Parameters
proj_pair_sptrvalue to be sent
destinationthe process id where to send the double values. If set to -1 a Broadcast will be done
Warning
This function works by sending the parameter_info. Therefore, if file-names are used (e.g. for a projection matrix on disk) this will only work on systems with shared file systems.

References send_string().

◆ send_image_parameters()

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

Parameters
input_image_ptrthe image_ptr to be sent
tagidentifier to associate messages
destinationthe 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().

◆ send_image_estimate()

void distributed::send_image_estimate ( const stir::DiscretisedDensity< 3, float > *  input_image_ptr,
int  destination 
)

sends or broadcasts the values of a DiscretisedDensity object

Parameters
input_image_ptrthe image_ptr to be sent
destinationthe 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().

◆ send_exam_and_proj_data_info()

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

Parameters
exam_infothe ExamInfo pointer to be sent
proj_data_infothe ProjDataInfo pointer to be sent
destinationthe 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.

Warning
Creates a temporary Interfile header in the local working directory.

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

◆ send_related_viewgrams()

void distributed::send_related_viewgrams ( stir::RelatedViewgrams< float > *  viewgrams,
int  destination 
)

sends a RelatedViegrams object

Parameters
viewgramsthe viewgrams to be sent
destinationthe 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().

◆ send_viewgram()

void distributed::send_viewgram ( const stir::Viewgram< float > &  viewgram,
int  destination 
)

sends a Viewgram object

Parameters
viewgramthe viewgrams to be sent
destinationthe 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:

  1. The dimensions of the viewgram and the vs_num
  2. The values detwermined by iterating through the viewgram and serializing it to a one-dimensional array

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

◆ receive_int_value()

int distributed::receive_int_value ( int  source)

receives a single integer value

Parameters
sourcethe process id from which to receive the interger value. If set to -1 the receive will be done from broadcast
Returns
the received int value

References min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().

Referenced by stir::DistributedWorker< TargetT >::start().

◆ receive_string()

std::string distributed::receive_string ( int  tag,
int  source 
)

receives a string

Parameters
tagunique identifier to associate messages
sourcethe process id from which to receive the string
Returns
the received string

References min_threshold, stir::HighResWallClockTimer::reset(), stir::HighResWallClockTimer::start(), stir::HighResWallClockTimer::stop(), and stir::HighResWallClockTimer::value().

◆ receive_and_initialize_projectors()

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

Parameters
projector_pair_ptraddress pointer of the new ProjectorByBinPair pointer
sourcethe 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().

◆ receive_bool_value()

bool distributed::receive_bool_value ( int  tag,
int  source 
)

receives a bool value

Parameters
tagunique identifier to associate messages
sourcethe process id from which to receive the bool value
Returns
the received 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().

◆ receive_int_values()

MPI_Status distributed::receive_int_values ( int *  values,
int  count,
int  tag 
)

receives some integer values

Parameters
valuespointer to the receive buffer
countthe count of integer values to be received
tagidentifier to associate messages
Returns
MPI_Status object to query the source of the message

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

◆ receive_double_values()

MPI_Status distributed::receive_double_values ( double *  values,
int  count,
int  tag 
)

receives some double values

Parameters
valuespointer to the receive buffer
countthe count of double values to be received
tagidentifier to associate messages
Returns
MPI_Status object to query the source of the message

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

◆ receive_view_segment_numbers()

MPI_Status distributed::receive_view_segment_numbers ( stir::ViewSegmentNumbers vs_num,
int  tag 
)

receive a ViewSegmentNumbers object

Parameters
[out]vs_numvalue that will be set
tagidentifier to associate messages
Returns
MPI_Status object to query the source of the message

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

◆ receive_and_set_image_parameters()

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

Parameters
image_ptraddress pointer of the new DiscretisedDensity
buffersaves the image buffer size to be reused when receiving the image values
tagidentifier to associate messages. If set to -1 a Broadcast will be done
sourcethe 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().

◆ receive_image_values_and_fill_image_ptr()

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

Parameters
image_ptrthe image_ptr to be sent
buffer_sizegives the needed size of the receive buffer
sourcethe process id from which to receive the image values.
Returns
MPI_Status object to query the source of the message

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

◆ receive_and_construct_exam_and_proj_data_info_ptr()

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

Parameters
exam_info_sptrthe new ExamInfo pointer to be set up
proj_data_info_sptrthe new ProjDataInfo pointer to be set up
sourcethe 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().

◆ receive_and_construct_related_viewgrams()

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

Parameters
viewgramsobject that will be filled with the data
proj_data_info_ptrthe ProjDataInfo pointer describing the data
symmetries_sptrthe symmetries pointer constructed when setting up the projectors
sourcethe 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().

◆ receive_and_construct_viewgram()

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

Parameters
viewgramthe viewgrams to be constructed
proj_data_info_ptrthe ProjDataInfo pointer describing the data
sourcethe 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:

  1. The dimensions of the viewgram and the vs_num
  2. The values of the viewgram

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

◆ reduce_received_output_image()

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

Parameters
output_image_ptrthe image pointer where the reduced image is saved
destinationthe 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().

◆ reduce_output_image()

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

Parameters
output_image_ptrthe image pointer where the reduced image is saved
image_buffer_sizethe buffer size needed for the image
my_rankrank of the slave, only used for screen output
destinationthe 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().