54
# parmc2f translates the C/C++ names to the Fortran 90 name. %name% will
55
# argtypec2f translates the C/C++ names to the Fortran 90 name. %name% will
55
56
# be replaced with the argument name in declarations.
57
58
# Some picky compilers want an interface description where Fortran 77
58
59
# was happy with a simple EXTERNAL. To handle this, the EXTERNAL
59
60
# has a more elaborate form:
60
61
# INTERFACE %nl%SUBROUTINE %name%(<args>)%nl%<type decls>%nl%END SUBROUTINE%nl%END INTERFACE
61
# where %nl% is newline/indent.
62
# where %nl% is newline/indent.
63
%parmc2f = ( 'int' => 'INTEGER',
64
'int[]' => 'INTEGER %name%(*)',
65
'int[][3]' => 'INTEGER %name%(3,*)',
66
'int*' => 'INTEGER', # assume output scalar (see array
69
'bool[]' => 'LOGICAL %name%(*)',
70
'MPI_Handler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
71
'MPI_Win_errhandler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
72
'MPI_Comm_errhandler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
73
'MPI_File_errhandler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
74
# These other functions have <choice> (really void*) arguments
75
# and so an interface spec is very hard to do in Fortran 90.
76
'MPI_Comm_copy_attr_function*' => 'EXTERNAL',
77
'MPI_Comm_delete_attr_function*' => 'EXTERNAL',
78
'MPI_Type_copy_attr_function*' => 'EXTERNAL',
79
'MPI_Type_delete_attr_function*' => 'EXTERNAL',
80
'MPI_Win_copy_attr_function*' => 'EXTERNAL',
81
'MPI_Win_delete_attr_function*' => 'EXTERNAL',
82
'MPI_Copy_function*' => 'EXTERNAL',
83
'MPI_Delete_function*' => 'EXTERNAL',
84
'MPI_User_function*' => 'EXTERNAL',
85
'MPI_Grequest_query_function*' => 'EXTERNAL',
86
'MPI_Grequest_free_function*' => 'EXTERNAL',
87
'MPI_Grequest_cancel_function*' => 'EXTERNAL',
88
'MPI_Datarep_conversion_function*' => 'EXTERNAL',
89
'MPI_Datarep_extent_function*' => 'EXTERNAL',
90
'MPI_Request' => 'INTEGER',
91
'MPI_Request*' => 'INTEGER',
92
'MPI_Request[]' => 'INTEGER %name%(*)',
93
'MPIO_Request' => 'INTEGER',
94
'MPIO_Request*' => 'INTEGER',
95
'MPI_Datatype' => 'INTEGER',
96
'MPI_Datatype*' => 'INTEGER',
97
'MPI_Datatype[]' => 'INTEGER %name%(*)',
98
'MPI_Comm' => 'INTEGER',
99
'MPI_Comm*' => 'INTEGER', # Never an array of comm
100
'MPI_Group' => 'INTEGER',
101
'MPI_Group*' => 'INTEGER', # Never an array of groups
102
'MPI_Errhandler' => 'INTEGER',
103
'MPI_Errhandler*' => 'INTEGER', # Never an array of errhandlers
104
'MPI_Op' => 'INTEGER',
105
'MPI_Op*' => 'INTEGER', # Never an array of ops
106
'MPI_Message' => 'INTEGER',
107
'MPI_Message*' => 'INTEGER', # Never an array of messages
108
'MPI_Status*' => 'INTEGER %name%(MPI_STATUS_SIZE)',
109
'MPI_Status[]' => 'INTEGER %name%(MPI_STATUS_SIZE,*)',
110
'MPI_Aint' => 'INTEGER(KIND=MPI_ADDRESS_KIND)',
111
'MPI_Aint*' => 'INTEGER(KIND=MPI_ADDRESS_KIND)',
112
'MPI_Aint[]' => 'INTEGER(KIND=MPI_ADDRESS_KIND) %name%(*)',
113
'MPI_Count' => 'INTEGER(KIND=MPI_COUNT_KIND)',
114
'MPI_Count*' => 'INTEGER(KIND=MPI_COUNT_KIND)',
115
'MPI_Offset' => 'INTEGER(KIND=MPI_OFFSET_KIND)',
116
'MPI_Offset*' => 'INTEGER(KIND=MPI_OFFSET_KIND)',
117
'MPI_Info' => 'INTEGER',
118
'MPI_Info*' => 'INTEGER', # Never an array of info
119
'MPI_Info[]' => 'INTEGER %name%(*)',
120
'char*' => 'CHARACTER (LEN=*)',
121
'char[]' => 'CHARACTER (LEN=*)',
122
'char*[]' => 'CHARACTER (LEN=*) %name%(*)',
123
'char**[]' => 'CHARACTER (LEN=*) %name%(v0,*)', #special case
124
# from Comm_Spawn_multiple
125
'MPI_Win' => 'INTEGER',
126
'MPI_Win*' => 'INTEGER', # Never an array of win
127
'MPI_File' => 'INTEGER',
128
'MPI_File*' => 'INTEGER', # Never an array of files
129
'MPI_Message' => 'INTEGER',
130
'MPI_Message*' => 'INTEGER', # Never an array of messages
64
%argtypec2f = ( 'int' => 'INTEGER',
65
'int[]' => 'INTEGER %name%(*)',
66
'int[][3]' => 'INTEGER %name%(3,*)',
67
'int*' => 'INTEGER', # assume output scalar (see array
70
'bool[]' => 'LOGICAL %name%(*)',
71
'MPI_Handler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
72
'MPI_Win_errhandler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
73
'MPI_Comm_errhandler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
74
'MPI_File_errhandler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
75
# These other functions have <choice> (really void*) arguments
76
# and so an interface spec is very hard to do in Fortran 90.
77
'MPI_Comm_copy_attr_function*' => 'EXTERNAL',
78
'MPI_Comm_delete_attr_function*' => 'EXTERNAL',
79
'MPI_Type_copy_attr_function*' => 'EXTERNAL',
80
'MPI_Type_delete_attr_function*' => 'EXTERNAL',
81
'MPI_Win_copy_attr_function*' => 'EXTERNAL',
82
'MPI_Win_delete_attr_function*' => 'EXTERNAL',
83
'MPI_Copy_function*' => 'EXTERNAL',
84
'MPI_Delete_function*' => 'EXTERNAL',
85
'MPI_User_function*' => 'EXTERNAL',
86
'MPI_Grequest_query_function*' => 'EXTERNAL',
87
'MPI_Grequest_free_function*' => 'EXTERNAL',
88
'MPI_Grequest_cancel_function*' => 'EXTERNAL',
89
'MPI_Datarep_conversion_function*' => 'EXTERNAL',
90
'MPI_Datarep_extent_function*' => 'EXTERNAL',
91
'MPI_Request' => 'INTEGER',
92
'MPI_Request*' => 'INTEGER',
93
'MPI_Request[]' => 'INTEGER %name%(*)',
94
'MPIO_Request' => 'INTEGER',
95
'MPIO_Request*' => 'INTEGER',
96
'MPI_Datatype' => 'INTEGER',
97
'MPI_Datatype*' => 'INTEGER',
98
'MPI_Datatype[]' => 'INTEGER %name%(*)',
99
'MPI_Comm' => 'INTEGER',
100
'MPI_Comm*' => 'INTEGER', # Never an array of comm
101
'MPI_Group' => 'INTEGER',
102
'MPI_Group*' => 'INTEGER', # Never an array of groups
103
'MPI_Errhandler' => 'INTEGER',
104
'MPI_Errhandler*' => 'INTEGER', # Never an array of errhandlers
105
'MPI_Op' => 'INTEGER',
106
'MPI_Op*' => 'INTEGER', # Never an array of ops
107
'MPI_Message' => 'INTEGER',
108
'MPI_Message*' => 'INTEGER', # Never an array of messages
109
'MPI_Status*' => 'INTEGER %name%(MPI_STATUS_SIZE)',
110
'MPI_Status[]' => 'INTEGER %name%(MPI_STATUS_SIZE,*)',
111
'MPI_Aint' => 'INTEGER(KIND=MPI_ADDRESS_KIND)',
112
'MPI_Aint*' => 'INTEGER(KIND=MPI_ADDRESS_KIND)',
113
'MPI_Aint[]' => 'INTEGER(KIND=MPI_ADDRESS_KIND) %name%(*)',
114
'MPI_Count' => 'INTEGER(KIND=MPI_COUNT_KIND)',
115
'MPI_Count*' => 'INTEGER(KIND=MPI_COUNT_KIND)',
116
'MPI_Offset' => 'INTEGER(KIND=MPI_OFFSET_KIND)',
117
'MPI_Offset*' => 'INTEGER(KIND=MPI_OFFSET_KIND)',
118
'MPI_Info' => 'INTEGER',
119
'MPI_Info*' => 'INTEGER', # Never an array of info
120
'MPI_Info[]' => 'INTEGER %name%(*)',
121
'char*' => 'CHARACTER (LEN=*)',
122
'char[]' => 'CHARACTER (LEN=*)',
123
'char*[]' => 'CHARACTER (LEN=*) %name%(*)',
124
'char**[]' => 'CHARACTER (LEN=*) %name%(count,*)', #special case
125
# from Comm_Spawn_multiple
126
'MPI_Win' => 'INTEGER',
127
'MPI_Win*' => 'INTEGER', # Never an array of win
128
'MPI_File' => 'INTEGER',
129
'MPI_File*' => 'INTEGER', # Never an array of files
130
'MPI_Message' => 'INTEGER',
131
'MPI_Message*' => 'INTEGER', # Never an array of messages
133
134
# special_args provides for handling of arguments that require special
134
# features. The keys are of the form 'Routine-count', with count the
135
# features. The keys are of the form 'Routine-count', with count the
135
136
# position of the argument, starting from one.
136
137
%special_args = ( 'Testany-2' => 'MPI_Request[]',
137
'Testany-4' => 'bool',
138
'Startall-2' => 'MPI_Request[]',
139
'Testall-2' => 'MPI_Request[]',
140
'Testall-3' => 'bool',
141
'Testall-4' => 'MPI_Status[]',
142
'Testsome-2' => 'MPI_Request[]',
143
'Testsome-4' => 'int[]',
144
'Testsome-5' => 'MPI_Status[]',
146
'Test_cancelled-2' => 'bool',
147
'Type_hindexed-2' => 'int[]',
148
'Type_hindexed-3' => 'int[]',
149
'Type_indexed-2' => 'int[]',
150
'Type_indexed-3' => 'int[]',
151
'Type_hvector-3' => 'int',
152
'Type_struct-2' => 'int[]',
153
'Type_struct-3' => 'int[]',
154
'Type_struct-4' => 'MPI_Datatype[]',
155
'Type_extent-2' => 'int',
156
'Type_lb-2' => 'int',
157
'Type_ub-2' => 'int',
158
'Waitall-2' => 'MPI_Request[]',
159
'Waitall-3' => 'MPI_Status[]',
160
'Waitany-2' => 'MPI_Request[]',
161
'Waitsome-2' => 'MPI_Request[]',
162
'Waitsome-4' => 'int[]',
163
'Waitsome-5' => 'MPI_Status[]',
164
'Group_excl-3' => 'int[]',
165
'Group_incl-3' => 'int[]',
166
'Group_translate_ranks-3' => 'int[]',
167
'Group_translate_ranks-5' => 'int[]',
168
'Cart_coords-4' => 'int[]',
169
'Cart_create-3' => 'int[]',
170
'Cart_create-4' => 'bool[]',
171
'Cart_get-3' => 'int[]',
172
'Cart_get-5' => 'int[]',
173
'Cart_get-4' => 'bool[]',
174
'Cart_map-3' => 'int[]',
175
'Cart_map-4' => 'bool[]',
176
'Cart_rank-2' => 'int[]',
177
'Cart_sub-2' => 'bool[]',
178
'Dims_create-3' => 'int[]',
179
'Graph_create-3' => 'int[]',
180
'Graph_create-4' => 'int[]',
181
'Graph_create-5' => 'bool',
182
'Graph_get-4' => 'int[]',
183
'Graph_get-5' => 'int[]',
184
'Graph_map-3' => 'int[]',
185
'Graph_map-4' => 'int[]',
186
'Graph_neighbors-4' => 'int[]',
187
'Dist_graph_create-8' => 'bool',
188
'Dist_graph_create_adjacent-9' => 'bool',
189
'Dist_graph_neighbors_count-4' => 'bool',
190
'Allgatherv-5' => 'int[]',
191
'Allgatherv-6' => 'int[]',
192
'Alltoallv-2' => 'int[]',
193
'Alltoallv-3' => 'int[]',
194
'Alltoallv-6' => 'int[]',
195
'Alltoallv-7' => 'int[]',
196
'Alltoallw-2' => 'int[]',
197
'Alltoallw-3' => 'int[]',
198
'Alltoallw-6' => 'int[]',
199
'Alltoallw-7' => 'int[]',
200
'Gatherv-5' => 'int[]',
201
'Gatherv-6' => 'int[]',
202
'Iallgatherv-5' => 'int[]',
203
'Iallgatherv-6' => 'int[]',
204
'Ialltoallv-2' => 'int[]',
205
'Ialltoallv-3' => 'int[]',
206
'Ialltoallv-6' => 'int[]',
207
'Ialltoallv-7' => 'int[]',
208
'Ialltoallw-2' => 'int[]',
209
'Ialltoallw-3' => 'int[]',
210
'Ialltoallw-6' => 'int[]',
211
'Ialltoallw-7' => 'int[]',
212
'Igatherv-5' => 'int[]',
213
'Igatherv-6' => 'int[]',
214
'Ireduce_scatter-3' => 'int[]',
215
'Iscatterv-2' => 'int[]',
216
'Iscatterv-3' => 'int[]',
217
'Reduce_scatter-3' => 'int[]',
218
'Scatterv-2' => 'int[]',
219
'Scatterv-3' => 'int[]',
220
'Iprobe-4' => 'bool',
221
'Improbe-4' => 'bool',
222
'Op_create-2' => 'bool',
223
'Attr_get-4' => 'bool',
224
'Comm_get_attr-4' => 'bool',
225
'Type_get_attr-4' => 'bool',
226
'Win_get_attr-4' => 'bool',
227
'Comm_test_inter-2' => 'bool',
228
'Intercomm_merge-2' => 'bool',
229
'Cart_create-5' => 'bool',
230
'Initialized-1' => 'bool',
231
'Finalized-1' => 'bool',
232
'Group_range_excl-3' => 'int[][3]',
233
'Group_range_incl-3' => 'int[][3]',
234
'Info_get_valuelen-4' => 'bool',
235
'Is_thread_main-1' => 'bool',
236
'Type_create_subarray-2' => 'int[]',
237
'Type_create_subarray-3' => 'int[]',
238
'Type_create_subarray-4' => 'int[]',
239
'Request_get_status-2' => 'bool',
240
'Status_set_cancelled-2' => 'bool',
241
'Info_get-5' => 'bool',
242
'Type_create_indexed_block-3' => 'int[]',
243
'Type_create_darray-4' => 'int[]',
244
'Type_create_darray-5' => 'int[]',
245
'Type_create_darray-6' => 'int[]',
246
'Type_create_darray-7' => 'int[]',
247
'Type_create_struct-2' => 'int[]',
248
'Type_create_struct-3' => 'MPI_Aint[]',
249
'Win_test-2' => 'bool',
250
'Type_create_hindexed-2' => 'int[]',
251
'Type_create_hindexed-3' => 'MPI_Aint[]',
252
'Op_commutative-2' => 'bool',
253
'File_set_atomicity-2' => 'bool',
254
'File_get_atomicity-2' => 'bool',
138
'Testany-4' => 'bool',
139
'Startall-2' => 'MPI_Request[]',
140
'Testall-2' => 'MPI_Request[]',
141
'Testall-3' => 'bool',
142
'Testall-4' => 'MPI_Status[]',
143
'Testsome-2' => 'MPI_Request[]',
144
'Testsome-4' => 'int[]',
145
'Testsome-5' => 'MPI_Status[]',
147
'Test_cancelled-2' => 'bool',
148
'Type_hindexed-2' => 'int[]',
149
'Type_hindexed-3' => 'int[]',
150
'Type_indexed-2' => 'int[]',
151
'Type_indexed-3' => 'int[]',
152
'Type_hvector-3' => 'int',
153
'Type_struct-2' => 'int[]',
154
'Type_struct-3' => 'int[]',
155
'Type_struct-4' => 'MPI_Datatype[]',
156
'Type_extent-2' => 'int',
157
'Type_lb-2' => 'int',
158
'Type_ub-2' => 'int',
159
'Waitall-2' => 'MPI_Request[]',
160
'Waitall-3' => 'MPI_Status[]',
161
'Waitany-2' => 'MPI_Request[]',
162
'Waitsome-2' => 'MPI_Request[]',
163
'Waitsome-4' => 'int[]',
164
'Waitsome-5' => 'MPI_Status[]',
165
'Group_excl-3' => 'int[]',
166
'Group_incl-3' => 'int[]',
167
'Group_translate_ranks-3' => 'int[]',
168
'Group_translate_ranks-5' => 'int[]',
169
'Cart_coords-4' => 'int[]',
170
'Cart_create-3' => 'int[]',
171
'Cart_create-4' => 'bool[]',
172
'Cart_get-3' => 'int[]',
173
'Cart_get-5' => 'int[]',
174
'Cart_get-4' => 'bool[]',
175
'Cart_map-3' => 'int[]',
176
'Cart_map-4' => 'bool[]',
177
'Cart_rank-2' => 'int[]',
178
'Cart_sub-2' => 'bool[]',
179
'Dims_create-3' => 'int[]',
180
'Graph_create-3' => 'int[]',
181
'Graph_create-4' => 'int[]',
182
'Graph_create-5' => 'bool',
183
'Graph_get-4' => 'int[]',
184
'Graph_get-5' => 'int[]',
185
'Graph_map-3' => 'int[]',
186
'Graph_map-4' => 'int[]',
187
'Graph_neighbors-4' => 'int[]',
188
'Dist_graph_create-8' => 'bool',
189
'Dist_graph_create_adjacent-9' => 'bool',
190
'Dist_graph_neighbors_count-4' => 'bool',
191
'Allgatherv-5' => 'int[]',
192
'Allgatherv-6' => 'int[]',
193
'Alltoallv-2' => 'int[]',
194
'Alltoallv-3' => 'int[]',
195
'Alltoallv-6' => 'int[]',
196
'Alltoallv-7' => 'int[]',
197
'Alltoallw-2' => 'int[]',
198
'Alltoallw-3' => 'int[]',
199
'Alltoallw-6' => 'int[]',
200
'Alltoallw-7' => 'int[]',
201
'Gatherv-5' => 'int[]',
202
'Gatherv-6' => 'int[]',
203
'Iallgatherv-5' => 'int[]',
204
'Iallgatherv-6' => 'int[]',
205
'Ialltoallv-2' => 'int[]',
206
'Ialltoallv-3' => 'int[]',
207
'Ialltoallv-6' => 'int[]',
208
'Ialltoallv-7' => 'int[]',
209
'Ialltoallw-2' => 'int[]',
210
'Ialltoallw-3' => 'int[]',
211
'Ialltoallw-6' => 'int[]',
212
'Ialltoallw-7' => 'int[]',
213
'Igatherv-5' => 'int[]',
214
'Igatherv-6' => 'int[]',
215
'Ireduce_scatter-3' => 'int[]',
216
'Iscatterv-2' => 'int[]',
217
'Iscatterv-3' => 'int[]',
218
'Reduce_scatter-3' => 'int[]',
219
'Scatterv-2' => 'int[]',
220
'Scatterv-3' => 'int[]',
221
'Iprobe-4' => 'bool',
222
'Improbe-4' => 'bool',
223
'Op_create-2' => 'bool',
224
'Attr_get-4' => 'bool',
225
'Comm_get_attr-4' => 'bool',
226
'Type_get_attr-4' => 'bool',
227
'Win_get_attr-4' => 'bool',
228
'Comm_test_inter-2' => 'bool',
229
'Intercomm_merge-2' => 'bool',
230
'Cart_create-5' => 'bool',
231
'Initialized-1' => 'bool',
232
'Finalized-1' => 'bool',
233
'Group_range_excl-3' => 'int[][3]',
234
'Group_range_incl-3' => 'int[][3]',
235
'Info_get_valuelen-4' => 'bool',
236
'Is_thread_main-1' => 'bool',
237
'Type_create_subarray-2' => 'int[]',
238
'Type_create_subarray-3' => 'int[]',
239
'Type_create_subarray-4' => 'int[]',
240
'Request_get_status-2' => 'bool',
241
'Status_set_cancelled-2' => 'bool',
242
'Info_get-5' => 'bool',
243
'Type_create_indexed_block-3' => 'int[]',
244
'Type_create_darray-4' => 'int[]',
245
'Type_create_darray-5' => 'int[]',
246
'Type_create_darray-6' => 'int[]',
247
'Type_create_darray-7' => 'int[]',
248
'Type_create_struct-2' => 'int[]',
249
'Type_create_struct-3' => 'MPI_Aint[]',
250
'Win_test-2' => 'bool',
251
'Type_create_hindexed-2' => 'int[]',
252
'Type_create_hindexed-3' => 'MPI_Aint[]',
253
'Op_commutative-2' => 'bool',
254
'File_set_atomicity-2' => 'bool',
255
'File_get_atomicity-2' => 'bool',
257
258
# Some routines must be skipped (custom code is provided for them)
258
259
%skip_routines = ( 'Init' => 1, 'Init_thread' => 1, 'Status_c2f' => 1,
259
'Status_f2c' => 1, 'Pcontrol' => 1,
260
'Status_f2c' => 1, 'Pcontrol' => 1,
262
263
# Some routines *may* be skipped if we don't want to handle the possibility
263
264
# of a scalar or vector argument
453
458
\@WTIME_DOUBLE_TYPE\@ PMPI_WTICK
454
459
END FUNCTION PMPI_WTICK
456
SUBROUTINE MPI_NULL_DELETE_FN(a,b,c,d,e)
461
SUBROUTINE MPI_NULL_DELETE_FN(COMM, KEYVAL, ATTRIBUTE_VAL,&
463
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
464
INTEGER COMM, KEYVAL, IERROR
465
INTEGER(KIND=MPI_ADDRESS_KIND) ATTRIBUTE_VAL, EXTRA_STATE
458
466
END SUBROUTINE MPI_NULL_DELETE_FN
460
SUBROUTINE MPI_DUP_FN(a,b,c,d,e,f,g)
468
SUBROUTINE MPI_DUP_FN(OLDCOMM, KEYVAL, EXTRA_STATE,&
469
ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
470
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
471
INTEGER OLDCOMM, KEYVAL, IERROR
472
INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
463
474
END SUBROUTINE MPI_DUP_FN
465
SUBROUTINE MPI_NULL_COPY_FN(a,b,c,d,e,f,g)
476
SUBROUTINE MPI_NULL_COPY_FN(OLDCOMM, KEYVAL, EXTRA_STATE,&
477
ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
478
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
479
INTEGER OLDCOMM, KEYVAL, IERROR
480
INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
468
482
END SUBROUTINE MPI_NULL_COPY_FN
470
SUBROUTINE MPI_COMM_NULL_DELETE_FN(a,b,c,d,e)
471
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
473
INTEGER (KIND=MPI_ADDRESS_KIND) c, d
484
SUBROUTINE MPI_COMM_NULL_DELETE_FN(COMM, COMM_KEYVAL, ATTRIBUTE_VAL,&
486
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
487
INTEGER COMM, COMM_KEYVAL, IERROR
488
INTEGER(KIND=MPI_ADDRESS_KIND) ATTRIBUTE_VAL, EXTRA_STATE
474
489
END SUBROUTINE MPI_COMM_NULL_DELETE_FN
476
SUBROUTINE MPI_COMM_DUP_FN(a,b,c,d,e,f,g)
477
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
479
INTEGER (KIND=MPI_ADDRESS_KIND) c,d,e
491
SUBROUTINE MPI_COMM_DUP_FN(OLDCOMM, COMM_KEYVAL, EXTRA_STATE,&
492
ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
493
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
494
INTEGER OLDCOMM, COMM_KEYVAL, IERROR
495
INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
481
497
END SUBROUTINE MPI_COMM_DUP_FN
483
SUBROUTINE MPI_COMM_NULL_COPY_FN(a,b,c,d,e,f,g)
484
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
486
INTEGER (KIND=MPI_ADDRESS_KIND) c,d,e
499
SUBROUTINE MPI_COMM_NULL_COPY_FN(OLDCOMM, COMM_KEYVAL, EXTRA_STATE,&
500
ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
501
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
502
INTEGER OLDCOMM, COMM_KEYVAL, IERROR
503
INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
488
505
END SUBROUTINE MPI_COMM_NULL_COPY_FN
490
SUBROUTINE MPI_TYPE_NULL_DELETE_FN(a,b,c,d,e)
491
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
493
INTEGER (KIND=MPI_ADDRESS_KIND) c, d
507
SUBROUTINE MPI_TYPE_NULL_DELETE_FN(DATATYPE, TYPE_KEYVAL, ATTRIBUTE_VAL,&
509
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
510
INTEGER DATATYPE, TYPE_KEYVAL, IERROR
511
INTEGER(KIND=MPI_ADDRESS_KIND) ATTRIBUTE_VAL, EXTRA_STATE
494
512
END SUBROUTINE MPI_TYPE_NULL_DELETE_FN
496
SUBROUTINE MPI_TYPE_DUP_FN(a,b,c,d,e,f,g)
497
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
499
INTEGER (KIND=MPI_ADDRESS_KIND) c,d,e
514
SUBROUTINE MPI_TYPE_DUP_FN(OLDTYPE, TYPE_KEYVAL, EXTRA_STATE,&
515
ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
516
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
517
INTEGER OLDTYPE, TYPE_KEYVAL, IERROR
518
INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
501
520
END SUBROUTINE MPI_TYPE_DUP_FN
503
SUBROUTINE MPI_TYPE_NULL_COPY_FN(a,b,c,d,e,f,g)
504
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
506
INTEGER (KIND=MPI_ADDRESS_KIND) c,d,e
522
SUBROUTINE MPI_TYPE_NULL_COPY_FN(OLDTYPE, TYPE_KEYVAL, EXTRA_STATE,&
523
ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
524
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
525
INTEGER OLDTYPE, TYPE_KEYVAL, IERROR
526
INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
508
528
END SUBROUTINE MPI_TYPE_NULL_COPY_FN
510
SUBROUTINE MPI_WIN_NULL_DELETE_FN(a,b,c,d,e)
511
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
513
INTEGER (KIND=MPI_ADDRESS_KIND) c, d
530
SUBROUTINE MPI_WIN_NULL_DELETE_FN(WIN, WIN_KEYVAL, ATTRIBUTE_VAL,&
532
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
533
INTEGER WIN, WIN_KEYVAL, IERROR
534
INTEGER(KIND=MPI_ADDRESS_KIND) ATTRIBUTE_VAL, EXTRA_STATE
514
535
END SUBROUTINE MPI_WIN_NULL_DELETE_FN
516
SUBROUTINE MPI_WIN_DUP_FN(a,b,c,d,e,f,g)
517
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
519
INTEGER (KIND=MPI_ADDRESS_KIND) c,d,e
537
SUBROUTINE MPI_WIN_DUP_FN(OLDWIN, WIN_KEYVAL, EXTRA_STATE,&
538
ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
539
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
540
INTEGER OLDWIN, WIN_KEYVAL, IERROR
541
INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
521
543
END SUBROUTINE MPI_WIN_DUP_FN
523
SUBROUTINE MPI_WIN_NULL_COPY_FN(a,b,c,d,e,f,g)
524
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
526
INTEGER (KIND=MPI_ADDRESS_KIND) c,d,e
545
SUBROUTINE MPI_WIN_NULL_COPY_FN(OLDWIN, WIN_KEYVAL, EXTRA_STATE,&
546
ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
547
USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
548
INTEGER OLDWIN, WIN_KEYVAL, IERROR
549
INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
528
551
END SUBROUTINE MPI_WIN_NULL_COPY_FN
532
554
# Here's where we need to place the interface definitions for the functions
533
# that take vector or scalar arguments (startall, testall/any/some,
555
# that take vector or scalar arguments (startall, testall/any/some,
534
556
# waitall/any/some, group_translate_ranks, etc.)
535
# For each such routine, we need to generate two entries. Here's the
557
# For each such routine, we need to generate two entries. Here's the
536
558
# example for STARTALL:
537
559
# subroutine MPI_STARTALL_S(c,r,ierr)
538
560
# integer c,r,ierr
1214
# Print the declarations for the given routine.
1246
# Print arguments in a pair of braces and end with a new line.
1247
# $fd : File handle to print to.
1248
# $curlen : Length of the current line.
1249
# $indent : Indention length of the following lines when they exist.
1250
# $line_length : Maximal length of a line.
1251
# @argnames : argument names to print out.
1253
my ($fd, $curlen, $indent, $line_length, @argnames) = @_;
1258
foreach my $arg (@argnames) {
1259
if ($curlen + length($arg) + 2 > $line_length) { # + 2 for the trailing ',&'
1262
print $fd " " x $indent;
1268
if ($i++ < $#argnames) {
1272
$curlen += length($arg) + 1;
1278
# Print the declarations for the given routine.
1215
1279
sub PrintArgDecls {
1216
1280
my ($routine,$svflag,$svArgs) = @_;
1218
1282
my $ucname = uc($routine);
1219
my $args = $mpi_routines{$routine};
1220
my @parms = split(/,/, $args );
1222
# preload the svargs if requested. This is used to decide whether
1283
my @argtypes = split(/,/, $mpi_routines{$routine}[0]);
1284
my @argnames = split(/,/, $mpi_routines{$routine}[1]);
1286
print "Printing argument delartion for $ucname\n" if $gDebug;
1287
print "argtypes = $mpi_routines{$routine}[0]\n" if $gDebug;
1288
print "argnames = $mpi_routines{$routine}[1]\n" if $gDebug;
1290
# preload the svargs if requested. This is used to decide whether
1223
1291
# an array arg is output as a scalar or a vector
1224
1292
my %svargs = ();
1226
for my $val (split(/:/,$svArgs)) {
1229
if ($loc =~ /(\d+)-(\d+)/) {
1233
$svargs{$loc} = $count;
1236
# Determine if we need any constants (e.g., MPI_STATUS_SIZE,
1294
for my $val (split(/:/,$svArgs)) {
1297
if ($loc =~ /(\d+)-(\d+)/) {
1301
$svargs{$loc} = $count;
1304
# Determine if we need any constants (e.g., MPI_STATUS_SIZE,
1237
1305
# MPI_OFFSET_KIND)
1238
1306
my %use_constants = ();
1239
1307
my $found_constants = 0;
1240
for (my $i=0; $i<=$#parms; $i++) {
1241
$parms[$i] =~ s/^const\s+//; # Remove const if present
1243
# Check for special args
1245
if (defined($special_args{"$routine-$loc"})) {
1246
$parm = $special_args{"$routine-$loc"};
1248
# Map the C type to the Fortran type
1251
$fparm = $parmc2f{$cparm};
1252
# Now, does this type contain an MPI constant?
1253
if (!defined($fparm)) {
1254
print "$cparm value has no matching fortran parm\n";
1256
if ($fparm =~ /(MPI_[A-Z_]*)/) {
1257
$use_constants{$1} = 1;
1258
$found_constants = 1;
1308
for (my $i=0; $i<=$#argtypes; $i++) {
1309
$argtypes[$i] =~ s/^const\s+//; # Remove const if present
1310
my $argtype = $argtypes[$i];
1311
# Check for special args
1313
if (defined($special_args{"$routine-$loc"})) {
1314
$argtype = $special_args{"$routine-$loc"};
1316
# Map the C type to the Fortran type
1317
my $cargtype = $argtype;
1318
$cargtype =~ s/\s+//g;
1319
my $fargtype = $argtypec2f{$cargtype};
1320
# Now, does this type contain an MPI constant?
1321
if (!defined($fargtype)) {
1322
print "$cargtype value has no matching fortran argtype\n";
1324
if ($fargtype =~ /(MPI_[A-Z_]*)/) {
1325
$use_constants{$1} = 1;
1326
$found_constants = 1;
1261
1329
if ($found_constants) {
1262
print MPIBASEFD " USE MPI_CONSTANTS,ONLY:";
1264
foreach $name (keys(%use_constants)) {
1265
print MPIBASEFD "$sep$name";
1267
$NeedConstants{$routine} .= "$name ";
1269
print MPIBASEFD "\n";
1330
print MPIBASEFD " USE MPI_CONSTANTS,ONLY:";
1332
foreach $name (keys(%use_constants)) {
1333
print MPIBASEFD "$sep$name";
1335
$NeedConstants{$routine} .= "$name ";
1337
print MPIBASEFD "\n";
1272
1340
# Output argument types
1273
$lastParmType = "<none>";
1274
for (my $i=0; $i<=$#parms; $i++) {
1276
# Check for special args
1278
if (defined($special_args{"$routine-$loc"})) {
1279
$parm = $special_args{"$routine-$loc"};
1281
# Map the C type to the Fortran type
1284
$fparm = $parmc2f{$cparm};
1286
print STDERR "$routine: No parm type for $cparm ($parm)\n";
1288
# Split out the base type from the name
1289
if ($fparm =~ /(\w+.*)\s+(%name\S.*)/) {
1292
if ($varName =~ /%name%/) {
1293
$varName =~ s/%name%/v$i/;
1295
$varName =~ s/%nl%/\n /g;
1296
$parmType =~ s/%nl%/\n /g;
1298
# Here's where we might change vector to scalar args
1300
if (defined($svargs{$loc})) {
1301
# The value is the count arg for the array; later, we
1302
# can make use of that to improve the definitions
1303
if ($varName =~ /,\*/) {
1304
$varName =~ s/,\*//;
1306
elsif ($varName =~ /\(\*\)/) {
1307
$varName =~ s/\(\*\)//;
1310
print STDERR "Failed to make arg $i in $routine a scalar\n";
1319
if ($parmType ne $lastParmType) {
1320
if ($lastParmType ne "<none>" ) { print MPIBASEFD "\n"; }
1321
print MPIBASEFD " $parmType $varName";
1322
$lastParmType = $parmType;
1325
print MPIBASEFD ", $varName";
1341
for (my $i=0; $i<=$#argtypes; $i++) {
1342
$argtype = $argtypes[$i];
1343
# Check for special args
1345
if (defined($special_args{"$routine-$loc"})) {
1346
$argtype = $special_args{"$routine-$loc"};
1348
# Map the C type to the Fortran type
1349
$cargtype = $argtype;
1350
$cargtype =~ s/\s+//g;
1351
$fargtype = $argtypec2f{$cargtype};
1352
if ($fargtype eq "") {
1353
print STDERR "$routine: No Fortran type for $cargtype ($argtype)\n";
1355
# Split out the base type from the name
1356
if ($fargtype =~ /(\w+.*)\s+(%name\S.*)/) {
1359
if ($varName =~ /%name%/) {
1360
$varName =~ s/%name%/$argnames[$i]/;
1362
$varName =~ s/%nl%/\n /g;
1363
$varType =~ s/%nl%/\n /g;
1365
# Here's where we might change vector to scalar args
1367
if (defined($svargs{$loc})) {
1368
# The value is the count arg for the array; later, we
1369
# can make use of that to improve the definitions
1370
if ($varName =~ /,\*/) {
1371
$varName =~ s/,\*//;
1373
elsif ($varName =~ /\(\*\)/) {
1374
$varName =~ s/\(\*\)//;
1377
print STDERR "Failed to make arg $i in $routine a scalar\n";
1383
$varType = $fargtype;
1384
$varName = $argnames[$i];
1387
print MPIBASEFD " $varType $varName\n";
1328
if ($lastParmType ne "<none>" ) { print MPIBASEFD "\n"; }
1330
print MPIBASEFD " INTEGER ierror\n";
1334
1392
# Replace old file with new file only if new file is different
1335
# Otherwise, remove new filename
1393
# Otherwise, remove new filename
1336
1394
sub ReplaceIfDifferent {
1337
1395
my ($oldfilename,$newfilename) = @_;
1339
if (-s $oldfilename) {
1340
$rc = system "cmp -s $newfilename $oldfilename";
1341
$rc >>= 8; # Shift right to get exit status
1397
if (-s $oldfilename) {
1398
$rc = system "cmp -s $newfilename $oldfilename";
1399
$rc >>= 8; # Shift right to get exit status
1343
1401
if ($rc != 0) {
1344
# The files differ. Replace the old file
1346
if (-s $oldfilename) {
1347
print STDERR "Replacing $oldfilename\n";
1348
# If debugging and there is a difference, show that difference
1349
if ($gDebug) { system "diff $newfilename $oldfilename"; }
1402
# The files differ. Replace the old file
1404
if (-s $oldfilename) {
1405
print STDERR "Replacing $oldfilename\n";
1406
# If debugging and there is a difference, show that difference
1407
if ($gDebug) { system "diff $newfilename $oldfilename"; }
1351
unlink $oldfilename;
1354
print STDERR "Creating $oldfilename\n";
1356
rename $newfilename, $oldfilename ||
1357
die "Could not replace $oldfilename";
1360
unlink $newfilename;
1409
unlink $oldfilename;
1412
print STDERR "Creating $oldfilename\n";
1414
rename $newfilename, $oldfilename ||
1415
die "Could not replace $oldfilename";
1418
unlink $newfilename;