#ifndef a2_1_h #define a2_1_h /* POSTPONED: input generated randomly input File Format First Line consists of the number of records to follow Next N Lines: The N records to be sorted -> Record Format: -> Key Data(type:MPI_FLOAT) #define Input_file "unsorted_list.txt" #define Output_file "sorted_list.txt" */ typedef struct { int key; float data; } Element; Element record; /* a representative variable of this type */ int lena[2]; MPI_Aint loca[2]; MPI_Datatype typa[2]; MPI_Aint baseaddress; MPI_Datatype MPI_Record; typedef struct { int local_list_size; Element *keys; } LOCAL_LIST_T; #define List_size(list) ((list)->local_list_size) #define List(list) ((list)->keys) #define List_free(list) {free List(list);} #define List_key(list,i) (*((list)->keys + i)) void init_data(Element **records,int count); void init_local_keys(LOCAL_LIST_T *local_keys); void Redistribute_keys(LOCAL_LIST_T* local_keys); void Local_sort(LOCAL_LIST_T* local_keys); void Find_alltoall_send_params(LOCAL_LIST_T* local_keys, int send_counts[], int send_displacements[]); void Find_recv_displacements(int recv_counts[], int recv_disp[]); int element_cmp(const Element *a, const Element *b); int int_cmp(const int *a, const int *b); #endif