source: CIVL/examples/mpi-omp/AMG2013/utilities/mpistubs.c

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 12.3 KB
RevLine 
[2aa6644]1/*BHEADER**********************************************************************
2 * Copyright (c) 2008, Lawrence Livermore National Security, LLC.
3 * Produced at the Lawrence Livermore National Laboratory.
4 * This file is part of HYPRE. See file COPYRIGHT for details.
5 *
6 * HYPRE is free software; you can redistribute it and/or modify it under the
7 * terms of the GNU Lesser General Public License (as published by the Free
8 * Software Foundation) version 2.1 dated February 1999.
9 *
10 * $Revision: 2.4 $
11 ***********************************************************************EHEADER*/
12
13/******************************************************************************
14 *
15 * Fake mpi stubs to generate serial codes without mpi
16 *
17 *****************************************************************************/
18
19#include "utilities.h"
20
21#ifdef HYPRE_SEQUENTIAL
22
23int
24hypre_MPI_Init( int *argc,
25 char ***argv )
26{
27 return(0);
28}
29
30int
31hypre_MPI_Finalize( )
32{
33 return(0);
34}
35
36int
37hypre_MPI_Abort( hypre_MPI_Comm comm,
38 int errorcode )
39{
40 return(0);
41}
42
43double
44hypre_MPI_Wtime( )
45{
46 return(0.0);
47}
48
49double
50hypre_MPI_Wtick( )
51{
52 return(0.0);
53}
54
55int
56hypre_MPI_Barrier( hypre_MPI_Comm comm )
57{
58 return(0);
59}
60
61int
62hypre_MPI_Comm_create( hypre_MPI_Comm comm,
63 hypre_MPI_Group group,
64 hypre_MPI_Comm *newcomm )
65{
66 return(0);
67}
68
69int
70hypre_MPI_Comm_dup( hypre_MPI_Comm comm,
71 hypre_MPI_Comm *newcomm )
72{
73 return(0);
74}
75
76int
77hypre_MPI_Comm_size( hypre_MPI_Comm comm,
78 int *size )
79{
80 *size = 1;
81 return(0);
82}
83
84int
85hypre_MPI_Comm_rank( hypre_MPI_Comm comm,
86 int *rank )
87{
88 *rank = 0;
89 return(0);
90}
91
92int
93hypre_MPI_Comm_free( hypre_MPI_Comm *comm )
94{
95 return 0;
96}
97
98int
99hypre_MPI_Comm_group( hypre_MPI_Comm comm,
100 hypre_MPI_Group *group )
101{
102 return(0);
103}
104
105int
106hypre_MPI_Comm_split( hypre_MPI_Comm comm,
107 int n, int m,
108 hypre_MPI_Comm * comms )
109{
110 return(0);
111}
112
113int
114hypre_MPI_Group_incl( hypre_MPI_Group group,
115 int n,
116 int *ranks,
117 hypre_MPI_Group *newgroup )
118{
119 return(0);
120}
121
122int
123hypre_MPI_Group_free( hypre_MPI_Group *group )
124{
125 return 0;
126}
127
128int
129hypre_MPI_Address( void *location,
130 hypre_MPI_Aint *address )
131{
132 return(0);
133}
134
135int
136hypre_MPI_Get_count( hypre_MPI_Status *status,
137 hypre_MPI_Datatype datatype,
138 int *count )
139{
140 return(0);
141}
142
143int
144hypre_MPI_Alltoall( void *sendbuf,
145 int sendcount,
146 hypre_MPI_Datatype sendtype,
147 void *recvbuf,
148 int recvcount,
149 hypre_MPI_Datatype recvtype,
150 hypre_MPI_Comm comm )
151{
152 return(0);
153}
154
155int
156hypre_MPI_Allgather( void *sendbuf,
157 int sendcount,
158 hypre_MPI_Datatype sendtype,
159 void *recvbuf,
160 int recvcount,
161 hypre_MPI_Datatype recvtype,
162 hypre_MPI_Comm comm )
163{
164 int i;
165
166 switch (sendtype)
167 {
168 case hypre_MPI_INT:
169 {
170 int *crecvbuf = (int *)recvbuf;
171 int *csendbuf = (int *)sendbuf;
172 for (i = 0; i < sendcount; i++)
173 {
174 crecvbuf[i] = csendbuf[i];
175 }
176 }
177 break;
178
179 case hypre_MPI_DOUBLE:
180 {
181 double *crecvbuf = (double *)recvbuf;
182 double *csendbuf = (double *)sendbuf;
183 for (i = 0; i < sendcount; i++)
184 {
185 crecvbuf[i] = csendbuf[i];
186 }
187 }
188 break;
189
190 case hypre_MPI_CHAR:
191 {
192 char *crecvbuf = (char *)recvbuf;
193 char *csendbuf = (char *)sendbuf;
194 for (i = 0; i < sendcount; i++)
195 {
196 crecvbuf[i] = csendbuf[i];
197 }
198 }
199 break;
200
201 case hypre_MPI_BYTE:
202 {
203 memcpy(recvbuf, sendbuf, sendcount);
204 }
205 break;
206 }
207
208 return(0);
209}
210
211int
212hypre_MPI_Allgatherv( void *sendbuf,
213 int sendcount,
214 hypre_MPI_Datatype sendtype,
215 void *recvbuf,
216 int *recvcounts,
217 int *displs,
218 hypre_MPI_Datatype recvtype,
219 hypre_MPI_Comm comm )
220{
221 return ( hypre_MPI_Allgather(sendbuf, sendcount, sendtype,
222 recvbuf, *recvcounts, recvtype, comm) );
223}
224
225int
226hypre_MPI_Gather( void *sendbuf,
227 int sendcount,
228 hypre_MPI_Datatype sendtype,
229 void *recvbuf,
230 int recvcount,
231 hypre_MPI_Datatype recvtype,
232 int root,
233 hypre_MPI_Comm comm )
234{
235 return ( hypre_MPI_Allgather(sendbuf, sendcount, sendtype,
236 recvbuf, recvcount, recvtype, comm) );
237}
238
239int
240hypre_MPI_Scatter( void *sendbuf,
241 int sendcount,
242 hypre_MPI_Datatype sendtype,
243 void *recvbuf,
244 int recvcount,
245 hypre_MPI_Datatype recvtype,
246 int root,
247 hypre_MPI_Comm comm )
248{
249 return ( hypre_MPI_Allgather(sendbuf, sendcount, sendtype,
250 recvbuf, recvcount, recvtype, comm) );
251}
252
253int
254hypre_MPI_Bcast( void *buffer,
255 int count,
256 hypre_MPI_Datatype datatype,
257 int root,
258 hypre_MPI_Comm comm )
259{
260 return(0);
261}
262
263int
264hypre_MPI_Send( void *buf,
265 int count,
266 hypre_MPI_Datatype datatype,
267 int dest,
268 int tag,
269 hypre_MPI_Comm comm )
270{
271 return(0);
272}
273
274int
275hypre_MPI_Recv( void *buf,
276 int count,
277 hypre_MPI_Datatype datatype,
278 int source,
279 int tag,
280 hypre_MPI_Comm comm,
281 hypre_MPI_Status *status )
282{
283 return(0);
284}
285
286int
287hypre_MPI_Isend( void *buf,
288 int count,
289 hypre_MPI_Datatype datatype,
290 int dest,
291 int tag,
292 hypre_MPI_Comm comm,
293 hypre_MPI_Request *request )
294{
295 return(0);
296}
297
298int
299hypre_MPI_Irecv( void *buf,
300 int count,
301 hypre_MPI_Datatype datatype,
302 int source,
303 int tag,
304 hypre_MPI_Comm comm,
305 hypre_MPI_Request *request )
306{
307 return(0);
308}
309
310int
311hypre_MPI_Send_init( void *buf,
312 int count,
313 hypre_MPI_Datatype datatype,
314 int dest,
315 int tag,
316 hypre_MPI_Comm comm,
317 hypre_MPI_Request *request )
318{
319 return 0;
320}
321
322int
323hypre_MPI_Recv_init( void *buf,
324 int count,
325 hypre_MPI_Datatype datatype,
326 int dest,
327 int tag,
328 hypre_MPI_Comm comm,
329 hypre_MPI_Request *request )
330{
331 return 0;
332}
333
334int
335hypre_MPI_Irsend( void *buf,
336 int count,
337 hypre_MPI_Datatype datatype,
338 int dest,
339 int tag,
340 hypre_MPI_Comm comm,
341 hypre_MPI_Request *request )
342{
343 return 0;
344}
345
346int
347hypre_MPI_Startall( int count,
348 hypre_MPI_Request *array_of_requests )
349{
350 return 0;
351}
352
353int
354hypre_MPI_Probe( int source,
355 int tag,
356 hypre_MPI_Comm comm,
357 hypre_MPI_Status *status )
358{
359 return 0;
360}
361
362int
363hypre_MPI_Iprobe( int source,
364 int tag,
365 hypre_MPI_Comm comm,
366 int *flag,
367 hypre_MPI_Status *status )
368{
369 return 0;
370}
371
372int
373hypre_MPI_Test( hypre_MPI_Request *request,
374 int *flag,
375 hypre_MPI_Status *status )
376{
377 *flag = 1;
378 return(0);
379}
380
381int
382hypre_MPI_Testall( int count,
383 hypre_MPI_Request *array_of_requests,
384 int *flag,
385 hypre_MPI_Status *array_of_statuses )
386{
387 *flag = 1;
388 return(0);
389}
390
391int
392hypre_MPI_Wait( hypre_MPI_Request *request,
393 hypre_MPI_Status *status )
394{
395 return(0);
396}
397
398int
399hypre_MPI_Waitall( int count,
400 hypre_MPI_Request *array_of_requests,
401 hypre_MPI_Status *array_of_statuses )
402{
403 return(0);
404}
405
406int
407hypre_MPI_Waitany( int count,
408 hypre_MPI_Request *array_of_requests,
409 int *index,
410 hypre_MPI_Status *status )
411{
412 return(0);
413}
414
415int
416hypre_MPI_Allreduce( void *sendbuf,
417 void *recvbuf,
418 int count,
419 hypre_MPI_Datatype datatype,
420 hypre_MPI_Op op,
421 hypre_MPI_Comm comm )
422{
423 switch (datatype)
424 {
425 case hypre_MPI_INT:
426 {
427 int *crecvbuf = (int *)recvbuf;
428 int *csendbuf = (int *)sendbuf;
429 crecvbuf[0] = csendbuf[0];
430 }
431 break;
432
433 case hypre_MPI_DOUBLE:
434 {
435 double *crecvbuf = (double *)recvbuf;
436 double *csendbuf = (double *)sendbuf;
437 crecvbuf[0] = csendbuf[0];
438 }
439 break;
440
441 case hypre_MPI_CHAR:
442 {
443 char *crecvbuf = (char *)recvbuf;
444 char *csendbuf = (char *)sendbuf;
445 crecvbuf[0] = csendbuf[0];
446 }
447 break;
448
449 case hypre_MPI_BYTE:
450 {
451 memcpy(recvbuf, sendbuf, 1);
452 }
453 break;
454 }
455
456 return 0;
457}
458
459int
460hypre_MPI_Reduce( void *sendbuf,
461 void *recvbuf,
462 int count,
463 hypre_MPI_Datatype datatype,
464 hypre_MPI_Op op,
465 int root,
466 hypre_MPI_Comm comm )
467{
468 hypre_MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm);
469 return 0;
470}
471
472int
473hypre_MPI_Request_free( hypre_MPI_Request *request )
474{
475 return 0;
476}
477
478int
479hypre_MPI_Type_contiguous( int count,
480 hypre_MPI_Datatype oldtype,
481 hypre_MPI_Datatype *newtype )
482{
483 return(0);
484}
485
486int
487hypre_MPI_Type_vector( int count,
488 int blocklength,
489 int stride,
490 hypre_MPI_Datatype oldtype,
491 hypre_MPI_Datatype *newtype )
492{
493 return(0);
494}
495
496int
497hypre_MPI_Type_hvector( int count,
498 int blocklength,
499 hypre_MPI_Aint stride,
500 hypre_MPI_Datatype oldtype,
501 hypre_MPI_Datatype *newtype )
502{
503 return(0);
504}
505
506int
507hypre_MPI_Type_struct( int count,
508 int *array_of_blocklengths,
509 hypre_MPI_Aint *array_of_displacements,
510 hypre_MPI_Datatype *array_of_types,
511 hypre_MPI_Datatype *newtype )
512{
513 return(0);
514}
515
516int
517hypre_MPI_Type_commit( hypre_MPI_Datatype *datatype )
518{
519 return(0);
520}
521
522int
523hypre_MPI_Type_free( hypre_MPI_Datatype *datatype )
524{
525 return(0);
526}
527
528#else
529
530/* this is used only to eliminate compiler warnings */
531int hypre_empty2;
532
533#endif
Note: See TracBrowser for help on using the repository browser.