diff --git a/ompi/mca/topo/treematch/topo_treematch.h b/ompi/mca/topo/treematch/topo_treematch.h index 2a73118dec..bcc4d748bf 100644 --- a/ompi/mca/topo/treematch/topo_treematch.h +++ b/ompi/mca/topo/treematch/topo_treematch.h @@ -70,7 +70,7 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* module, int n, const int nodes[], const int degrees[], const int targets[], const int weights[], - struct ompi_info_t *info, int reorder, + struct opal_info_t *info, int reorder, ompi_communicator_t **newcomm); /* * ****************************************************************** diff --git a/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c b/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c index daf406dc01..76af20bc1d 100644 --- a/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c +++ b/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c @@ -114,7 +114,7 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module, int n, const int nodes[], const int degrees[], const int targets[], const int weights[], - struct ompi_info_t *info, int reorder, + struct opal_info_t *info, int reorder, ompi_communicator_t **newcomm) { int err; @@ -613,7 +613,7 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module, if (obj_mapping[i] != -1) tm_topology->nb_constraints++; tm_topology->constraints = (int *)calloc(tm_topology->nb_constraints,sizeof(int)); - for(idx = 0,i = 0; i < tm_topology->nb_proc_units ; i++) + for(idx = 0, i = 0; i < tm_topology->nb_proc_units ; i++) if (obj_mapping[i] != -1) tm_topology->constraints[idx++] = obj_mapping[i]; diff --git a/ompi/mca/topo/treematch/treematch/PriorityQueue.c b/ompi/mca/topo/treematch/treematch/PriorityQueue.c index 004224e300..471583f4af 100644 --- a/ompi/mca/topo/treematch/treematch/PriorityQueue.c +++ b/ompi/mca/topo/treematch/treematch/PriorityQueue.c @@ -4,11 +4,7 @@ /* This comparison function is used to sort elements in key descending order. */ -int compfunc(const FiboNode * const, const FiboNode * const); - - - -int compFunc(const FiboNode * const node1, const FiboNode * const node2) +static int compFunc(const FiboNode * const node1, const FiboNode * const node2) { return ( ( ((QueueElement*)(node1))->key > ((QueueElement*)(node2))->key ) ? -1 : 1); diff --git a/ompi/mca/topo/treematch/treematch/tm_bucket.c b/ompi/mca/topo/treematch/treematch/tm_bucket.c index 59d93e8e00..88719cf925 100644 --- a/ompi/mca/topo/treematch/treematch/tm_bucket.c +++ b/ompi/mca/topo/treematch/treematch/tm_bucket.c @@ -31,7 +31,7 @@ static int ilog2(int val) static int verbose_level = ERROR; -bucket_list_t global_bl; +static bucket_list_t global_bl; int tab_cmp(const void*,const void*); int old_bucket_id(int,int,bucket_list_t); @@ -199,7 +199,7 @@ void add_to_bucket(int id,int i,int j,bucket_list_t bucket_list) /* display_bucket(bucket);*/ if(verbose_level >= DEBUG){ printf("Extending bucket %d (%p) from size %d to size %d!\n", - id,bucket->bucket, bucket->nb_elem, bucket->nb_elem+size); + id, (void*)bucket->bucket, bucket->nb_elem, bucket->nb_elem+size); } bucket->bucket = (coord*)REALLOC(bucket->bucket,sizeof(coord)*(size + bucket->bucket_len)); @@ -525,7 +525,7 @@ void partial_update_val (int nb_args, void **args, int thread_id){ if(nb_args != 5){ if(verbose_level >= ERROR) - fprintf(stderr,"(Thread: %d) Wrong number of args in %s: %d\n",thread_id, __FUNCTION__, nb_args); + fprintf(stderr,"(Thread: %d) Wrong number of args in %s: %d\n",thread_id, __func__, nb_args); exit(-1); } diff --git a/ompi/mca/topo/treematch/treematch/tm_kpartitioning.c b/ompi/mca/topo/treematch/treematch/tm_kpartitioning.c index 282e7f7e04..a1a1bb0935 100644 --- a/ompi/mca/topo/treematch/treematch/tm_kpartitioning.c +++ b/ompi/mca/topo/treematch/treematch/tm_kpartitioning.c @@ -294,7 +294,7 @@ com_mat_t **split_com_mat(com_mat_t *com_mat, int n, int k, int *partition) printf("Partition: "); print_1D_tab(partition,n); display_tab(com_mat->comm,com_mat->n); printf("m=%d,n=%d,k=%d\n",m,n,k); - printf("perm=%p\n",perm); + printf("perm=%p\n", (void*)perm); } perm = (int*)MALLOC(sizeof(int)*m); @@ -425,8 +425,8 @@ void free_const_tab(constraint_t *const_tab, int k) FREE(const_tab); } - -void check_com_mat(com_mat_t *com_mat){ +#if 0 +static void check_com_mat(com_mat_t *com_mat){ int i,j; for( i = 0 ; i < com_mat->n ; i++ ) @@ -435,9 +435,8 @@ void check_com_mat(com_mat_t *com_mat){ printf("com_mat->comm[%d][%d]= %f\n",i,j,com_mat->comm[i][j]); exit(-1); } - - } +#endif void kpartition_build_level_topology(tm_tree_t *cur_node, com_mat_t *com_mat, int N, int depth, tm_topology_t *topology, int *local_vertices, diff --git a/ompi/mca/topo/treematch/treematch/tm_malloc.c b/ompi/mca/topo/treematch/treematch/tm_malloc.c index cc6e711bf3..541dc35754 100644 --- a/ompi/mca/topo/treematch/treematch/tm_malloc.c +++ b/ompi/mca/topo/treematch/treematch/tm_malloc.c @@ -36,7 +36,7 @@ static void init_extra_data(void); -char *my_strdup(char* string){ +static char *my_strdup(char* string){ int size = 1+strlen(string); char *res = (char*)malloc(size*sizeof(char)); diff --git a/ompi/mca/topo/treematch/treematch/tm_mapping.c b/ompi/mca/topo/treematch/treematch/tm_mapping.c index 3c50abe6c4..3472b4a998 100644 --- a/ompi/mca/topo/treematch/treematch/tm_mapping.c +++ b/ompi/mca/topo/treematch/treematch/tm_mapping.c @@ -34,25 +34,6 @@ typedef struct { } hash2_t; -tm_affinity_mat_t * new_affinity_mat(double **mat, double *sum_row, int order); -int compute_nb_leaves_from_level(int depth,tm_topology_t *topology); -void depth_first(tm_tree_t *comm_tree, int *proc_list,int *i); -int fill_tab(int **new_tab,int *tab, int n, int start, int max_val, int shift); -void init_mat(char *filename,int N, double **mat, double *sum_row); -void map_topology(tm_topology_t *topology,tm_tree_t *comm_tree, int level, - int *sigma, int nb_processes, int **k, int nb_compute_units); -int nb_leaves(tm_tree_t *comm_tree); -int nb_lines(char *filename); -int nb_processing_units(tm_topology_t *topology); -void print_1D_tab(int *tab,int N); -tm_solution_t * tm_compute_mapping(tm_topology_t *topology,tm_tree_t *comm_tree); -void tm_finalize(); -void tm_free_affinity_mat(tm_affinity_mat_t *aff_mat); -tm_affinity_mat_t *tm_load_aff_mat(char *filename); -void update_comm_speed(double **comm_speed,int old_size,int new_size); -tm_affinity_mat_t * tm_build_affinity_mat(double **mat, int order); - - /* compute the number of leaves of any subtree starting froma node of depth depth*/ int compute_nb_leaves_from_level(int depth,tm_topology_t *topology) { @@ -280,7 +261,7 @@ int nb_leaves(tm_tree_t *comm_tree) } /* find the first '-1 in the array of size n and put the value there*/ -void set_val(int *tab, int val, int n){ +static void set_val(int *tab, int val, int n){ int i = 0; while (i < n ){ diff --git a/ompi/mca/topo/treematch/treematch/tm_mapping.h b/ompi/mca/topo/treematch/treematch/tm_mapping.h index 391073b6ae..97b3a728a7 100644 --- a/ompi/mca/topo/treematch/treematch/tm_mapping.h +++ b/ompi/mca/topo/treematch/treematch/tm_mapping.h @@ -19,7 +19,6 @@ int nb_lines(char *filename); int nb_processing_units(tm_topology_t *topology); void print_1D_tab(int *tab,int N); tm_solution_t * tm_compute_mapping(tm_topology_t *topology,tm_tree_t *comm_tree); -void tm_finalize(); void tm_free_affinity_mat(tm_affinity_mat_t *aff_mat); tm_affinity_mat_t *tm_load_aff_mat(char *filename); void update_comm_speed(double **comm_speed,int old_size,int new_size); diff --git a/ompi/mca/topo/treematch/treematch/tm_solution.c b/ompi/mca/topo/treematch/treematch/tm_solution.c index ee741d73be..a0fde41e29 100644 --- a/ompi/mca/topo/treematch/treematch/tm_solution.c +++ b/ompi/mca/topo/treematch/treematch/tm_solution.c @@ -10,27 +10,6 @@ typedef struct { } hash_t; - -void tm_free_solution(tm_solution_t *sol); -int distance(tm_topology_t *topology,int i, int j); -double display_sol_sum_com(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, int *sigma); - double display_sol(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, int *sigma, tm_metric_t metric); -double tm_display_solution(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, tm_solution_t *sol, - tm_metric_t metric); -void tm_display_other_heuristics(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, tm_metric_t metric); -int in_tab(int *tab, int n, int val); -void map_Packed(tm_topology_t *topology, int N, int *sigma); -void map_RR(tm_topology_t * topology, int N, int *sigma); -int hash_asc(const void* x1,const void* x2); -int *generate_random_sol(tm_topology_t *topology,int N,int level,int seed); -double eval_sol(int *sol,int N,double **comm, double **arch); -void exchange(int *sol,int i,int j); -double gain_exchange(int *sol,int l,int m,double eval1,int N,double **comm, double **arch); -void select_max(int *l,int *m,double **gain,int N,int *state); -void compute_gain(int *sol,int N,double **gain,double **comm, double **arch); -void map_MPIPP(tm_topology_t *topology,int nb_seed,int N,int *sigma,double **comm, double **arch); - - void tm_free_solution(tm_solution_t *sol){ int i,n; @@ -120,7 +99,7 @@ double display_sol_sum_com(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, } -double display_sol_max_com(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, int *sigma) +static double display_sol_max_com(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, int *sigma) { double a,c,sol; int i,j; @@ -156,7 +135,7 @@ double display_sol_max_com(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, return sol; } -double display_sol_hop_byte(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, int *sigma) +static double display_sol_hop_byte(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, int *sigma) { double c,sol; int nb_hops; diff --git a/ompi/mca/topo/treematch/treematch/tm_topology.c b/ompi/mca/topo/treematch/treematch/tm_topology.c index 341194801a..8f3ae9401f 100644 --- a/ompi/mca/topo/treematch/treematch/tm_topology.c +++ b/ompi/mca/topo/treematch/treematch/tm_topology.c @@ -115,7 +115,7 @@ int topo_nb_proc(hwloc_topology_t topology,int N) -double link_cost(int depth) +static double link_cost(int depth) { /* Bertha values @@ -427,7 +427,7 @@ int int_cmp_inc(const void* x1,const void* x2) } -int topo_check_constraints(tm_topology_t *topology){ +static int topo_check_constraints(tm_topology_t *topology){ int n = topology->nb_constraints; int i; int depth = topology->nb_levels-1; @@ -447,7 +447,7 @@ int topo_check_constraints(tm_topology_t *topology){ /* cpy flag tells if we need to copy the array. Set to 1 when called from the application level and 0 when called from inside the library*/ -int tm_topology_set_binding_constraints_cpy(int *constraints, int nb_constraints, tm_topology_t *topology, int cpy_flag){ +static int tm_topology_set_binding_constraints_cpy(int *constraints, int nb_constraints, tm_topology_t *topology, int cpy_flag){ topology -> nb_constraints = nb_constraints; if(cpy_flag){ diff --git a/ompi/mca/topo/treematch/treematch/tm_tree.c b/ompi/mca/topo/treematch/treematch/tm_tree.c index e3c5e29385..946f01b69c 100644 --- a/ompi/mca/topo/treematch/treematch/tm_tree.c +++ b/ompi/mca/topo/treematch/treematch/tm_tree.c @@ -5,6 +5,7 @@ #include #include +#include "treematch.h" #include "tm_tree.h" #include "tm_mapping.h" #include "tm_timings.h" @@ -244,7 +245,7 @@ void partial_aggregate_aff_mat (int nb_args, void **args, int thread_id){ if(nb_args != 7){ if(verbose_level >= ERROR) - fprintf(stderr, "Thread %d: Wrong number of args in %s: %d\n", thread_id, __FUNCTION__, nb_args); + fprintf(stderr, "Thread %d: Wrong number of args in %s: %d\n", thread_id, __func__, nb_args); exit(-1); } @@ -268,7 +269,7 @@ void partial_aggregate_aff_mat (int nb_args, void **args, int thread_id){ } -tm_affinity_mat_t *aggregate_aff_mat(tm_tree_t *tab_node, tm_affinity_mat_t *aff_mat, int M) +static tm_affinity_mat_t *aggregate_aff_mat(tm_tree_t *tab_node, tm_affinity_mat_t *aff_mat, int M) { int i, j, i1, j1, id1, id2; double **new_mat = NULL, **old_mat = aff_mat->mat; @@ -702,7 +703,7 @@ int select_independent_groups(group_list_t **tab_group, int n, int arity, int M } -int8_t** init_independent_group_mat(int n, group_list_t **tab_group, int arity){ +static int8_t** init_independent_group_mat(int n, group_list_t **tab_group, int arity){ int i, j, ii, jj; int8_t **indep_mat = (int8_t **)MALLOC(sizeof(int8_t*) *n); @@ -730,7 +731,7 @@ int8_t** init_independent_group_mat(int n, group_list_t **tab_group, int arity){ return indep_mat; } -int independent_groups_mat(group_list_t **selection, int selection_size, group_list_t *elem, int8_t **indep_mat) +static int independent_groups_mat(group_list_t **selection, int selection_size, group_list_t *elem, int8_t **indep_mat) { int i; int id_elem = elem->id; @@ -753,7 +754,7 @@ int independent_groups_mat(group_list_t **selection, int selection_size, group_l static long int y=0; -int thread_derecurs_exhaustive_search(group_list_t **tab_group, int i, int nb_groups, int arity, int depth, int solution_size, +static int thread_derecurs_exhaustive_search(group_list_t **tab_group, int i, int nb_groups, int arity, int depth, int solution_size, double val, double *best_val, group_list_t **selection, group_list_t **best_selection, int8_t **indep_mat, pthread_mutex_t *lock, int thread_id, int *tab_i, int start_depth){ @@ -841,8 +842,8 @@ int thread_derecurs_exhaustive_search(group_list_t **tab_group, int i, int nb_gr return 0; } - -group_list_t * group_dup(group_list_t *group, int nb_groups){ +#if 0 +static group_list_t * group_dup(group_list_t *group, int nb_groups){ group_list_t *elem = NULL; /* tm_tree_t **tab = NULL; */ double *bound; @@ -866,8 +867,10 @@ group_list_t * group_dup(group_list_t *group, int nb_groups){ return elem; } +#endif -group_list_t ** tab_group_dup(group_list_t **tab_group, int nb_groups){ +#if 0 +static group_list_t ** tab_group_dup(group_list_t **tab_group, int nb_groups){ group_list_t **res; int i; @@ -881,8 +884,10 @@ group_list_t ** tab_group_dup(group_list_t **tab_group, int nb_groups){ return res; } +#endif -int8_t **indep_mat_dup(int8_t** mat, int n){ +#if 0 +static int8_t **indep_mat_dup(int8_t** mat, int n){ int i; int8_t ** res = (int8_t**)MALLOC(sizeof(int8_t*)*n); int row_len; @@ -895,9 +900,9 @@ int8_t **indep_mat_dup(int8_t** mat, int n){ return res; } +#endif - -void partial_exhaustive_search(int nb_args, void **args, int thread_id){ +static void partial_exhaustive_search(int nb_args, void **args, int thread_id){ int i, j; group_list_t **selection = NULL; double val; @@ -921,7 +926,7 @@ void partial_exhaustive_search(int nb_args, void **args, int thread_id){ if(nb_args!=9){ if(verbose_level>=ERROR){ - fprintf(stderr, "Id: %d: bad number of argument for function %s: %d instead of 9\n", thread_id, __FUNCTION__, nb_args); + fprintf(stderr, "Id: %d: bad number of argument for function %s: %d instead of 9\n", thread_id, __func__, nb_args); return; } } @@ -1004,19 +1009,20 @@ void partial_exhaustive_search(int nb_args, void **args, int thread_id){ } - -int dbl_cmp_dec(const void* x1,const void* x2) +#if 0 +static int dbl_cmp_dec(const void* x1,const void* x2) { return *((double *)x1) > *((double *)x2) ? -1 : 1; } -int dbl_cmp_inc(const void* x1,const void* x2) +#endif +static int dbl_cmp_inc(const void* x1,const void* x2) { return *((double *)x1) < *((double *)x2) ? -1 : 1; } -double *build_bound_array(double *tab, int n){ +static double *build_bound_array(double *tab, int n){ int i; double *bound; @@ -1045,7 +1051,7 @@ double *build_bound_array(double *tab, int n){ return bound; } -work_unit_t *create_work_unit(work_unit_t *cur, int *tab,int size){ +static work_unit_t *create_work_unit(work_unit_t *cur, int *tab,int size){ work_unit_t *res = (work_unit_t *) CALLOC(1,sizeof(work_unit_t)); int *tab_group = MALLOC(size*sizeof(int)); memcpy(tab_group, tab, size*sizeof(int)); @@ -1056,7 +1062,7 @@ work_unit_t *create_work_unit(work_unit_t *cur, int *tab,int size){ return res; } -work_unit_t *generate_work_units(work_unit_t *cur, int i, int id, int *tab_group,int size, int id_max){ +static work_unit_t *generate_work_units(work_unit_t *cur, int i, int id, int *tab_group,int size, int id_max){ tab_group[i] = id; if(i==size-1){ @@ -1076,7 +1082,7 @@ work_unit_t *generate_work_units(work_unit_t *cur, int i, int id, int *tab_grou } -work_unit_t *create_tab_work(int n){ +static work_unit_t *create_tab_work(int n){ int work_size = 4; int i; work_unit_t *cur,*res = (work_unit_t *) CALLOC(1,sizeof(work_unit_t)); @@ -1100,7 +1106,7 @@ work_unit_t *create_tab_work(int n){ } -int thread_exhaustive_search(group_list_t **tab_group, int nb_groups, int arity, int solution_size, double *best_val, +static int thread_exhaustive_search(group_list_t **tab_group, int nb_groups, int arity, int solution_size, double *best_val, group_list_t **best_selection){ pthread_mutex_t lock; @@ -1203,8 +1209,8 @@ int thread_exhaustive_search(group_list_t **tab_group, int nb_groups, int arity, return 0; } - -int old_recurs_exhaustive_search(group_list_t **tab, int i, int n, int arity, int d, int solution_size, double val, double *best_val, group_list_t **selection, group_list_t **best_selection, int8_t **indep_mat) +#if 0 +static int old_recurs_exhaustive_search(group_list_t **tab, int i, int n, int arity, int d, int solution_size, double val, double *best_val, group_list_t **selection, group_list_t **best_selection, int8_t **indep_mat) { group_list_t *elem = NULL; @@ -1243,10 +1249,10 @@ int old_recurs_exhaustive_search(group_list_t **tab, int i, int n, int arity, in return 0; } +#endif - - -int recurs_exhaustive_search(group_list_t **tab, int i, int n, int arity, int d, int solution_size, double val, double *best_val, group_list_t **selection, group_list_t **best_selection, int8_t **indep_mat, int* tab_i) +#if 0 +static int recurs_exhaustive_search(group_list_t **tab, int i, int n, int arity, int d, int solution_size, double val, double *best_val, group_list_t **selection, group_list_t **best_selection, int8_t **indep_mat, int* tab_i) { group_list_t *elem = NULL; @@ -1296,10 +1302,10 @@ int recurs_exhaustive_search(group_list_t **tab, int i, int n, int arity, int d, return 0; } +#endif - - -int exhaustive_search(group_list_t **tab_group, int n, int arity, int solution_size, double *best_val, +#if 0 +static int exhaustive_search(group_list_t **tab_group, int n, int arity, int solution_size, double *best_val, group_list_t **best_selection) { int i, j; @@ -1359,7 +1365,7 @@ int exhaustive_search(group_list_t **tab_group, int n, int arity, int solution_ return 0; } - +#endif int select_independent_groups_by_largest_index(group_list_t **tab_group, int n, int arity, int solution_size, double *best_val, group_list_t **best_selection, int bound, double max_duration) @@ -1560,7 +1566,7 @@ double fast_grouping(tm_affinity_mat_t *aff_mat, tm_tree_t *tab_node, tm_tree_t return val; } -double k_partition_grouping(tm_affinity_mat_t *aff_mat, tm_tree_t *tab_node, tm_tree_t *new_tab_node, int arity, int solution_size) { +static double k_partition_grouping(tm_affinity_mat_t *aff_mat, tm_tree_t *tab_node, tm_tree_t *new_tab_node, int arity, int solution_size) { int *partition = NULL; int n = aff_mat->order; com_mat_t com_mat; diff --git a/ompi/mca/topo/treematch/treematch/treematch.h b/ompi/mca/topo/treematch/treematch/treematch.h index 920dffcbae..8891c819d0 100644 --- a/ompi/mca/topo/treematch/treematch/treematch.h +++ b/ompi/mca/topo/treematch/treematch/treematch.h @@ -168,7 +168,7 @@ void tm_free_affinity_mat(tm_affinity_mat_t *aff_mat); void tm_set_verbose_level(unsigned int level); unsigned int tm_get_verbose_level(void); /* finalize treematch :check memory if necessary, and free internal variables (thread pool)*/ -void tm_finalize(); +void tm_finalize(void); /* Ask for exhaustive search: may be very long @@ -176,7 +176,7 @@ Ask for exhaustive search: may be very long new_val != 0 : exhuative search */ void tm_set_exhaustive_search_flag(int new_val); -int tm_get_exhaustive_search_flag(); +int tm_get_exhaustive_search_flag(void); /* Setting the maximum number of threads you want to use in parallel parts of TreeMatch */