/[escript]/trunk/paso/src/Coupler.h
ViewVC logotype

Contents of /trunk/paso/src/Coupler.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3482 - (show annotations)
Wed Mar 23 04:06:52 2011 UTC (8 years, 5 months ago) by gross
File MIME type: text/plain
File size: 3124 byte(s)
some work on AMG MPI
1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14
15 /**************************************************************/
16
17 /* Paso: coupler */
18
19 /**************************************************************/
20
21 /* Author: Lutz Gross, l.gross@uq.edu.au */
22
23 /**************************************************************/
24
25 #ifndef INC_PASO_COUPLER
26 #define INC_PASO_COUPLER
27
28 #include "SharedComponents.h"
29 /**************************************************************/
30
31 typedef struct Paso_Connector {
32
33 Paso_SharedComponents* send;
34 Paso_SharedComponents* recv;
35 dim_t reference_counter;
36 Esys_MPIInfo *mpi_info;
37
38 } Paso_Connector;
39 typedef struct Paso_Coupler {
40
41 dim_t block_size;
42
43 Paso_Connector* connector;
44
45 bool_t in_use;
46 double *data; /* unmanaged pointer to data be send */
47 double *send_buffer;
48 double *recv_buffer;
49 #ifdef ESYS_MPI
50 MPI_Request* mpi_requests;
51 MPI_Status* mpi_stati;
52 #else
53 void* mpi_requests;
54 void* mpi_stati;
55 #endif
56
57 dim_t reference_counter;
58 Esys_MPIInfo *mpi_info;
59
60 } Paso_Coupler;
61
62
63
64 PASO_DLL_API
65 Paso_Connector* Paso_Connector_alloc(Paso_SharedComponents * send, Paso_SharedComponents* recv);
66
67 PASO_DLL_API
68 Paso_Connector* Paso_Connector_getReference(Paso_Connector*);
69
70 PASO_DLL_API
71 Paso_Connector* Paso_Connector_unroll(Paso_Connector* in, index_t block_size);
72
73 PASO_DLL_API
74 Paso_Connector* Paso_Connector_copy(Paso_Connector* in);
75
76 PASO_DLL_API
77 void Paso_Connector_free(Paso_Connector*);
78
79
80 PASO_DLL_API
81 Paso_Coupler* Paso_Coupler_alloc(Paso_Connector*, dim_t blockSize);
82
83 PASO_DLL_API
84 Paso_Coupler* Paso_Coupler_getReference(Paso_Coupler*);
85
86 PASO_DLL_API
87 void Paso_Coupler_startCollect(Paso_Coupler* self,const double* in);
88
89 PASO_DLL_API
90 double* Paso_Coupler_finishCollect(Paso_Coupler* self);
91
92 PASO_DLL_API
93 void Paso_Coupler_free(Paso_Coupler* in);
94
95 #define Paso_Coupler_borrowLocalData(_in_) (_in_)->data
96 #define Paso_Coupler_borrowRemoteData(_in_) (_in_)->recv_buffer
97 #define Paso_Coupler_getNumSharedComponents(_in_) ((_in_)->connector->send->numSharedComponents)
98 #define Paso_Coupler_getNumOverlapComponents(_in_) ((_in_)->connector->recv->numSharedComponents)
99 #define Paso_Coupler_getNumSharedValues(_in_) ( Paso_Coupler_getNumSharedComponents(_in_) * (_in_)->block_size )
100 #define Paso_Coupler_getNumOverlapValues(_in_) ( Paso_Coupler_getNumOverlapComponents(_in_) * (_in_)->block_size )
101 #define Paso_Coupler_getLocalLength(_in_) ( (_in_)->connector->send->local_length )
102
103 PASO_DLL_API
104 void Paso_Coupler_copyAll(const Paso_Coupler* src, Paso_Coupler* target);
105
106
107 PASO_DLL_API
108 void Paso_Coupler_fillOverlap(const dim_t n, double* x, Paso_Coupler *coupler);
109
110 PASO_DLL_API
111 void Paso_Coupler_max(const dim_t n, double* x, Paso_Coupler *coupler);
112
113
114 #endif

  ViewVC Help
Powered by ViewVC 1.1.26