1 | #ifndef _MPIP_H |
---|
2 | #define _MPIP_H |
---|
3 | |
---|
4 | /* |
---|
5 | * Private .h file for MPI |
---|
6 | */ |
---|
7 | |
---|
8 | |
---|
9 | #include <unistd.h> |
---|
10 | #include <stdlib.h> |
---|
11 | #include <stdio.h> |
---|
12 | #include <string.h> |
---|
13 | |
---|
14 | #include "listops.h" |
---|
15 | #include "mpi.h" |
---|
16 | |
---|
17 | /* Autoconf Fortran name mangling |
---|
18 | * |
---|
19 | * config.h defines F77_FUNC and F77_FUNC_ |
---|
20 | * Since we are generally using FC_FUNC, and |
---|
21 | * all of our functions will ONLY use F77_FUNC_ |
---|
22 | * (with the underscore, define FC_FUNC as the |
---|
23 | * aforementioned. |
---|
24 | * |
---|
25 | * If config.h is not present, default to the old |
---|
26 | * approach. |
---|
27 | */ |
---|
28 | |
---|
29 | #ifdef HAVE_CONFIG_H |
---|
30 | #include <config.h> |
---|
31 | /* config.h should define FC_FUNC */ |
---|
32 | #else |
---|
33 | |
---|
34 | /* |
---|
35 | * Fortran name mangling |
---|
36 | * |
---|
37 | * the configure.ac specifies these |
---|
38 | * |
---|
39 | * cpp does not have the ability to change the case |
---|
40 | * of the argument, so the invocation of the macro |
---|
41 | * has to be give both e.g. FC_FUNC(hello,HELLO) |
---|
42 | * and maps to "hello_", "hello", and "HELLO" repectively. |
---|
43 | * |
---|
44 | * IMPORTANT NOTE: |
---|
45 | * In the case of FORTRAN_GNUF2C (e.g. g95), the rule is this: |
---|
46 | * name does not contain an underscore -> append *one* underscore |
---|
47 | * name contains an underscore -> append *two* underscore |
---|
48 | * Since all the mpi-serial names exported to fortran start with "mpi_", |
---|
49 | * we only support the latter. |
---|
50 | * |
---|
51 | * Note: FORTRANUNDERSCORE is needed by ccsm |
---|
52 | * |
---|
53 | */ |
---|
54 | |
---|
55 | |
---|
56 | #if defined(FORTRAN_UNDERSCORE_) || defined(FORTRANUNDERSCORE) |
---|
57 | #define FC_FUNC(lower,upper) lower##_ |
---|
58 | #elif defined(FORTRAN_GNUF2C) |
---|
59 | #define FC_FUNC(lower,upper) lower##__ |
---|
60 | #elif defined(FORTRAN_SAME) |
---|
61 | #define FC_FUNC(lower,upper) lower |
---|
62 | #elif defined(FORTRAN_CAPS_) |
---|
63 | #define FC_FUNC(lower,upper) upper |
---|
64 | #else |
---|
65 | #error "Unrecognized Fortran-mangle type" |
---|
66 | /* set to something reasonable to avoid cascade of cc errors */ |
---|
67 | #define FC_FUNC(lower,upper) lower##_ |
---|
68 | #endif |
---|
69 | #endif /* HAVE_CONFIG_H */ |
---|
70 | |
---|
71 | /* |
---|
72 | * MPI_GROUP_ONE must not conflict with MPI_GROUP_NULL or |
---|
73 | * MPI_GROUP_EMPTY |
---|
74 | */ |
---|
75 | |
---|
76 | #define MPI_GROUP_ONE (1) |
---|
77 | |
---|
78 | |
---|
79 | /****************************************************************************/ |
---|
80 | |
---|
81 | |
---|
82 | typedef struct |
---|
83 | { |
---|
84 | pList sendlist; |
---|
85 | pList recvlist; |
---|
86 | |
---|
87 | int num; |
---|
88 | |
---|
89 | } Comm; |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | typedef struct |
---|
94 | { |
---|
95 | pListitem listitem; /* to allow Req to be removed from list */ |
---|
96 | |
---|
97 | int *buf; |
---|
98 | int source; |
---|
99 | int tag; |
---|
100 | int complete; |
---|
101 | |
---|
102 | } Req; |
---|
103 | |
---|
104 | |
---|
105 | /****************************************************************************/ |
---|
106 | |
---|
107 | /* copy functions */ |
---|
108 | extern int copy_data2(void * source, int src_count, MPI_Datatype src_type, |
---|
109 | void * dest, int dest_count, MPI_Datatype dest_type); |
---|
110 | |
---|
111 | extern void *mpi_malloc(int size); |
---|
112 | extern void mpi_free(void *ptr); |
---|
113 | |
---|
114 | extern MPI_Comm mpi_comm_new(void); |
---|
115 | |
---|
116 | extern void mpi_destroy_handles(void); |
---|
117 | extern void mpi_alloc_handle(int *handle, void **data); |
---|
118 | extern void *mpi_handle_to_ptr(int handle); |
---|
119 | extern void mpi_free_handle(int handle); |
---|
120 | |
---|
121 | extern void FC_FUNC(mpi_get_fort_pointers,MPI_GET_FORT_POINTERS)(void); |
---|
122 | |
---|
123 | extern MPI_Status *mpi_c_status(int *status); |
---|
124 | extern MPI_Status *mpi_c_statuses(int *statuses); |
---|
125 | extern void *mpi_c_in_place(void *buffer); |
---|
126 | |
---|
127 | |
---|
128 | #endif /* _MPIP_H */ |
---|