Skip to content

Commit b10a60a

Browse files
committed
fortran/use-mpi-f08: revamp constant declarations
In order to work around an issue with flang based compilers, avoid declaring bind(C) constants and use plain Fortran parameter instead. For example, type(MPI_Comm), bind(C, name="ompi_f08_mpi_comm_world") OMPI_PROTECTED :: MPI_COMM_WORLD is changed to type(MPI_Comm), parameter :: MPI_COMM_WORLD = MPI_Comm(OMPI_MPI_COMM_WORLD) Note that in order to preserve ABI compatibility, ompi/mpi/fortran/use-mpi-f08/constants.{c,h} have been kept even if its symbols are no more referenced by Open MPI. Refs. #7091 Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent aa8be9c commit b10a60a

File tree

5 files changed

+179
-116
lines changed

5 files changed

+179
-116
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ ompi/mpi/fortran/mpif-h/sizeof_f.f90
213213
ompi/mpi/fortran/mpif-h/profile/p*.c
214214
ompi/mpi/fortran/mpif-h/profile/psizeof_f.f90
215215

216+
ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-constants.h
216217
ompi/mpi/fortran/use-mpi-f08/constants.h
217218
ompi/mpi/fortran/use-mpi-f08/sizeof_f08.f90
218219
ompi/mpi/fortran/use-mpi-f08/sizeof_f08.h

ompi/include/mpif-values.pl

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env perl
22
#
33
# 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.
4+
# Copyright (c) 2016-2019 Research Organization for Information Science
5+
# and Technology (RIST). All rights reserved.
66
# Copyright (c) 2016-2018 FUJITSU LIMITED. All rights reserved.
77
# $COPYRIGHT$
88
#
@@ -527,4 +527,62 @@ sub write_fortran_file {
527527

528528
write_file("$topdir/ompi/mpi/fortran/use-mpi-f08/constants.h", $output);
529529

530+
$output = '! WARNING! THIS IS A GENERATED FILE!!
531+
! ANY EDITS YOU PUT HERE WILL BE LOST!
532+
! Instead, edit topdir/ompi/include/mpif-values.pl
533+
!
534+
535+
!
536+
! Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
537+
! University Research and Technology
538+
! Corporation. All rights reserved.
539+
! Copyright (c) 2004-2006 The University of Tennessee and The University
540+
! of Tennessee Research Foundation. All rights
541+
! reserved.
542+
! Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
543+
! University of Stuttgart. All rights reserved.
544+
! Copyright (c) 2004-2005 The Regents of the University of California.
545+
! All rights reserved.
546+
! Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
547+
! Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
548+
! Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
549+
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
550+
! All rights reserved.
551+
! Copyright (c) 2016-2019 Research Organization for Information Science
552+
! and Technology (RIST). All rights reserved.
553+
! $COPYRIGHT$
554+
!
555+
! Additional copyrights may follow
556+
!
557+
! $HEADER$
558+
!
559+
560+
#ifndef USE_MPI_F08_CONSTANTS_H
561+
#define USE_MPI_F08_CONSTANTS_H
562+
563+
';
564+
565+
foreach my $key (sort(keys(%{$constants}))) {
566+
$output .= "#define OMPI_$key $constants->{$key}\n";
567+
}
568+
$output .= "\n";
569+
foreach my $key (sort(keys(%{$handles}))) {
570+
$output .= "#define OMPI_$key $handles->{$key}\n";
571+
}
572+
573+
foreach my $key (sort(keys(%{$io_constants}))) {
574+
$output .= "#define OMPI_$key $io_constants->{$key}\n";
575+
}
576+
foreach my $key (sort(keys(%{$lio_constants}))) {
577+
$output .= "#define OMPI_$key $lio_constants->{$key}\n";
578+
}
579+
$output .= "\n";
580+
foreach my $key (sort(keys(%{$io_handles}))) {
581+
$output .= "#define OMPI_$key $io_handles->{$key}\n";
582+
}
583+
$output .= "\n";
584+
$output .= "#endif\n";
585+
586+
write_file("$topdir/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-constants.h", $output);
587+
530588
exit(0);

ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ noinst_LTLIBRARIES = libusempif08_internal_modules.la libforce_usempif08_interna
4343

4444
libusempif08_internal_modules_la_SOURCES = \
4545
mpi-f08-types.F90 \
46-
mpi-f08-callbacks.F90
46+
mpi-f08-callbacks.F90 \
47+
mpi-f08-constants.h
4748

4849
libforce_usempif08_internal_modules_to_be_built_la_SOURCES = \
4950
mpi-f08-interfaces.F90 \

0 commit comments

Comments
 (0)