1 /* Copyright 2007,2010 ENSEIRB, INRIA & CNRS
2 **
3 ** This file is part of the Scotch software package for static mapping,
4 ** graph partitioning and sparse matrix ordering.
5 **
6 ** This software is governed by the CeCILL-C license under French law
7 ** and abiding by the rules of distribution of free software. You can
8 ** use, modify and/or redistribute the software under the terms of the
9 ** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following
10 ** URL: "http://www.cecill.info".
11 **
12 ** As a counterpart to the access to the source code and rights to copy,
13 ** modify and redistribute granted by the license, users are provided
14 ** only with a limited warranty and the software's author, the holder of
15 ** the economic rights, and the successive licensors have only limited
16 ** liability.
17 **
18 ** In this respect, the user's attention is drawn to the risks associated
19 ** with loading, using, modifying and/or developing or reproducing the
20 ** software by the user in light of its specific status of free software,
21 ** that may mean that it is complicated to manipulate, and that also
22 ** therefore means that it is reserved for developers and experienced
23 ** professionals having in-depth computer knowledge. Users are therefore
24 ** encouraged to load and test the software's suitability as regards
25 ** their requirements in conditions enabling the security of their
26 ** systems and/or data to be ensured and, more generally, to use and
27 ** operate it in the same conditions as regards security.
28 **
29 ** The fact that you are presently reading this means that you have had
30 ** knowledge of the CeCILL-C license and that you accept its terms.
31 */
32 /************************************************************/
33 /** **/
34 /** NAME : dgraph_view.c **/
35 /** **/
36 /** AUTHOR : Francois PELLEGRINI **/
37 /** **/
38 /** FUNCTION : These lines are the data declarations **/
39 /** for the distributed graph general **/
40 /** purpose routines. **/
41 /** **/
42 /** DATES : # Version P0.0 : from : 01 apr 1997 **/
43 /** to 01 apr 1997 **/
44 /** # Version P0.1 : from : 12 apr 1998 **/
45 /** to 20 jun 1998 **/
46 /** # Version 5.0 : from : 16 feb 2005 **/
47 /** to : 15 aug 2006 **/
48 /** # Version 5.1 : from : 11 aug 2010 **/
49 /** to : 12 aug 2010 **/
50 /** **/
51 /************************************************************/
52
53 /*
54 ** The defines and includes.
55 */
56
57 #define DGRAPH
58
59 #include "module.h"
60 #include "common.h"
61 #include "dgraph.h"
62
63 /*************************************/
64 /* */
65 /* These routines handle distributed */
66 /* source graphs. */
67 /* */
68 /*************************************/
69
70 /* This routine displays the contents
71 ** of the given graph structure.
72 ** It returns:
73 ** - 0 : on success.
74 ** - !0 : on error.
75 */
76
77 int
dgraphView(const Dgraph * restrict const grafptr,FILE * const stream)78 dgraphView (
79 const Dgraph * restrict const grafptr,
80 FILE * const stream)
81 {
82 MPI_Comm proccomm; /* Graph communicator */
83 int procglbnbr; /* Number of processes sharing graph data */
84 int proclocnum; /* Number of this process */
85 int procngbnbr;
86 int procngbnum;
87 Gnum vertlocnum;
88 Gnum edgelocnum;
89 Gnum * edgelocptr;
90
91 proccomm = grafptr->proccomm; /* Simplify */
92 MPI_Comm_size (proccomm, &procglbnbr); /* Rely on communicator data */
93 MPI_Comm_rank (proccomm, &proclocnum);
94
95 fflush (stream); /* Flush previous data */
96 for (procngbnbr = 0; procngbnbr < procglbnbr; procngbnbr ++) {
97 MPI_Barrier (proccomm);
98 if (procngbnbr == proclocnum) {
99 fprintf (stream, "Process %d:\n",
100 proclocnum);
101 fprintf (stream, " vertglbnbr: " GNUMSTRING "\n vertgstnbr: " GNUMSTRING "\n vertgstnnd: " GNUMSTRING "\n vertlocnbr: " GNUMSTRING "\n vertlocnnd: " GNUMSTRING "\n",
102 (Gnum) grafptr->vertglbnbr,
103 (Gnum) grafptr->vertgstnbr,
104 (Gnum) grafptr->vertgstnnd,
105 (Gnum) grafptr->vertlocnbr,
106 (Gnum) grafptr->vertlocnnd);
107 fprintf (stream, " vertloctax:");
108 if (grafptr->vendloctax == grafptr->vertloctax + 1) {
109 for (vertlocnum = grafptr->baseval; vertlocnum <= grafptr->vertlocnnd; vertlocnum ++)/**/
110 fprintf (stream, " " GNUMSTRING,
111 (Gnum) grafptr->vertloctax[vertlocnum]);
112 fprintf (stream, " x\n vendloctax: = vertloctax + 1");
113 }
114 else {
115 for (vertlocnum = grafptr->baseval; vertlocnum < grafptr->vertlocnnd; vertlocnum ++)
116 fprintf (stream, " " GNUMSTRING,
117 (Gnum) grafptr->vertloctax[vertlocnum]);
118 fprintf (stream, " vendloctax: x");
119 for (vertlocnum = grafptr->baseval; vertlocnum < grafptr->vertlocnnd; vertlocnum ++)
120 fprintf (stream, " " GNUMSTRING,
121 (Gnum) grafptr->vendloctax[vertlocnum]);
122 }
123 fprintf (stream, "\n edgeglbnbr: " GNUMSTRING "\n edgelocnbr: " GNUMSTRING "\n",
124 (Gnum) grafptr->edgeglbnbr,
125 (Gnum) grafptr->edgelocnbr);
126 fprintf (stream, " edgeloctax:");
127 for (edgelocnum = grafptr->baseval, edgelocptr = grafptr->edgeloctax;
128 edgelocnum < grafptr->edgelocnbr + grafptr->baseval;
129 edgelocnum ++, edgelocptr ++)
130 fprintf (stream, " " GNUMSTRING,
131 (Gnum) *edgelocptr);
132 if ((grafptr->flagval & DGRAPHHASEDGEGST) != 0) {
133 fprintf (stream, "\n edgegsttax:");
134 for (edgelocnum = grafptr->baseval, edgelocptr = grafptr->edgegsttax;
135 edgelocnum < grafptr->edgelocnbr + grafptr->baseval;
136 edgelocnum ++, edgelocptr ++)
137 fprintf (stream, " " GNUMSTRING,
138 (Gnum) *edgelocptr);
139 }
140 fprintf (stream, "\n procdsptab:");
141 for (procngbnum = 0; procngbnum <= procglbnbr ; procngbnum ++)
142 fprintf (stream, " " GNUMSTRING,
143 (Gnum) grafptr->procdsptab[procngbnum]);
144 fprintf (stream, "\n procngbnbr: %d",
145 grafptr->procngbnbr);
146 fprintf (stream, "\n procngbtab:");
147 for (procngbnum = 0; procngbnum < grafptr->procngbnbr; procngbnum ++)
148 fprintf (stream, " %d",
149 grafptr->procngbtab[procngbnum]);
150 fprintf (stream, "\n procrcvtab:");
151 for (procngbnum = 0; procngbnum < grafptr->procglbnbr; procngbnum ++)
152 fprintf (stream, " %d",
153 grafptr->procrcvtab[procngbnum]);
154 fprintf (stream, "\n procsndnbr: %d",
155 grafptr->procsndnbr);
156 fprintf (stream, "\n procsndtab:");
157 for (procngbnum = 0; procngbnum < grafptr->procglbnbr; procngbnum ++)
158 fprintf (stream, " %d",
159 grafptr->procsndtab[procngbnum]);
160 fprintf (stream, "\n degrglbmax: " GNUMSTRING,
161 (Gnum) grafptr->degrglbmax);
162 fprintf (stream, "\n");
163 fflush (stream); /* Flush data */
164 }
165 }
166 MPI_Barrier (proccomm);
167
168 return (0);
169 }
170