Skip to content

Commit 74f2365

Browse files
committed
Remove most (all) warnings from the new TreeMatch.
Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
1 parent 27aa34e commit 74f2365

File tree

10 files changed

+68
-73
lines changed

10 files changed

+68
-73
lines changed

ompi/mca/topo/treematch/treematch/PriorityQueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ int compfunc(const FiboNode * const, const FiboNode * const);
88

99

1010

11-
int compFunc(const FiboNode * const node1, const FiboNode * const node2)
11+
static int compFunc(const FiboNode * const node1, const FiboNode * const node2)
1212
{
1313
return
1414
( ( ((QueueElement*)(node1))->key > ((QueueElement*)(node2))->key ) ? -1 : 1);

ompi/mca/topo/treematch/treematch/tm_bucket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ void partial_update_val (int nb_args, void **args, int thread_id){
525525

526526
if(nb_args != 5){
527527
if(verbose_level >= ERROR)
528-
fprintf(stderr,"(Thread: %d) Wrong number of args in %s: %d\n",thread_id, __FUNCTION__, nb_args);
528+
fprintf(stderr,"(Thread: %d) Wrong number of args in %s: %d\n",thread_id, __func__, nb_args);
529529
exit(-1);
530530
}
531531

ompi/mca/topo/treematch/treematch/tm_kpartitioning.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#include <stdio.h>
77
#include "config.h"
88

9-
#if HAVE_LIBSCOTCH
9+
#if defined(HAVE_LIBSCOTCH)
1010
#include <scotch.h>
11-
#endif
11+
#endif /* defined(HAVE_LIBSCOTCH) */
1212

1313

1414
#define USE_KL_KPART 0
@@ -49,7 +49,7 @@ int tm_get_greedy_flag(){
4949
}
5050

5151

52-
#if HAVE_LIBSCOTCH
52+
#if defined(HAVE_LIBSCOTCH)
5353

5454
SCOTCH_Graph* com_mat_to_scotch_graph(com_mat_t *com_mat, int n){
5555
double **mat = com_mat->comm;
@@ -284,7 +284,7 @@ int *kpartition_scotch(int k, com_mat_t *com_mat, int n, int *constraints, int
284284
return partition;
285285
}
286286

287-
#endif /* HAVE_LIBSCOTCH */
287+
#endif /* defined(HAVE_LIBSCOTCH) */
288288

289289

290290
void allocate_vertex(int u, int *res, com_mat_t *com_mat, int n, int *size, int max_size)
@@ -475,7 +475,7 @@ int *kpartition(int k, com_mat_t *com_mat, int n, int *constraints, int nb_const
475475
/* else */
476476

477477

478-
#if HAVE_LIBSCOTCH
478+
#if defined(HAVE_LIBSCOTCH)
479479
if(!greedy_flag){
480480
if(verbose_level >= DEBUG)
481481
printf("Using Scotch\n");
@@ -485,11 +485,11 @@ int *kpartition(int k, com_mat_t *com_mat, int n, int *constraints, int nb_const
485485
printf("Using greedy partitionning\n");
486486
res = kpartition_greedy(k, com_mat, n, constraints, nb_constraints);
487487
}
488-
#else
488+
#else /* defined(HAVE_LIBSCOTCH) */
489489
if(verbose_level >= DEBUG)
490490
printf("Using greedy partitionning\n");
491491
res = kpartition_greedy(k, com_mat, n, constraints, nb_constraints);
492-
#endif
492+
#endif /* defined(HAVE_LIBSCOTCH) */
493493
return res;
494494
}
495495

@@ -684,8 +684,8 @@ void free_const_tab(constraint_t *const_tab, int k)
684684
FREE(const_tab);
685685
}
686686

687-
688-
void check_com_mat(com_mat_t *com_mat){
687+
#if 0
688+
static void check_com_mat(com_mat_t *com_mat){
689689
int i,j;
690690

691691
for( i = 0 ; i < com_mat->n ; i++ )
@@ -694,16 +694,15 @@ void check_com_mat(com_mat_t *com_mat){
694694
printf("com_mat->comm[%d][%d]= %f\n",i,j,com_mat->comm[i][j]);
695695
exit(-1);
696696
}
697-
698-
699697
}
698+
#endif
700699

701-
void print_tab(int n){
700+
static void print_tab(int n){
702701
for(;n;n--)
703702
fprintf(stdout,"\t");
704703
}
705704

706-
void display_partition(int *partition, int *local_vertices, int n, int depth, int k){
705+
static void display_partition(int *partition, int *local_vertices, int n, int depth, int k){
707706
int cur_part, j;
708707
print_tab(depth);fprintf(stdout,"Partitions at depth=%d\n",depth);
709708
for( cur_part = 0; cur_part < k ; cur_part ++){

ompi/mca/topo/treematch/treematch/tm_malloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static void init_extra_data(void);
3636

3737

3838

39-
char *my_strdup(char* string){
39+
static char *my_strdup(char* string){
4040
int size = 1+strlen(string);
4141
char *res = (char*)malloc(size*sizeof(char));
4242

ompi/mca/topo/treematch/treematch/tm_mapping.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
#include <winbase.h>
2323
#endif
2424

25-
#if HAVE_LIBSCOTCH
25+
#if defined(HAVE_LIBSCOTCH)
2626
#include <scotch.h>
27-
#endif
27+
#endif /* defined(HAVE_LIBSCOTCH) */
2828

2929
#include <sys/mman.h>
3030

@@ -58,7 +58,6 @@ int nb_leaves(tm_tree_t *comm_tree);
5858
int nb_lines(char *filename);
5959
void print_1D_tab(int *tab,int N);
6060
tm_solution_t * tm_compute_mapping(tm_topology_t *topology,tm_tree_t *comm_tree);
61-
void tm_finalize();
6261
void tm_free_affinity_mat(tm_affinity_mat_t *aff_mat);
6362
tm_affinity_mat_t *tm_load_aff_mat(char *filename);
6463
void update_comm_speed(double **comm_speed,int old_size,int new_size);
@@ -172,14 +171,14 @@ long int init_mat(char *filename,int N, double **mat, double *sum_row){
172171
}
173172

174173

175-
size_t get_filesize(char* filename) {
174+
static size_t get_filesize(char* filename) {
176175
struct stat st;
177176
stat(filename, &st);
178177
return st.st_size;
179178
}
180179

181180

182-
char *parse_line(int i, double **mat, double *sum_row, int N, char *data, char *filename, long int *nnz){
181+
static char *parse_line(int i, double **mat, double *sum_row, int N, char *data, char *filename, long int *nnz){
183182
/* now parse the buffer byte per byte for the current line i until we reach '\n'*/
184183
unsigned int vl = tm_get_verbose_level();
185184
long val;
@@ -215,7 +214,7 @@ char *parse_line(int i, double **mat, double *sum_row, int N, char *data, char *
215214

216215

217216
/* buffered read with mmap of teh file */
218-
long int init_mat_mmap(char *filename,int N, double **mat, double *sum_row){
217+
static long int init_mat_mmap(char *filename,int N, double **mat, double *sum_row){
219218
int i;
220219
unsigned int vl = tm_get_verbose_level();
221220
size_t filesize = get_filesize(filename);
@@ -251,7 +250,7 @@ long int init_mat_mmap(char *filename,int N, double **mat, double *sum_row){
251250

252251

253252

254-
long int init_mat_long(char *filename,int N, double **mat, double *sum_row){
253+
static long int init_mat_long(char *filename,int N, double **mat, double *sum_row){
255254
int i;
256255
unsigned int vl = tm_get_verbose_level();
257256
char line[LINE_SIZE];
@@ -425,7 +424,7 @@ int nb_leaves(tm_tree_t *comm_tree)
425424
}
426425

427426
/* find the first '-1 in the array of size n and put the value there*/
428-
void set_val(int *tab, int val, int n){
427+
static void set_val(int *tab, int val, int n){
429428
int i = 0;
430429

431430
while (i < n ){

ompi/mca/topo/treematch/treematch/tm_mapping.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ int nb_lines(char *filename);
1919
int nb_processing_units(tm_topology_t *topology);
2020
void print_1D_tab(int *tab,int N);
2121
tm_solution_t * tm_compute_mapping(tm_topology_t *topology,tm_tree_t *comm_tree);
22-
void tm_finalize();
2322
void tm_free_affinity_mat(tm_affinity_mat_t *aff_mat);
2423
tm_affinity_mat_t *tm_load_aff_mat(char *filename);
2524
void update_comm_speed(double **comm_speed,int old_size,int new_size);

ompi/mca/topo/treematch/treematch/tm_solution.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ double display_sol_sum_com(tm_topology_t *topology, tm_affinity_mat_t *aff_mat,
106106
a = cost[depth-distance(topology,sigma[i],sigma[j])];
107107
if(tm_get_verbose_level() >= DEBUG)
108108
printf("T_%d_%d %f*%f=%f\n",i,j,c,a,c*a);
109-
sol += c*a;
109+
sol += c*a;
110110
}
111111

112112
for (i = 0; i < N; i++) {
@@ -120,7 +120,7 @@ double display_sol_sum_com(tm_topology_t *topology, tm_affinity_mat_t *aff_mat,
120120
}
121121

122122

123-
double display_sol_max_com(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, int *sigma)
123+
static double display_sol_max_com(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, int *sigma)
124124
{
125125
double a,c,sol;
126126
int i,j;
@@ -156,7 +156,7 @@ double display_sol_max_com(tm_topology_t *topology, tm_affinity_mat_t *aff_mat,
156156
return sol;
157157
}
158158

159-
double display_sol_hop_byte(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, int *sigma)
159+
static double display_sol_hop_byte(tm_topology_t *topology, tm_affinity_mat_t *aff_mat, int *sigma)
160160
{
161161
double c,sol;
162162
int nb_hops;
@@ -171,7 +171,7 @@ double display_sol_hop_byte(tm_topology_t *topology, tm_affinity_mat_t *aff_mat,
171171
nb_hops = 2*distance(topology,sigma[i],sigma[j]);
172172
if(tm_get_verbose_level() >= DEBUG)
173173
printf("T_%d_%d %f*%d=%f\n",i,j,c,nb_hops,c*nb_hops);
174-
sol += c*nb_hops;
174+
sol += c*nb_hops;
175175
}
176176

177177
for (i = 0; i < N; i++) {
@@ -278,7 +278,7 @@ int in_tab(int *tab, int n, int val){
278278
if(tab[i] == val)
279279
return 1;
280280

281-
return 0;
281+
return 0;
282282
}
283283

284284
void map_Packed(tm_topology_t *topology, int N, int *sigma)

ompi/mca/topo/treematch/treematch/tm_topology.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ double ** topology_to_arch(hwloc_topology_t topology);
2828
void build_synthetic_proc_id(tm_topology_t *topology);
2929
tm_topology_t *tm_build_synthetic_topology(int *arity, double *cost, int nb_levels, int *core_numbering, int nb_core_per_nodes);
3030
void tm_set_numbering(tm_numbering_t new_val); /* TM_NUMBERING_LOGICAL or TM_NUMBERING_PHYSICAL */
31-
tm_numbering_t tm_get_numbering(); /* TM_NUMBERING_LOGICAL or TM_NUMBERING_PHYSICAL */
3231

3332

3433
#define LINE_SIZE (1000000)
@@ -135,8 +134,7 @@ int topo_nb_proc(hwloc_topology_t topology,int N)
135134
}
136135

137136

138-
139-
double link_cost(int depth)
137+
static double link_cost(int depth)
140138
{
141139
/*
142140
Bertha values
@@ -154,7 +152,6 @@ double link_cost(int depth)
154152
*/
155153
}
156154

157-
158155
double ** topology_to_arch(hwloc_topology_t topology)
159156
{
160157
int nb_proc,i,j;
@@ -198,7 +195,7 @@ int symetric(hwloc_topology_t topology)
198195
return 1;
199196
}
200197

201-
void build_process_tab_id(tm_topology_t *topology, hwloc_obj_t *objs, char* filename){
198+
static void build_process_tab_id(tm_topology_t *topology, hwloc_obj_t *objs, char* filename){
202199
unsigned int i,j;
203200
unsigned int nb_nodes = topology->nb_proc_units;
204201
int vl = tm_get_verbose_level();
@@ -482,7 +479,7 @@ int int_cmp_inc(const void* x1,const void* x2)
482479
}
483480

484481

485-
int topo_check_constraints(tm_topology_t *topology){
482+
static int topo_check_constraints(tm_topology_t *topology){
486483
int n = topology->nb_constraints;
487484
int i;
488485
int depth = topology->nb_levels-1;
@@ -502,7 +499,7 @@ int topo_check_constraints(tm_topology_t *topology){
502499

503500
/* cpy flag tells if we need to copy the array.
504501
Set to 1 when called from the application level and 0 when called from inside the library*/
505-
int tm_topology_set_binding_constraints_cpy(int *constraints, int nb_constraints, tm_topology_t *topology, int cpy_flag){
502+
static int tm_topology_set_binding_constraints_cpy(int *constraints, int nb_constraints, tm_topology_t *topology, int cpy_flag){
506503

507504
topology -> nb_constraints = nb_constraints;
508505
if(cpy_flag){

0 commit comments

Comments
 (0)