/home/aching/Avery/Work.School/Research/pvfs2-lock/s3asim/src/master_help.c File Reference

#include "master_help.h"
#include "icomm.h"

Functions

static int check_query_status (struct query_info_s *query_info_list, int *cur_query_p, struct work_info_s *work_info_p, struct test_params_s *test_params_p)
int send_work (int worker, int *cur_query_p, struct work_info_s *work_info_p, struct query_info_s *query_info_list, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int post_irecv (int worker, struct work_info_s *work_info_p, struct irecv_info_s **query_frag_irecv_matrix, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int master_check_irecv_results (int cur_query, int *last_irecv_result_done_p, int wait_status, struct query_info_s *query_info_list, struct irecv_info_s **query_frag_irecv_matrix, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int process_results (int cur_query, int cur_frag, struct query_info_s *query_info_list, struct irecv_info_s **query_frag_irecv_matrix, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
static int generate_io_offset_pairs (int worker, int *cur_io_query_p, int64_t cur_file_offset, struct isend_info_s **query_proc_isend_matrix, struct lresult_s *query_result_list, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int isend_offsets (int numprocs, int cur_file_offset, int cur_query, struct query_info_s *query_info_list, struct isend_info_s **query_proc_isend_matrix, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int64_t calculate_start_file_offset (struct lresult_s *query_result_list)
int do_all_io (int *cur_io_query_p, int64_t *cur_file_offset_p, struct query_info_s *query_info_list, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int do_dummy_io (struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int master_check_isend_offsets (int wait_status, int numprocs, int last_query_offset_sent, int *last_query_offset_comp_p, struct query_info_s *query_info_list, struct isend_info_s **query_proc_isend_matrix, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
void print_offset_list (int64_t *offset_list, int offset_list_count)
void master_check_all_irecv (int numprocs, struct irecv_info_s **query_frag_irecv_matrix, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
void master_check_all_isend (int numprocs, struct isend_info_s **query_proc_isend_matrix, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)

Function Documentation

int64_t calculate_start_file_offset ( struct lresult_s query_result_list  ) 

Find the next start_file_offset by going through the result list and adding up the sizes of the results.

Parameters:
query_result_list The head of the result list for a query.
Returns:
The start_file_offset.

static int check_query_status ( struct query_info_s query_info_list,
int *  cur_query_p,
struct work_info_s work_info_p,
struct test_params_s test_params_p 
) [static]

Determines what to send to workers who are requesting work. If there is work remaining, send out a (query,frag) pair. Otherwise, there may be a global query sync or the queries could already be fully scheduled.

Parameters:
query_info_list Pointer to array of progress for each query.
cur_query_p Index of current query in the query list.
work_info_p Pointer to work_info structure.
test_params_p Pointer to test_params.
Returns:
Status of progress for queries and fragments.

int do_all_io ( int *  cur_io_query_p,
int64_t *  cur_file_offset_p,
struct query_info_s query_info_list,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

If the master-writing mode is chosen, this function is called to write the results to file in order. The result data is copied into a temporary buffer and then written contiguously to file.

Parameters:
cur_query_p The query which has been globally sorted and is ready for I/O.
cur_file_offset_p A pointer to where we are in the output file.
query_info_list Pointer to array of progress for each query.
mpe_events_p Pointer to timing structure.
test_params_p Pointer to test_params.
Returns:
0 on success.

int do_dummy_io ( struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

If the worker-writing mode is chosen with collective I/O, the master must also participate since it is in the same communication group. While it does not actually write any data, the master will also call MPI_File_write_all().

Parameters:
mpe_events_p Pointer to timing structure.
test_params_p Pointer to test_params.
Returns:
0 on success.

static int generate_io_offset_pairs ( int  worker,
int *  cur_io_query_p,
int64_t  cur_file_offset,
struct isend_info_s **  query_proc_isend_matrix,
struct lresult_s query_result_list,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
) [static]

For a specific worker, generate the I/O offset array for where its result data should be written in the shared output result file. A first pass over the results finds the size of the offset array to be allocated. The second pass figures out what they should be.

Parameters:
worker MPI id of worker process.
cur_io_query_p Pointer to the index of current I/O query in the query_proc_isend_matrix.
cur_file_offset Where we are in the output file.
query_proc_isend_matrix Pointer to an element within the matrix which has the isend information.
query_result_list The head of the result list for a query.
mpe_events_p Pointer to timing structure.
test_params_p Pointer to test_params.
Returns:
0 on success.

int isend_offsets ( int  numprocs,
int  cur_file_offset,
int  cur_query,
struct query_info_s query_info_list,
struct isend_info_s **  query_proc_isend_matrix,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

When using parallel I/O, the workers will write their own results to file. Since the file is shared, the workers need to know the offsets of where their results belong in the file (since it is globally ordered). This function sends out 2 messages to each worker for a given query. First, it sends out the number of offsets and then it sends the actual offset array.

Parameters:
numprocs Number of processes used.
cur_file_offset Where we are in the output file.
cur_query The query which has been globally sorted and is ready for I/O.
query_info_list Pointer to array of progress for each query.
query_proc_isend_matrix Pointer to an element within the matrix which has the isend information.
mpe_events_p Pointer to timing structure.
test_params_p Pointer to test_params.
Returns:
0 on success.

void master_check_all_irecv ( int  numprocs,
struct irecv_info_s **  query_frag_irecv_matrix,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

Do a final check on the query_frag_irecv_matrix for any uncompleted irecvs. None should exist.

Parameters:
numprocs Number of processes used.
query_frag_irecv_matrix Pointer to matrix of irecv request information.
mpe_events_p Pointer to timing structure.
test_params_p Pointer to test_params.

void master_check_all_isend ( int  numprocs,
struct isend_info_s **  query_proc_isend_matrix,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

Do a final check on the query_frag_isend_matrix for any uncompleted isends. None should exist.

Parameters:
numprocs Number of processes used.
query_frag_isend_matrix Pointer to matrix of isend request information.
mpe_events_p Pointer to timing structure.
test_params_p Pointer to test_params.

int master_check_irecv_results ( int  cur_query,
int *  last_irecv_result_done_p,
int  wait_status,
struct query_info_s query_info_list,
struct irecv_info_s **  query_frag_irecv_matrix,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

Check the query_frag_irecv_matrix to see how the irecvs are progressing. If a size has been received, set up a irecv for the actual result. If the master-writing method is used, the worker will additionally send the result data, which is included in the size.

Parameters:
cur_query Index of current query in the query list.
last_irecv_result_done_p Pointer to the index of the last query completed.
wait_status Status of master process (wait or no wait).
query_info_list Pointer to array of progress for each query.
query_frag_irecv_matrix Pointer to matrix of irecv request information.
mpe_events_p Pointer to timing structure.
test_params_p Pointer to test_params.
Returns:
0 on success.

int master_check_isend_offsets ( int  wait_status,
int  numprocs,
int  last_query_offset_sent,
int *  last_query_offset_comp_p,
struct query_info_s query_info_list,
struct isend_info_s **  query_proc_isend_matrix,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

Check the query_proc_isend_matrix to see how the isends are progressing. Mark the state of each process separately.

Parameters:
wait_status Status of master process (wait or no wait).
numprocs Number of processes used.
last_query_offset_sent The last query where all the offsets were sent.
last_query_offset_comp_p Pointer to the index of the last query which completed all isends.
query_info_list Pointer to array of progress for each query.
query_proc_isend_matrix Pointer to an element within the matrix which has the isend information.
mpe_events_p Pointer to timing structure.
test_params_p Pointer to test_params.
Returns:
0 on success.

int post_irecv ( int  worker,
struct work_info_s work_info_p,
struct irecv_info_s **  query_frag_irecv_matrix,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

After a worker has been assigned a (query,frag), then setup an irecv request to check for the size of the result.

Parameters:
worker MPI id of worker process who requested work.
work_info_p Pointer to work_info structure.
query_frag_irecv_matrix Pointer to matrix of irecv request information.
mpe_events_p Pointer to timing structure.
test_params_p Pointer to test_params.
Returns:
0 on success.

void print_offset_list ( int64_t *  offset_list,
int  offset_list_count 
)

Debugging function to check the generated offset array.

Parameters:
offset_list The array of offsets.
offset_list_count The number of offsets lin the list.

int process_results ( int  cur_query,
int  cur_frag,
struct query_info_s query_info_list,
struct irecv_info_s **  query_frag_irecv_matrix,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

After result data has been received for a (query,frag), reformat the data stored in the irecv data into a new result list. The new result list which will be the final result list if it is the first result data added for this query. Otherwise, the new result list is merged with the current result list.

Parameters:
cur_query Index of current query in the query list.
cur_frag Index of current frag for cur_query.
query_info_list Pointer to array of progress for each query.
query_frag_irecv_matrix Pointer to matrix of irecv request information.
mpe_events_p Pointer to timing structure.
test_params_p Pointer to test_params.
Returns:
0 on success.

int send_work ( int  worker,
int *  cur_query_p,
struct work_info_s work_info_p,
struct query_info_s query_info_list,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

Send a response to the worker who requested some work. A work_info structure is passed in the message with a control tag in the frag information on what to do next.

Parameters:
worker MPI id of worker process who requested work.
cur_query_p Pointer to the index of current query in the query list.
work_info_p Pointer to work_info structure.
query_info_list Pointer to array of progress for each query.
mpe_events_p Pointer to timing structure.
test_params_p Pointer to test_params.
Returns:
Status of progress for queries and fragments.


Generated on Sun May 20 13:10:04 2007 for s3asim by  doxygen 1.4.7