Debian Codegraph @

debian/external_deps/fetk/maloc/src/psh/vmp.c

raw
1 /*
2 * ***************************************************************************
3 * MALOC = < Minimal Abstraction Layer for Object-oriented C >
4 * Copyright (C) 1994-- Michael Holst
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * rcsid="$Id: vmp.c,v 1.11 2010/08/12 05:40:21 fetk Exp $"
21 * ***************************************************************************
22 */
23
24 /*
25 * ***************************************************************************
26 * File: vmp.c
27 *
28 * Purpose: Class Vmp: methods.
29 *
30 * Notes: Thin MPI abstraction layer on top of VCOM and VMPI.
31 * This layer is going to dissappear completely when
32 * VCOM and VMPI are merged.
33 *
34 * Author: Michael Holst
35 * ***************************************************************************
36 */
37
38 #include "vmp_p.h"
39
40 VEMBED(rcsid="$Id: vmp.c,v 1.11 2010/08/12 05:40:21 fetk Exp $")
41
42 #define USE_VCOM_NOT 1
43
44 /*
45 * ***************************************************************************
46 * Class Vmp: Inlineable methods
47 * ***************************************************************************
48 */
49 #if !defined(VINLINE_MALOC)
50
51 #endif /* if !defined(VINLINE_MALOC) */
52 /*
53 * ***************************************************************************
54 * Class Vmp: Non-inlineable methods
55 * ***************************************************************************
56 */
57
58 /*
59 * ***************************************************************************
60 * Routine: Vmp_init
61 *
62 * Purpose: The Vmp initializer.
63 *
64 * Author: Michael Holst
65 * ***************************************************************************
66 */
67 VPUBLIC int Vmp_init(int *argc, char ***argv)
68 {
69 # if defined(USE_VCOM)
70 return Vcom_init(argc,argv);
71 # else
72 return Vmpi_init(argc,argv);
73 # endif
74 }
75
76 /*
77 * ***************************************************************************
78 * Routine: Vmp_finalize
79 *
80 * Purpose: The Vmp finalizer.
81 *
82 * Author: Michael Holst
83 * ***************************************************************************
84 */
85 VPUBLIC int Vmp_finalize(void)
86 {
87 # if defined(USE_VCOM)
88 return Vcom_finalize();
89 # else
90 return Vmpi_finalize();
91 # endif
92 }
93
94 /*
95 * ***************************************************************************
96 * Routine: Vmp_ctor
97 *
98 * Purpose: The Vmp constructor.
99 *
100 * Author: Michael Holst
101 * ***************************************************************************
102 */
103 VPUBLIC Vmp* Vmp_ctor(void)
104 {
105 # if defined(USE_VCOM)
106 return (Vmp*)Vcom_ctor(1);
107 # else
108 return (Vmp*)Vmpi_ctor();
109 # endif
110 }
111
112 /*
113 * ***************************************************************************
114 * Routine: Vmp_dtor
115 *
116 * Purpose: The Vmp destructor.
117 *
118 * Author: Michael Holst
119 * ***************************************************************************
120 */
121 VPUBLIC void Vmp_dtor(Vmp **thee)
122 {
123 # if defined(USE_VCOM)
124 Vcom_dtor( (Vcom**)thee );
125 # else
126 Vmpi_dtor( (Vmpi**)thee );
127 # endif
128 }
129
130 /*
131 * ***************************************************************************
132 * Routine: Vmp_rank
133 *
134 * Purpose: Return my processor ID.
135 *
136 * Author: Michael Holst
137 * ***************************************************************************
138 */
139 VPUBLIC int Vmp_rank(Vmp *thee)
140 {
141 # if defined(USE_VCOM)
142 return Vcom_rank( (Vcom*)thee );
143 # else
144 return Vmpi_rank( (Vmpi*)thee );
145 # endif
146 }
147
148 /*
149 * ***************************************************************************
150 * Routine: Vmp_size
151 *
152 * Purpose: Return the number of processors involved.
153 *
154 * Author: Michael Holst
155 * ***************************************************************************
156 */
157 VPUBLIC int Vmp_size(Vmp *thee)
158 {
159 # if defined(USE_VCOM)
160 return Vcom_size( (Vcom*)thee );
161 # else
162 return Vmpi_size( (Vmpi*)thee );
163 # endif
164 }
165
166 /*
167 * ***************************************************************************
168 * Routine: Vmp_barr
169 *
170 * Purpose: An MPI barrier.
171 *
172 * Author: Michael Holst
173 * ***************************************************************************
174 */
175 VPUBLIC int Vmp_barr(Vmp *thee)
176 {
177 # if defined(USE_VCOM)
178 return Vcom_barr( (Vcom*)thee );
179 # else
180 return Vmpi_barr( (Vmpi*)thee );
181 # endif
182 }
183
184 /*
185 * ***************************************************************************
186 * Routine: Vmp_send
187 *
188 * Purpose: An MPI blocking send.
189 *
190 * Author: Michael Holst
191 * ***************************************************************************
192 */
193 VPUBLIC int Vmp_send(Vmp *thee, int des, char *buf, int bufsize)
194 {
195 # if defined(USE_VCOM)
196 return Vcom_send( (Vcom*)thee, des, buf, bufsize, 0, 1 );
197 # else
198 return Vmpi_send( (Vmpi*)thee, des, buf, bufsize );
199 # endif
200 }
201
202 /*
203 * ***************************************************************************
204 * Routine: Vmp_recv
205 *
206 * Purpose: An MPI blocking receive.
207 *
208 * Author: Michael Holst
209 * ***************************************************************************
210 */
211 VPUBLIC int Vmp_recv(Vmp *thee, int src, char *buf, int bufsize)
212 {
213 # if defined(USE_VCOM)
214 return Vcom_recv( (Vcom*)thee, src, buf, bufsize, 0, 1 );
215 # else
216 return Vmpi_recv( (Vmpi*)thee, src, buf, bufsize );
217 # endif
218 }
219