/home/aching/Avery/Work.School/Research/pvfs2-lock/s3asim/src/worker_help.h File Reference

#include "llist.h"
#include "hist_params.h"

Data Structures

struct  query_result_s
struct  isend_info_s

Defines

#define NOT_USED   0
#define WAIT_RESULT_SIZE   1
#define WAIT_RESULT   2
#define DONE_RESULT   3
#define START_IRECV   4
#define WAIT_OFFSET_LIST_COUNT   5
#define WAIT_OFFSET_LIST   6
#define DONE_OFFSET_LIST   7
#define IO_FINISHED   8
#define MAX_WORKER_STATE   9

Functions

int get_test_params (int myid, int numprocs, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int send_recv_work_req (int myid, int *all_done_p, struct work_info_s *work_info_p, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
void print_result (struct result_s *cur_result_p)
int do_work (int myid, struct work_info_s *work_info_p, struct isend_info_s **query_frag_isend_matrix, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int merge_results (int myid, struct work_info_s *work_info_p, struct query_result_s *query_result_list, struct isend_info_s **query_frag_isend_matrix, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int worker_isend_results (int myid, struct work_info_s *work_info_p, int *last_query_offset_recv_p, struct isend_info_s **query_frag_isend_matrix, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int worker_check_isend_results (int myid, int wait_status, struct work_info_s *last_query_result_sent_p, struct work_info_s *last_query_result_comp_p, struct query_result_s *query_result_list, struct isend_info_s **query_frag_isend_matrix, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int worker_post_irecv (int myid, struct work_info_s *work_info_p, struct query_result_s *query_result_list, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int worker_check_irecv_offsets (int myid, int wait_status, int last_query_offset_recv, int *last_query_offset_comp_p, struct query_result_s *query_result_list, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
int do_all_worker_io (int myid, int wait_status, int last_io_ready, int *last_io_comp_p, struct query_result_s *query_result_list, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
void worker_check_all_irecv (int myid, int numprocs, struct query_result_s *query_result_list, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)
void worker_check_all_isend (int myid, int numprocs, struct isend_info_s **query_frag_isend_matrix, struct mpe_events_s *mpe_events_p, struct test_params_s *test_params_p)

Variables

int64_t global_debug_mask
char * decode_req [MAX_REQ]

Define Documentation

#define DONE_OFFSET_LIST   7

#define DONE_RESULT   3

#define IO_FINISHED   8

#define MAX_WORKER_STATE   9

#define NOT_USED   0

#define START_IRECV   4

#define WAIT_OFFSET_LIST   6

#define WAIT_OFFSET_LIST_COUNT   5

#define WAIT_RESULT   2

#define WAIT_RESULT_SIZE   1


Function Documentation

int do_all_worker_io ( int  myid,
int  wait_status,
int  last_io_ready,
int *  last_io_comp_p,
struct query_result_s query_result_list,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

This function will only be called if the worker-writing method is used. When the master notifies the worker of getting ready to write, the worker will try to do I/O to the queries which it has received offset arrays for. If collective I/O is used, the worker will be careful about when to call this function to ensure that all processes write together.

Parameters:
myid MPI myid.
wait_status_p Pointer to the wait status of the worker.
last_io_ready Last I/O operation possible
last_io_comp_p Pointer to the I/O query operation to try next (modified in this function).
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.

int do_work ( int  myid,
struct work_info_s work_info_p,
struct isend_info_s **  query_frag_isend_matrix,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

The work is calculated based on a very simple model for determining the actual computational time of comparing each (query,frag). The results are generated and saved in the query_frag_isend_matrix in an array before sending to the master. After the compute time has been generated, it is simulated through usleep().

Parameters:
myid MPI myid.
work_info_p Pointer to work_info structure.
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.
Returns:
0 on success.

int get_test_params ( int  myid,
int  numprocs,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

Before any work begins, the master distributes the test parameters to the workers through this function.

Parameters:
myid MPI myid.
numprocs Number of processes used.
mpe_events_p Pointer to timing structure.
test_params_p Pointer to test_params.
Returns:
0 on success.

int merge_results ( int  myid,
struct work_info_s work_info_p,
struct query_result_s query_result_list,
struct isend_info_s **  query_frag_isend_matrix,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

The results in the query_frag_isend_matrix are first converted to a linked list. Then this linked list is merged with the previous results (if there are any), which are also in a linked list.

Parameters:
myid MPI myid.
work_info_p Pointer to work_info structure.
query_result_list The head of the result list for a query.
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.
Returns:
0 on success.

void print_result ( struct result_s cur_result_p  ) 

Debugging function to print out the member variables of the result structure.

Parameters:
cur_result_p Result which will have its member variables printed.

int send_recv_work_req ( int  myid,
int *  wait_status_p,
struct work_info_s work_info_p,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

The worker uses this function to send a request to the master process to request work. The wait_status is encoded in the frag section if the query is done or all queries are done. Otherwise the worker gets the (query,frag) information.

Parameters:
myid MPI myid.
wait_status_p Pointer to the wait status of the worker.
work_info_p Pointer to work information structure.
mpe_events_p Pointer to timing structure.
test_params_p Pointer to test_params.
Returns:
0 on success.

void worker_check_all_irecv ( int  myid,
int  numprocs,
struct query_result_s query_result_list,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

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

Parameters:
myid MPI myid.
numprocs Number of processes used.
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.

void worker_check_all_isend ( int  myid,
int  numprocs,
struct isend_info_s **  query_frag_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:
myid MPI myid.
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 worker_check_irecv_offsets ( int  myid,
int  wait_status,
int  last_query_offset_recv,
int *  last_query_offset_comp_p,
struct query_result_s query_result_list,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

Check for all the irecvs from all queries that had results from this worker. Post irecvs for the actual offset array when the size irecv is completed. Check for both the sizes and the actual offset arrays.

Parameters:
myid MPI myid.
wait_status_p Pointer to the wait status of the worker.
last_query_offset_recv Last query to look for offset irecv.
last_query_offset_comp_p Pointer to information set in this function of the last query to look for offset irecvs.
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 worker_check_isend_results ( int  myid,
int  wait_status,
struct work_info_s last_query_result_sent_p,
struct work_info_s last_query_result_comp_p,
struct query_result_s query_result_list,
struct isend_info_s **  query_frag_isend_matrix,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

The worker occasionally uses this function to check on the state of all its isends to the master for every (query,frag) it has processed. It checks the isends in order so that it can avoid checking a large amount of isend requests every time it is called.

Parameters:
myid MPI myid.
wait_status_p Pointer to the wait status of the worker.
last_query_result_sent_p Pointer to the work_info structure of the last (query,frag) sent.
last_query_result_comp_p Pointer to the work_info structure of the next (query,frag) to be checked (changed in this function).
query_result_list The head of the result list for a query.
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.
Returns:
0 on success.

int worker_isend_results ( int  myid,
struct work_info_s work_info_p,
int *  last_query_offset_recv_p,
struct isend_info_s **  query_frag_isend_matrix,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

Given work info (query,frag), the worker sends the results to the master. The results are first copied into a contiguous buffer. The size is sent in a first isend and then the actual result is sent in the next isend. The result data is sent only in the master-writing mode.

Parameters:
myid MPI myid.
work_info_p Pointer to work information structure.
last_query_offset_recv_p Pointer to information set in this function of the last query to look for offset irecv.
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.
Returns:
0 on success.

int worker_post_irecv ( int  myid,
struct work_info_s work_info_p,
struct query_result_s query_result_list,
struct mpe_events_s mpe_events_p,
struct test_params_s test_params_p 
)

If the worker is using parallel I/O, it will have to receive the offset array from the master. It posts a irecv here for this query. Since it is possible that a irecv was already posted for this query, this function should not be called in that case.

Parameters:
myid MPI myid.
work_info_p Pointer to work information structure.
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.


Variable Documentation

char* decode_req[MAX_REQ]

int64_t global_debug_mask


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