The FARGO_THORIN code developer's guide
 All Data Structures Files Functions Variables Typedefs Macros
mpi_dummy.c
Go to the documentation of this file.
1 /** \file mpi_dummy.c
2 
3 Fake MPI functions library for sequential built.
4 It is used instead of the true MPI library in the
5 case of a sequential built (see makefile).
6 
7 */
8 
9 
10 #include <stdio.h>
11 #include "mpi_dummy.h"
12 
13 void MPI_Comm_rank (a, b)
14  int a;
15  int *b;
16 {
17  *b = 0; /* Only one process, with rank zero... */
18 }
19 
20 void MPI_Comm_size (a, b)
21  int a;
22  int *b;
23 {
24  *b = 1; /* Only one process in the world communicator... */
25 }
26 
27 void MPI_Init (argc, argv)
28  int *argc;
29  char **argv[];
30 {
31  fprintf (stderr, "\n !!!! WARNING !!!!\n\n");
32  fprintf (stderr, "This is a sequential built of the %s code\n", *argv[0]);
33  fprintf (stderr, "If you planned to run the MPI-parallel version,\n");
34  fprintf (stderr, "then you MUST rebuild the executable. Go into the\n");
35  fprintf (stderr, "source directory (normally src/), then issue:\n");
36  fprintf (stderr, "\ngmake BUILD=parallel\n");
37  fprintf (stderr, "\nAny further invocation of gmake will refer to a parallel built.\n");
38 }
39 
40 void MPI_Finalize ()
41 {
42 }
43 
44 void MPI_Bcast ()
45 {
46 }
47 
48 void MPI_Isend ()
49 {
50 }
51 
52 void MPI_Irecv ()
53 {
54 }
55 
56 void MPI_Send ()
57 {
58 }
59 
60 void MPI_Recv ()
61 {
62 }
63 
64 void MPI_Barrier ()
65 {
66 }
67 
68 void MPI_Wait ()
69 {
70 }
71 
72 void MPI_Allreduce (void *ptr, void *ptr2, int count, int type, int foo3, int foo4)
73 {
74  int i;
75  for (i = 0; i < count; i++) {
76  switch (type) {
77  case MPI_DOUBLE:
78  *(((double *)ptr2)+i) = (double)(*(((double *)ptr)+i));
79  break;
80  case MPI_INT:
81  *(((int *)ptr2)+i) = (int)(*(((int *)ptr)+i));
82  break;
83  }
84  }
85 }
void MPI_Send()
Definition: mpi_dummy.c:56
Declaration of fake MPI functions for sequential built.
#define MPI_DOUBLE
Definition: mpi_dummy.h:11
void MPI_Barrier()
Definition: mpi_dummy.c:64
static real a[7]
Definition: EnergySources.c:27
void MPI_Finalize()
Definition: mpi_dummy.c:40
void MPI_Comm_size(int a, int *b)
Definition: mpi_dummy.c:20
void MPI_Irecv()
Definition: mpi_dummy.c:52
void MPI_Comm_rank(int a, int *b)
Definition: mpi_dummy.c:13
void MPI_Allreduce(void *ptr, void *ptr2, int count, int type, int foo3, int foo4)
Definition: mpi_dummy.c:72
#define MPI_INT
Definition: mpi_dummy.h:14
void MPI_Isend()
Definition: mpi_dummy.c:48
void MPI_Recv()
Definition: mpi_dummy.c:60
static real b[7]
Definition: EnergySources.c:28
void MPI_Wait()
Definition: mpi_dummy.c:68
void MPI_Init(int *argc, argv)
Definition: mpi_dummy.c:27
void MPI_Bcast()
Definition: mpi_dummy.c:44