Skip to content

Commit e67fde8

Browse files
committed
netloc: remove extra warnings
Signed-off-by: Cyril Bordage <[email protected]>
1 parent cb0494b commit e67fde8

File tree

7 files changed

+22
-88
lines changed

7 files changed

+22
-88
lines changed

include/private/netloc.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ int netloc_topology_read_hwloc(netloc_topology_t *topology, int num_nodes,
366366
* Returns
367367
* A newly allocated pointer to the network information.
368368
*/
369-
netloc_node_t * netloc_node_construct(void);
369+
netloc_node_t *netloc_node_construct(void);
370370

371371
/**
372372
* Destructor for netloc_node_t
@@ -379,6 +379,8 @@ netloc_node_t * netloc_node_construct(void);
379379
*/
380380
int netloc_node_destruct(netloc_node_t *node);
381381

382+
char *netloc_node_pretty_print(netloc_node_t* node);
383+
382384
#define netloc_node_get_num_subnodes(node) \
383385
utarray_len((node)->subnodes)
384386

@@ -419,7 +421,7 @@ int netloc_node_is_in_partition(netloc_node_t *node, int partition);
419421
* Returns
420422
* A newly allocated pointer to the edge information.
421423
*/
422-
netloc_edge_t * netloc_edge_construct(void);
424+
netloc_edge_t *netloc_edge_construct(void);
423425

424426
/**
425427
* Destructor for netloc_edge_t
@@ -432,6 +434,8 @@ netloc_edge_t * netloc_edge_construct(void);
432434
*/
433435
int netloc_edge_destruct(netloc_edge_t *edge);
434436

437+
char *netloc_edge_pretty_print(netloc_edge_t* edge);
438+
435439
void netloc_edge_reset_uid(void);
436440

437441
int netloc_edge_is_in_partition(netloc_edge_t *edge, int partition);

netloc/architecture.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ typedef struct netloc_analysis_data_t {
2121

2222
static int partition_topology_to_tleaf(netloc_topology_t *topology,
2323
int partition, int num_cores, netloc_arch_t *arch);
24-
static void set_gbits(int *values, netloc_edge_t *edge, int num_levels);
2524
static netloc_arch_tree_t *tree_merge(netloc_arch_tree_t *main,
2625
netloc_arch_tree_t *sub);
2726
static int netloc_arch_tree_destruct(netloc_arch_tree_t *tree);
@@ -75,7 +74,6 @@ void netloc_arch_tree_complete(netloc_arch_tree_t *tree, UT_array **down_degrees
7574
NETLOC_int max_degree = max_degrees[num_levels-1];
7675
int ghost_idx = 0;
7776
int idx = 0;
78-
netloc_arch_node_t *named_nodes = NULL;
7977
int *arch_idx = (int *)malloc(sizeof(int[num_hosts]));
8078
for (int d = 0; d < num_degrees; d++) {
8179
int degree = degrees[d];
@@ -764,26 +762,6 @@ int partition_topology_to_tleaf(netloc_topology_t *topology,
764762
return ret;
765763
}
766764

767-
void set_gbits(int *values, netloc_edge_t *edge, int num_levels)
768-
{
769-
int gbits = (int)edge->total_gbits;
770-
int idx = num_levels-1-((netloc_analysis_data *)edge->node->userdata)->level;
771-
if (values[idx] != 0) {
772-
if (gbits < values[idx]) {
773-
printf("Warning: edge from %s to %s is only %dGbits\n",
774-
edge->node->description, edge->dest->description,
775-
gbits);
776-
}
777-
else if (gbits > values[idx]) {
778-
printf("Warning: at least on edge from %s has a limited speed\n",
779-
edge->node->description);
780-
values[idx] = gbits;
781-
}
782-
}
783-
else
784-
values[idx] = gbits;
785-
}
786-
787765
int netloc_arch_build(netloc_arch_t *arch, int add_slots)
788766
{
789767
char *partition_name = getenv("NETLOC_PARTITION");

netloc/mpicomm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2016 Inria. All rights reserved.
2+
* Copyright © 2016-2017 Inria. All rights reserved.
33
*
44
* $COPYRIGHT$
55
*
@@ -76,9 +76,9 @@ int netloc_build_comm_mat(char *filename, int *pn, double ***pmat)
7676
i++;
7777
}
7878

79-
8079
if (i != n) {
81-
fprintf(stderr,"Error at %d %d. Too many rows for %s\n",i,j,filename);
80+
fprintf(stderr,"Error at %d %d. Too many rows for %s\n",
81+
i, j, filename);
8282
goto error;
8383
}
8484

netloc/node.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright © 2013-2014 University of Wisconsin-La Crosse.
33
* All rights reserved.
44
* Copyright © 2013 Cisco Systems, Inc. All rights reserved.
5-
* Copyright © 2015-2016 Inria. All rights reserved.
5+
* Copyright © 2015-2017 Inria. All rights reserved.
66
*
77
* $COPYRIGHT$
88
*
@@ -104,7 +104,7 @@ static int node_or_subnode_destruct(netloc_node_t * node, int is_node)
104104
return NETLOC_SUCCESS;
105105
}
106106

107-
char * netloc_node_pretty_print(netloc_node_t* node)
107+
char *netloc_node_pretty_print(netloc_node_t* node)
108108
{
109109
char * str = NULL;
110110

netloc/scotch.c

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
static int arch_tree_to_scotch_arch(netloc_arch_tree_t *tree, SCOTCH_Arch *scotch);
2525
static int comm_matrix_to_scotch_graph(double **matrix, int n, SCOTCH_Graph *graph);
26-
int build_scotch_graph(int n, SCOTCH_Graph *graph);
26+
static int netlocscotch_get_mapping_from_graph(SCOTCH_Graph *graph,
27+
netlocscotch_core_t **pcores);
2728

2829
static int compareint(void const *a, void const *b)
2930
{
@@ -288,7 +289,6 @@ int netlocscotch_get_mapping_from_graph(SCOTCH_Graph *graph,
288289
int num_processes = utarray_len(process_by_node[n]);
289290
netloc_arch_node_t *node =
290291
arch->node_slot_by_idx[arch->current_hosts[n]].node;
291-
char *nodename = node->name;
292292
NETLOC_int node_ranks[num_processes];
293293

294294
/* We need to extract the subgraph with only the vertices mapped to the
@@ -467,55 +467,3 @@ static int comm_matrix_to_scotch_graph(double **matrix, int n, SCOTCH_Graph *gra
467467
return ret;
468468
}
469469

470-
int build_scotch_graph(int n, SCOTCH_Graph *graph)
471-
{
472-
int ret;
473-
474-
SCOTCH_Num base; /* Base value */
475-
SCOTCH_Num vert; /* Number of vertices */
476-
SCOTCH_Num *verttab; /* Vertex array [vertnbr+1] */
477-
SCOTCH_Num *vendtab; /* Vertex array [vertnbr] */
478-
SCOTCH_Num *velotab; /* Vertex load array */
479-
SCOTCH_Num *vlbltab; /* Vertex label array */
480-
SCOTCH_Num edge; /* Number of edges (arcs) */
481-
SCOTCH_Num *edgetab; /* Edge array [edgenbr] */
482-
SCOTCH_Num *edlotab; /* Edge load array */
483-
484-
base = 0;
485-
vert = n;
486-
487-
verttab = (SCOTCH_Num *)malloc((vert+1)*sizeof(SCOTCH_Num));
488-
for (int v = 0; v < vert+1; v++) {
489-
verttab[v] = v*(n-1);
490-
}
491-
492-
vendtab = NULL;
493-
velotab = NULL;
494-
vlbltab = NULL;
495-
496-
edge = n*(n-1);
497-
498-
edgetab = (SCOTCH_Num *)malloc(n*(n-1)*sizeof(SCOTCH_Num));
499-
edlotab = (SCOTCH_Num *)malloc(n*(n-1)*sizeof(SCOTCH_Num));
500-
for (int v1 = 0; v1 < vert; v1++) {
501-
for (int v2 = 0; v2 < vert; v2++) {
502-
if (v2 == v1)
503-
continue;
504-
int idx = v1*(n-1)+((v2 < v1) ? v2: v2-1);
505-
edgetab[idx] = v2;
506-
edlotab[idx] = 1;
507-
}
508-
}
509-
510-
ret = SCOTCH_graphBuild (graph, base, vert,
511-
verttab, vendtab, velotab, vlbltab,
512-
edge, edgetab, edlotab);
513-
/* Converts scotch error into netloc error */
514-
if (ret != 0) {
515-
ret = NETLOC_ERROR;
516-
} else {
517-
ret = NETLOC_SUCCESS;
518-
}
519-
520-
return ret;
521-
}

netloc/support.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright © 2013-2014 University of Wisconsin-La Crosse.
33
* All rights reserved.
4-
* Copyright © 2016 Inria. All rights reserved.
4+
* Copyright © 2016-2017 Inria. All rights reserved.
55
*
66
* $COPYRIGHT$
77
*
@@ -11,6 +11,7 @@
1111
* $HEADER$
1212
*/
1313

14+
#include <private/netloc.h>
1415
#include <netloc.h>
1516

1617
#include <sys/types.h>
@@ -48,7 +49,7 @@ ssize_t netloc_line_get(char **lineptr, size_t *n, FILE *stream)
4849

4950
/* Remove last \n character */
5051
char *line = *lineptr;
51-
int lastpos = strlen(line)-1;
52+
size_t lastpos = strlen(line)-1;
5253
if (line[lastpos] == '\n') {
5354
line[lastpos] = '\0';
5455
read--;

netloc/topology.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ netloc_topology_t *netloc_topology_construct(char *path)
199199

200200
/* Read links */
201201
int num_links = atoi(line_get_next_field(&remain_line));
202-
utarray_reserve(edge->physical_links, num_links);
203-
utarray_reserve(node->physical_links, num_links);
202+
assert(num_links >= 0);
203+
utarray_reserve(edge->physical_links, (unsigned int)num_links);
204+
utarray_reserve(node->physical_links, (unsigned int)num_links);
204205
for (int i = 0; i < num_links; i++) {
205206
netloc_physical_link_t *link;
206207
link = netloc_physical_link_construct();
@@ -358,7 +359,9 @@ int netloc_topology_find_partition_idx(netloc_topology_t *topology, char *partit
358359
if (!found)
359360
return -2;
360361

361-
return p;
362+
assert(p <= INT_MAX);
363+
364+
return (int)p;
362365
}
363366

364367
static char *line_get_next_field(char **string)

0 commit comments

Comments
 (0)