1#!/usr/bin/env perl
2#
3# Copyright (c) 2011-2014 Cisco Systems, Inc.  All rights reserved.
4# Copyright (c) 2016-2017 Research Organization for Information Science
5#                         and Technology (RIST). All rights reserved.
6# Copyright (c) 2016      FUJITSU LIMITED.  All rights reserved.
7# $COPYRIGHT$
8#
9# Additional copyrights may follow
10#
11# $HEADER$
12#
13
14# This script creates header files to be compiled with the various
15# Fortran bindings.  In some cases, we need Fortran PARAMETER values;
16# in other cases, we need #define preprocessor macros.
17#
18# This script generates both cases, and ensures that the values are
19# the same between both (e.g., that MPI_COMM_WORLD is both a fortran
20# INTEGER PARAMETER of value 0 and is #define'd to be 0).
21#
22# Additionally, since Open MPI provides the configure ability to
23# compile out the entire MPI IO interface, all the IO
24# handles/constants are generated in separate .h files in the
25# non-preprocessor case, and included in relevant #if's in the
26# preprocessor case.
27#
28# Files are generated in the following directories:
29#
30#   ompi/include
31#   ompi/mpi/fortran/use-mpi-f08
32#
33
34use strict;
35
36#----------------------------------------------------------------------------
37
38# Write an output file only if a) the output file does not already
39# exist, or b) it exists, but its contents are different than $str.
40
41sub write_file {
42    my ($filename_out, $str) = @_;
43
44    my $need_write = 0;
45    if (! -f $filename_out) {
46        $need_write = 1;
47    } else {
48        open(FILE_IN, $filename_out) || die "Couldn't open $filename_out";
49        my $tmp;
50        $tmp .= $_
51            while (<FILE_IN>);
52        close(FILE_IN);
53        if ($str ne $tmp) {
54            $need_write = 1;
55        }
56    }
57
58    if ($need_write) {
59        open(FILE_OUT, ">$filename_out") || die "Couldn't open $filename_out";
60        print FILE_OUT $str;
61        close(FILE_OUT);
62        print "created $filename_out\n";
63    } else {
64        print "$filename_out unchanged; not written\n";
65    }
66}
67
68#----------------------------------------------------------------------------
69
70print "creating Fortran header files (with common constants)...\n";
71
72# Find the OMPI topdir.  It is likely the pwd.
73my $topdir;
74if (-r "ompi/include/mpi.h.in") {
75    $topdir = ".";
76} elsif (-r "include/mpi.h.in") {
77    $topdir = "..";
78} elsif (-r "mpi.h.in") {
79    $topdir = "../..";
80} else {
81    print "Please run this script from the Open MPI topdir or topdir/include/mpi\n";
82    print "Aborting.\n";
83    exit(1);
84}
85
86#----------------------------------------------------------------------------
87
88my $handles;
89my $lhandles;
90
91$handles->{MPI_COMM_WORLD} = 0;
92$handles->{MPI_COMM_SELF} = 1;
93$handles->{MPI_GROUP_EMPTY} = 1;
94$handles->{MPI_ERRORS_ARE_FATAL} = 1;
95$handles->{MPI_ERRORS_RETURN} = 2;
96
97$handles->{MPI_MAX} =  1;
98$handles->{MPI_MIN} =  2;
99$handles->{MPI_SUM} =  3;
100$handles->{MPI_PROD} =  4;
101$handles->{MPI_LAND} =  5;
102$handles->{MPI_BAND} =  6;
103$handles->{MPI_LOR} =  7;
104$handles->{MPI_BOR} =  8;
105$handles->{MPI_LXOR} =  9;
106$handles->{MPI_BXOR} = 10;
107$handles->{MPI_MAXLOC} = 11;
108$handles->{MPI_MINLOC} = 12;
109$handles->{MPI_REPLACE} = 13;
110$handles->{MPI_NO_OP} = 14;
111
112$handles->{MPI_COMM_NULL} = 2;
113$handles->{MPI_DATATYPE_NULL} = 0;
114$handles->{MPI_ERRHANDLER_NULL} = 0;
115$handles->{MPI_GROUP_NULL} = 0;
116$handles->{MPI_INFO_NULL} = 0;
117$handles->{MPI_MESSAGE_NULL} = 0;
118$handles->{MPI_OP_NULL} = 0;
119$handles->{MPI_REQUEST_NULL} = 0;
120$handles->{MPI_WIN_NULL} = 0;
121$handles->{MPI_MESSAGE_NULL} = 0;
122
123$handles->{MPI_BYTE} =  1;
124$handles->{MPI_PACKED} =  2;
125$handles->{MPI_UB} =  3;
126$handles->{MPI_LB} =  4;
127$handles->{MPI_CHARACTER} =  5;
128$handles->{MPI_LOGICAL} =  6;
129$handles->{MPI_INTEGER} =  7;
130$handles->{MPI_INTEGER1} =  8;
131$handles->{MPI_INTEGER2} =  9;
132$handles->{MPI_INTEGER4} = 10;
133$handles->{MPI_INTEGER8} = 11;
134$handles->{MPI_INTEGER16} = 12;
135$handles->{MPI_REAL} = 13;
136$handles->{MPI_REAL4} = 14;
137$handles->{MPI_REAL8} = 15;
138$handles->{MPI_REAL16} = 16;
139$handles->{MPI_DOUBLE_PRECISION} = 17;
140$handles->{MPI_COMPLEX} = 18;
141$handles->{MPI_COMPLEX8} = 19;
142$handles->{MPI_COMPLEX16} = 20;
143$handles->{MPI_COMPLEX32} = 21;
144$handles->{MPI_DOUBLE_COMPLEX} = 22;
145$handles->{MPI_2REAL} = 23;
146$handles->{MPI_2DOUBLE_PRECISION} = 24;
147$handles->{MPI_2INTEGER} = 25;
148$handles->{MPI_2COMPLEX} = 26;
149$handles->{MPI_2DOUBLE_COMPLEX} = 27;
150$handles->{MPI_REAL2} = 28;
151$handles->{MPI_LOGICAL1} = 29;
152$handles->{MPI_LOGICAL2} = 30;
153$handles->{MPI_LOGICAL4} = 31;
154$handles->{MPI_LOGICAL8} = 32;
155$handles->{MPI_WCHAR} = 33;
156$handles->{MPI_CHAR} = 34;
157$handles->{MPI_UNSIGNED_CHAR} = 35;
158$handles->{MPI_SIGNED_CHAR} = 36;
159$handles->{MPI_SHORT} = 37;
160$handles->{MPI_UNSIGNED_SHORT} = 38;
161$handles->{MPI_INT} = 39;
162$handles->{MPI_UNSIGNED} = 40;
163$handles->{MPI_LONG} = 41;
164$handles->{MPI_UNSIGNED_LONG} = 42;
165$handles->{MPI_LONG_LONG_INT} = 43;
166$handles->{MPI_LONG_LONG} = $handles->{MPI_LONG_LONG_INT};
167$handles->{MPI_UNSIGNED_LONG_LONG} = 44;
168$handles->{MPI_FLOAT} = 45;
169$handles->{MPI_DOUBLE} = 46;
170$handles->{MPI_LONG_DOUBLE} = 47;
171$handles->{MPI_FLOAT_INT} = 48;
172$handles->{MPI_DOUBLE_INT} = 49;
173$handles->{MPI_LONG_DOUBLE_INT} = 50;
174$handles->{MPI_LONG_INT} = 51;
175$handles->{MPI_2INT} = 52;
176$handles->{MPI_SHORT_INT} = 53;
177$handles->{MPI_CXX_BOOL} = 54;
178$handles->{MPI_CXX_FLOAT_COMPLEX} = 55;
179$handles->{MPI_CXX_COMPLEX} = $handles->{MPI_CXX_FLOAT_COMPLEX};
180$handles->{MPI_CXX_DOUBLE_COMPLEX} = 56;
181$handles->{MPI_CXX_LONG_DOUBLE_COMPLEX} = 57;
182$handles->{MPI_INT8_T} = 58;
183$handles->{MPI_UINT8_T} = 59;
184$handles->{MPI_INT16_T} = 60;
185$handles->{MPI_UINT16_T} = 61;
186$handles->{MPI_INT32_T} = 62;
187$handles->{MPI_UINT32_T} = 63;
188$handles->{MPI_INT64_T} = 64;
189$handles->{MPI_UINT64_T} = 65;
190$handles->{MPI_AINT} = 66;
191$handles->{MPI_OFFSET} = 67;
192$handles->{MPI_C_BOOL} = 68;
193$handles->{MPI_C_COMPLEX} = 69;
194$handles->{MPI_C_FLOAT_COMPLEX} = $handles->{MPI_C_COMPLEX};
195$handles->{MPI_C_DOUBLE_COMPLEX} = 70;
196$handles->{MPI_C_LONG_DOUBLE_COMPLEX} = 71;
197$handles->{MPI_COUNT} = 72;
198
199$handles->{MPI_MESSAGE_NO_PROC} = 1;
200
201$handles->{MPI_INFO_ENV} = 1;
202
203#----------------------------------------------------------------------------
204
205my $io_handles;
206
207$io_handles->{MPI_FILE_NULL} = 0;
208
209#----------------------------------------------------------------------------
210
211my $constants;
212
213$constants->{MPI_VERSION} = 3;
214$constants->{MPI_SUBVERSION} = 1;
215
216$constants->{MPI_ANY_SOURCE} = -1;
217$constants->{MPI_ANY_TAG} = -1;
218$constants->{MPI_PROC_NULL} = -2;
219$constants->{MPI_ROOT} = -4;
220$constants->{MPI_UNDEFINED} = -32766;
221$constants->{MPI_CART} = 1;
222$constants->{MPI_GRAPH} = 2;
223$constants->{MPI_DIST_GRAPH} = 3;
224$constants->{MPI_KEYVAL_INVALID} = -1;
225$constants->{MPI_SOURCE} = 1;
226$constants->{MPI_TAG} = 2;
227$constants->{MPI_ERROR} = 3;
228$constants->{MPI_TAG_UB} = 0;
229$constants->{MPI_HOST} = 1;
230$constants->{MPI_IO} = 2;
231$constants->{MPI_WTIME_IS_GLOBAL} = 3;
232$constants->{MPI_APPNUM} = 4;
233$constants->{MPI_LASTUSEDCODE} = 5;
234$constants->{MPI_UNIVERSE_SIZE} = 6;
235$constants->{MPI_WIN_BASE} = 7;
236$constants->{MPI_WIN_SIZE} = 8;
237$constants->{MPI_WIN_DISP_UNIT} = 9;
238$constants->{MPI_WIN_CREATE_FLAVOR} = 10;
239$constants->{MPI_WIN_MODEL} = 11;
240$constants->{MPI_WIN_FLAVOR_CREATE} = 1;
241$constants->{MPI_WIN_FLAVOR_ALLOCATE} = 2;
242$constants->{MPI_WIN_FLAVOR_DYNAMIC} = 3;
243$constants->{MPI_WIN_FLAVOR_SHARED} = 4;
244$constants->{MPI_WIN_UNIFIED} = 0;
245$constants->{MPI_WIN_SEPARATE} = 1;
246
247$constants->{MPI_BSEND_OVERHEAD} = 128;
248$constants->{MPI_ORDER_C} = 0;
249$constants->{MPI_ORDER_FORTRAN} = 1;
250$constants->{MPI_DISTRIBUTE_BLOCK} = 0;
251$constants->{MPI_DISTRIBUTE_CYCLIC} = 1;
252$constants->{MPI_DISTRIBUTE_NONE} = 2;
253$constants->{MPI_DISTRIBUTE_DFLT_DARG} = -1;
254$constants->{MPI_TYPECLASS_INTEGER} = 1;
255$constants->{MPI_TYPECLASS_REAL} = 2;
256$constants->{MPI_TYPECLASS_COMPLEX} = 3;
257$constants->{MPI_MODE_NOCHECK} = 1;
258$constants->{MPI_MODE_NOPRECEDE} = 2;
259$constants->{MPI_MODE_NOPUT} = 4;
260$constants->{MPI_MODE_NOSTORE} = 8;
261$constants->{MPI_MODE_NOSUCCEED} = 16;
262$constants->{MPI_LOCK_EXCLUSIVE} = 1;
263$constants->{MPI_LOCK_SHARED} = 2;
264
265$constants->{MPI_THREAD_SINGLE} = 0;
266$constants->{MPI_THREAD_FUNNELED} = 1;
267$constants->{MPI_THREAD_SERIALIZED} = 2;
268$constants->{MPI_THREAD_MULTIPLE} = 3;
269
270$constants->{MPI_SUCCESS} = 0;
271$constants->{MPI_ERR_BUFFER} = 1;
272$constants->{MPI_ERR_COUNT} = 2;
273$constants->{MPI_ERR_TYPE} = 3;
274$constants->{MPI_ERR_TAG} = 4;
275$constants->{MPI_ERR_COMM} = 5;
276$constants->{MPI_ERR_RANK} = 6;
277$constants->{MPI_ERR_REQUEST} = 7;
278$constants->{MPI_ERR_ROOT} = 8;
279$constants->{MPI_ERR_GROUP} = 9;
280$constants->{MPI_ERR_OP} = 10;
281$constants->{MPI_ERR_TOPOLOGY} = 11;
282$constants->{MPI_ERR_DIMS} = 12;
283$constants->{MPI_ERR_ARG} = 13;
284$constants->{MPI_ERR_UNKNOWN} = 14;
285$constants->{MPI_ERR_TRUNCATE} = 15;
286$constants->{MPI_ERR_OTHER} = 16;
287$constants->{MPI_ERR_INTERN} = 17;
288$constants->{MPI_ERR_IN_STATUS} = 18;
289$constants->{MPI_ERR_PENDING} = 19;
290$constants->{MPI_ERR_ACCESS} = 20;
291$constants->{MPI_ERR_AMODE} = 21;
292$constants->{MPI_ERR_ASSERT} = 22;
293$constants->{MPI_ERR_BAD_FILE} = 23;
294$constants->{MPI_ERR_BASE} = 24;
295$constants->{MPI_ERR_CONVERSION} = 25;
296$constants->{MPI_ERR_DISP} = 26;
297$constants->{MPI_ERR_DUP_DATAREP} = 27;
298$constants->{MPI_ERR_FILE_EXISTS} = 28;
299$constants->{MPI_ERR_FILE_IN_USE} = 29;
300$constants->{MPI_ERR_FILE} = 30;
301$constants->{MPI_ERR_INFO_KEY} = 31;
302$constants->{MPI_ERR_INFO_NOKEY} = 32;
303$constants->{MPI_ERR_INFO_VALUE} = 33;
304$constants->{MPI_ERR_INFO} = 34;
305$constants->{MPI_ERR_IO} = 35;
306$constants->{MPI_ERR_KEYVAL} = 36;
307$constants->{MPI_ERR_LOCKTYPE} = 37;
308$constants->{MPI_ERR_NAME} = 38;
309$constants->{MPI_ERR_NO_MEM} = 39;
310$constants->{MPI_ERR_NOT_SAME} = 40;
311$constants->{MPI_ERR_NO_SPACE} = 41;
312$constants->{MPI_ERR_NO_SUCH_FILE} = 42;
313$constants->{MPI_ERR_PORT} = 43;
314$constants->{MPI_ERR_QUOTA} = 44;
315$constants->{MPI_ERR_READ_ONLY} = 45;
316$constants->{MPI_ERR_RMA_CONFLICT} = 46;
317$constants->{MPI_ERR_RMA_SYNC} = 47;
318$constants->{MPI_ERR_SERVICE} = 48;
319$constants->{MPI_ERR_SIZE} = 49;
320$constants->{MPI_ERR_SPAWN} = 50;
321$constants->{MPI_ERR_UNSUPPORTED_DATAREP} = 51;
322$constants->{MPI_ERR_UNSUPPORTED_OPERATION} = 52;
323$constants->{MPI_ERR_WIN} = 53;
324# these error codes will never be returned by a fortran function
325# since there are no fortran bindings for MPI_T
326$constants->{MPI_T_ERR_MEMORY} = 54;
327$constants->{MPI_T_ERR_NOT_INITIALIZED} = 55;
328$constants->{MPI_T_ERR_CANNOT_INIT} = 56;
329$constants->{MPI_T_ERR_INVALID_INDEX} = 57;
330$constants->{MPI_T_ERR_INVALID_ITEM} = 58;
331$constants->{MPI_T_ERR_INVALID_HANDLE} = 59;
332$constants->{MPI_T_ERR_OUT_OF_HANDLES} = 60;
333$constants->{MPI_T_ERR_OUT_OF_SESSIONS} = 61;
334$constants->{MPI_T_ERR_INVALID_SESSION} = 62;
335$constants->{MPI_T_ERR_CVAR_SET_NOT_NOW} = 63;
336$constants->{MPI_T_ERR_CVAR_SET_NEVER} = 64;
337$constants->{MPI_T_ERR_PVAR_NO_STARTSTOP} = 65;
338$constants->{MPI_T_ERR_PVAR_NO_WRITE} = 66;
339$constants->{MPI_T_ERR_PVAR_NO_ATOMIC} = 67;
340$constants->{MPI_ERR_RMA_RANGE} = 68;
341$constants->{MPI_ERR_RMA_ATTACH} = 69;
342$constants->{MPI_ERR_RMA_FLAVOR} = 70;
343$constants->{MPI_ERR_RMA_SHARED} = 71;
344$constants->{MPI_T_ERR_INVALID} = 72;
345$constants->{MPI_ERR_LASTCODE} = 92;
346
347$constants->{MPI_IDENT} = 0;
348$constants->{MPI_CONGRUENT} = 1;
349$constants->{MPI_SIMILAR} = 2;
350$constants->{MPI_UNEQUAL} = 3;
351
352$constants->{MPI_COMBINER_NAMED} = 0;
353$constants->{MPI_COMBINER_DUP} = 1;
354$constants->{MPI_COMBINER_CONTIGUOUS} = 2;
355$constants->{MPI_COMBINER_VECTOR} = 3;
356$constants->{MPI_COMBINER_HVECTOR_INTEGER} = 4;
357$constants->{MPI_COMBINER_HVECTOR} = 5;
358$constants->{MPI_COMBINER_INDEXED} = 6;
359$constants->{MPI_COMBINER_HINDEXED_INTEGER} = 7;
360$constants->{MPI_COMBINER_HINDEXED} = 8;
361$constants->{MPI_COMBINER_INDEXED_BLOCK} = 9;
362$constants->{MPI_COMBINER_STRUCT_INTEGER} = 10;
363$constants->{MPI_COMBINER_STRUCT} = 11;
364$constants->{MPI_COMBINER_SUBARRAY} = 12;
365$constants->{MPI_COMBINER_DARRAY} = 13;
366$constants->{MPI_COMBINER_F90_REAL} = 14;
367$constants->{MPI_COMBINER_F90_COMPLEX} = 15;
368$constants->{MPI_COMBINER_F90_INTEGER} = 16;
369$constants->{MPI_COMBINER_RESIZED} = 17;
370$constants->{MPI_COMBINER_HINDEXED_BLOCK} = 18;
371
372$constants->{MPI_COMM_TYPE_SHARED} = 0;
373$constants->{OMPI_COMM_TYPE_HWTHREAD} = 1;
374$constants->{OMPI_COMM_TYPE_CORE} = 2;
375$constants->{OMPI_COMM_TYPE_L1CACHE} = 3;
376$constants->{OMPI_COMM_TYPE_L2CACHE} = 4;
377$constants->{OMPI_COMM_TYPE_L3CACHE} = 5;
378$constants->{OMPI_COMM_TYPE_SOCKET} = 6;
379$constants->{OMPI_COMM_TYPE_NUMA} = 7;
380$constants->{OMPI_COMM_TYPE_NODE} = 0;
381$constants->{OMPI_COMM_TYPE_BOARD} = 8;
382$constants->{OMPI_COMM_TYPE_HOST} = 9;
383$constants->{OMPI_COMM_TYPE_CU} = 10;
384$constants->{OMPI_COMM_TYPE_CLUSTER} = 11;
385
386#----------------------------------------------------------------------------
387
388my $io_constants;
389
390$io_constants->{MPI_SEEK_SET} = 600;
391$io_constants->{MPI_SEEK_CUR} = 602;
392$io_constants->{MPI_SEEK_END} = 604;
393$io_constants->{MPI_MODE_CREATE} = 1;
394$io_constants->{MPI_MODE_RDONLY} = 2;
395$io_constants->{MPI_MODE_WRONLY} = 4;
396$io_constants->{MPI_MODE_RDWR} = 8;
397$io_constants->{MPI_MODE_DELETE_ON_CLOSE} = 16;
398$io_constants->{MPI_MODE_UNIQUE_OPEN} = 32;
399$io_constants->{MPI_MODE_EXCL} = 64;
400$io_constants->{MPI_MODE_APPEND} = 128;
401$io_constants->{MPI_MODE_SEQUENTIAL} = 256;
402
403my $lio_constants;
404$lio_constants->{MPI_DISPLACEMENT_CURRENT} = -54278278;
405
406#----------------------------------------------------------------------------
407
408# Fortran handles file
409
410my $header = '! -*- fortran -*-
411! WARNING! THIS IS A GENERATED FILE!!
412! ANY EDITS YOU PUT HERE WILL BE LOST!
413! ==> Instead, edit topdir/ompi/include/mpif-values.pl.
414
415! Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
416!                         University Research and Technology
417!                         Corporation.  All rights reserved.
418! Copyright (c) 2004-2010 The University of Tennessee and The University
419!                         of Tennessee Research Foundation.  All rights
420!                         reserved.
421! Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
422!                         University of Stuttgart.  All rights reserved.
423! Copyright (c) 2004-2005 The Regents of the University of California.
424!                         All rights reserved.
425! Copyright (c) 2006-2012 Cisco Systems, Inc.  All rights reserved.
426! Copyright (c) 2009      Oak Ridge National Labs.  All rights reserved.
427! Copyright (c) 2016      Research Organization for Information Science
428!                         and Technology (RIST). All rights reserved.
429! $COPYRIGHT$
430!
431! Additional copyrights may follow
432!
433! $HEADER$
434!
435
436';
437
438sub write_fortran_file {
439    my ($header, $vals, $lvals, $file) = @_;
440
441    foreach my $key (sort(keys(%{$vals}))) {
442        $header .= "        integer $key\n";
443    }
444    foreach my $key (sort(keys(%{$lvals}))) {
445        $header .= "        integer(KIND=MPI_OFFSET_KIND) $key\n";
446    }
447    $header .= "\n";
448    foreach my $key (sort(keys(%{$vals}))) {
449        $header .= "        parameter ($key=$vals->{$key})\n";
450    }
451    foreach my $key (sort(keys(%{$lvals}))) {
452        $header .= "        parameter ($key=$lvals->{$key})\n";
453    }
454
455    write_file($file, $header);
456}
457
458write_fortran_file($header, $handles, {},
459                   "$topdir/ompi/include/mpif-handles.h");
460write_fortran_file($header, $constants, {},
461                   "$topdir/ompi/include/mpif-constants.h");
462write_fortran_file($header, $io_handles, {},
463                   "$topdir/ompi/include/mpif-io-handles.h");
464write_fortran_file($header, $io_constants, $lio_constants,
465                   "$topdir/ompi/include/mpif-io-constants.h");
466
467#----------------------------------------------------------------------------
468
469# Create preprocessor files
470
471my $output = '/* WARNING! THIS IS A GENERATED FILE!!
472 * ANY EDITS YOU PUT HERE WILL BE LOST!
473 * Instead, edit topdir/ompi/include/mpif-values.pl
474 */
475
476/*
477 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
478 *                         University Research and Technology
479 *                         Corporation.  All rights reserved.
480 * Copyright (c) 2004-2006 The University of Tennessee and The University
481 *                         of Tennessee Research Foundation.  All rights
482 *                         reserved.
483 * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
484 *                         University of Stuttgart.  All rights reserved.
485 * Copyright (c) 2004-2005 The Regents of the University of California.
486 *                         All rights reserved.
487 * Copyright (c) 2007-2009 Cisco Systems, Inc.  All rights reserved.
488 * Copyright (c) 2008-2009 Sun Microsystems, Inc.  All rights reserved.
489 * Copyright (c) 2009      Oak Ridge National Labs.  All rights reserved.
490 * Copyright (c) 2009-2012 Los Alamos National Security, LLC.
491 *                         All rights reserved.
492 * Copyright (c) 2016      Research Organization for Information Science
493 *                         and Technology (RIST). All rights reserved.
494 * $COPYRIGHT$
495 *
496 * Additional copyrights may follow
497 *
498 * $HEADER$
499 */
500
501#ifndef USE_MPI_F08_CONSTANTS_H
502#define USE_MPI_F08_CONSTANTS_H
503
504';
505
506foreach my $key (sort(keys(%{$constants}))) {
507    $output .= "#define OMPI_$key $constants->{$key}\n";
508}
509$output .= "\n";
510foreach my $key (sort(keys(%{$handles}))) {
511    $output .= "#define OMPI_$key $handles->{$key}\n";
512}
513
514foreach my $key (sort(keys(%{$io_constants}))) {
515    $output .= "#define OMPI_$key $io_constants->{$key}\n";
516}
517foreach my $key (sort(keys(%{$lio_constants}))) {
518    $output .= "#define OMPI_$key $lio_constants->{$key}\n";
519}
520$output .= "\n";
521foreach my $key (sort(keys(%{$io_handles}))) {
522    $output .= "#define OMPI_$key $io_handles->{$key}\n";
523}
524$output .= "\n";
525$output .= "#endif /* USE_MPI_F08_CONSTANTS_H */\n";
526
527write_file("$topdir/ompi/mpi/fortran/use-mpi-f08/constants.h", $output);
528
529exit(0);
530