/[escript]/trunk/finley/src/NodeDistribution.c
ViewVC logotype

Annotation of /trunk/finley/src/NodeDistribution.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 751 - (hide annotations)
Mon Jun 26 01:46:34 2006 UTC (13 years, 3 months ago) by bcumming
File MIME type: text/plain
File size: 3459 byte(s)
Changes relating to the MPI version of escript
The standard OpenMP version of escript is unchanged

- updated data types (Finley_Mesh, Finley_NodeFile, etc) to store meshes
  over multiple MPI processes.
- added CommBuffer code in Paso for communication of Data associated
  with distributed meshes
- updates in Finley and Escript to support distributed data and operations
  on distributed data (such as interpolation).
- construction of RHS in MPI, so that simple explicit schemes (such as
  /docs/examples/wave.py without IO and the Locator) can run in MPI.
- updated mesh generation for first order line, rectangle and brick
  meshes and second order line meshes in MPI.        
- small changes to trunk/SConstruct and trunk/scons/ess_options.py to
  build the MPI version, these changes are turned off by default.

1 bcumming 731 /* created by Ben Cumming on 26/04/2006 */
2     #include "Distribution.h"
3    
4     #ifdef PASO_MPI
5    
6     Finley_NodeDistribution* Finley_NodeDistribution_alloc( Paso_MPIInfo *MPIInfo )
7     {
8     Finley_NodeDistribution *out=NULL;
9    
10     out = MEMALLOC( 1, Finley_NodeDistribution );
11     if (Finley_checkPtr(out)) return NULL;
12    
13     out->reference_counter = 0;
14    
15     out->MPIInfo = Paso_MPIInfo_getReference(MPIInfo);
16    
17     out->numLocal = 0;
18     out->numGlobal = 0;
19     out->numInternal = 0;
20     out->numBoundary = 0;
21     out->numExternal = 0;
22    
23     out->numNeighbours = 0;
24     out->neighbours = NULL;
25     out->edges = NULL;
26     out->indexExternal = NULL;
27     out->vtxdist=NULL;
28    
29     out->reference_counter++;
30    
31     return out;
32     }
33    
34     void Finley_NodeDistribution_dealloc( Finley_NodeDistribution *in )
35     {
36     index_t i;
37    
38     if( in && !(--in->reference_counter) )
39     {
40     Paso_MPIInfo_dealloc( in->MPIInfo );
41    
42     for( i=0; i<in->numNeighbours; i++ )
43     Finley_NodeGhostEdge_dealloc( in->edges[i] );
44     MEMFREE( in->edges );
45     MEMFREE( in->vtxdist );
46     MEMFREE( in->indexExternal );
47     MEMFREE( in->neighbours );
48    
49     MEMFREE( in );
50     }
51     }
52    
53     Finley_NodeDistribution* Finley_NodeDistribution_getReference( Finley_NodeDistribution *in )
54     {
55     if( in )
56     in->reference_counter++;
57    
58     return in;
59     }
60    
61     Finley_NodeGhostEdge* Finley_NodeGhostEdge_alloc( void )
62     {
63     Finley_NodeGhostEdge *out=NULL;
64    
65     out = MEMALLOC( 1, Finley_NodeGhostEdge );
66     if (Finley_checkPtr(out)) return NULL;
67    
68     out->reference_counter = 0;
69     out->numForward = out->numBackward = 0;
70     out->indexForward = out->indexBackward = NULL;
71    
72     out->reference_counter++;
73    
74     return out;
75     }
76    
77     void Finley_NodeGhostEdge_dealloc( Finley_NodeGhostEdge *in )
78     {
79     if( in && !(--in->reference_counter) )
80     {
81     MEMFREE( in->indexForward );
82     MEMFREE( in->indexBackward );
83     MEMFREE( in );
84     }
85     }
86    
87     Finley_NodeGhostEdge* Finley_NodeGhostEdge_getReference( Finley_NodeGhostEdge *in )
88     {
89     if( in )
90     in->reference_counter++;
91    
92     return in;
93     }
94    
95 bcumming 751 /* print the local distribution data to fid */
96     void Finley_NodeDistribution_print( Finley_NodeDistribution *in, FILE *fid )
97     {
98     int n, i;
99    
100     fprintf( fid, "=======================================================================================\nNode Distribution\n---------------------\n\nInternal %d\nBoundary %d\nLocal %d\nExternal %d\nGlobal %d\n", in->numInternal, in->numBoundary, in->numLocal, in->numExternal, in->numGlobal );
101     fprintf( fid, "vtxdist [ " );
102     for( i=0; i<in->MPIInfo->size+1; i++ )
103     fprintf( fid, "%d ", in->vtxdist[i] );
104     fprintf( fid, "]\n" );
105     fprintf( fid, "indexExternal [ " );
106     for( i=0; i<in->numExternal; i++ )
107     fprintf( fid, "%d ", in->indexExternal[i] );
108     fprintf( fid, "]\n" );
109     fprintf( fid, "NumNeighbours %d\n", in->numNeighbours );
110     /* list each neighbour */
111     for( n=0; n<in->numNeighbours; n++ )
112     {
113    
114     fprintf( fid, "\nNeighbour %d - Domain %d\n=====================\n\n", n, in->neighbours[n] );
115     fprintf( fid, "numForward = %d\tnumBackward = %d\n", in->edges[n]->numForward, in->edges[n]->numBackward );
116     fprintf( fid, "indexForward\n[ " );
117     for( i=0; i<in->edges[n]->numForward; i++ )
118     fprintf( fid, "%d ", in->edges[n]->indexForward[i] );
119     fprintf( fid, "]\n" );
120     fprintf( fid, "indexBackward\n[ " );
121     for( i=0; i<in->edges[n]->numBackward; i++ )
122     fprintf( fid, "%d ", in->edges[n]->indexBackward[i] );
123     fprintf( fid, "]\n=======================================================================================\n" );
124     }
125     }
126    
127 bcumming 731 #endif

  ViewVC Help
Powered by ViewVC 1.1.26