Skip to content

Commit 7107511

Browse files
committed
use-mpi-f08: Wtick/Wtime + sentinel updates
Two changes that are related to each other: 1. Since Wtick/Wtime are simple interfaces (not wrappers) to the back-end C MPI_Wtick/MPI_Wtime functions, just declare them as bind(C) in the mpi module and then have the mpi_f08 module use just those 2 symbols in the mpi_f08 module (ditto for the PMPI versions). 2. Similar for the special "sentinel" values (e.g., MPI_BOTTOM). No longer generate them via gen-mpi-mangling.pl; just BIND(C) them in the mpi module and then "use" them in the mpi_f08 module. Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
1 parent 9f8b450 commit 7107511

File tree

6 files changed

+8
-68
lines changed

6 files changed

+8
-68
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ ompi/include/mpif-c-constants.h
190190
ompi/include/mpif-common.h
191191
ompi/include/mpi-ext.h
192192
ompi/include/mpif-ext.h
193-
ompi/include/mpif-f08-types.h
194193
ompi/include/mpif-handles.h
195194
ompi/include/mpif-io-constants.h
196195
ompi/include/mpif-constants.h

ompi/mpi/fortran/base/gen-mpi-mangling.pl

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -159,30 +159,7 @@ sub gen_c_constants {
159159
close (OUT);
160160
}
161161

162-
sub gen_f08_types {
163-
open(OUT, ">$file_f08_types") ||
164-
die "Can't write to $file_f08_types";
165-
166-
print OUT "! WARNING: This is a generated file! Edits will be lost! */
167-
!
168-
! Copyright (c) 2015 Research Organization for Information Science
169-
! and Technology (RIST). All rights reserved.
170-
! Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
171-
! \$COPYRIGHT\$
172-
!
173-
! This file was generated by gen-mpi-mangling.pl
174-
!\n\n";
175-
176-
foreach my $key (sort(keys(%{$fortran}))) {
177-
my $f = $fortran->{$key};
178-
print OUT "$f->{f_type}, bind(C, name=\"".mangle($f->{c_name})."\") :: $f->{f_name}\n";
179-
}
180-
181-
close (OUT);
182-
}
183-
184162
gen_c_constants_decl();
185163
gen_c_constants();
186-
gen_f08_types();
187164

188165
exit(0);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ if OMPI_BUILD_FORTRAN_USEMPI_OR_USEMPIF08_EXT
2929
AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \
3030
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/base \
3131
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi \
32+
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \
3233
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mod \
3334
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08 \
3435
-I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90)

ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.F90

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,8 @@
2121

2222
module mpi_f08_interfaces
2323

24-
#include "mpi-f08-interfaces.h"
25-
26-
! MPI_Wtick is not a wrapper function
27-
!
28-
interface MPI_Wtick
29-
function MPI_Wtick_f08( ) BIND(C,name="MPI_Wtick")
30-
use, intrinsic :: ISO_C_BINDING
31-
implicit none
32-
DOUBLE PRECISION :: MPI_Wtick_f08
33-
end function MPI_Wtick_f08
34-
end interface MPI_Wtick
24+
use :: mpi, only : MPI_Wtick, MPI_Wtime
3525

36-
! MPI_Wtime is not a wrapper function
37-
!
38-
interface MPI_Wtime
39-
function MPI_Wtime_f08( ) BIND(C,name="MPI_Wtime")
40-
use, intrinsic :: ISO_C_BINDING
41-
implicit none
42-
DOUBLE PRECISION :: MPI_Wtime_f08
43-
end function MPI_Wtime_f08
44-
end interface MPI_Wtime
26+
#include "mpi-f08-interfaces.h"
4527

4628
end module mpi_f08_interfaces

ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-types.F90

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ module mpi_f08_types
2828
use, intrinsic :: ISO_C_BINDING
2929
use mpi_types
3030

31+
! Use the same constants that are BIND(C)'ed in the mpi module
32+
use :: mpi, only : MPI_ARGV_NULL, MPI_ARGVS_NULL, MPI_BOTTOM, MPI_ERRCODES_IGNORE, MPI_IN_PLACE, MPI_STATUS_IGNORE, MPI_STATUS_IGNORE, MPI_STATUSES_IGNORE, MPI_UNWEIGHTED, MPI_WEIGHTS_EMPTY
33+
3134
include "mpif-config.h"
3235
include "mpif-constants.h"
3336
include "mpif-io-constants.h"
@@ -163,8 +166,4 @@ module mpi_f08_types
163166
type(MPI_Datatype), parameter :: MPI_OFFSET = MPI_Datatype(OMPI_MPI_OFFSET)
164167
type(MPI_Datatype), parameter :: MPI_COMPLEX4 = MPI_Datatype(OMPI_MPI_COMPLEX4)
165168

166-
!... Special sentinel constants
167-
!------------------------------
168-
#include "mpif-f08-types.h"
169-
170169
end module mpi_f08_types

ompi/mpi/fortran/use-mpi-f08/mod/pmpi-f08-interfaces.F90

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,8 @@
2525

2626
module pmpi_f08_interfaces
2727

28-
#include "mpi-f08-interfaces.h"
29-
30-
! MPI_Wtick is not a wrapper function
31-
!
32-
interface PMPI_Wtick
33-
function PMPI_Wtick_f08( ) BIND(C,name="PMPI_Wtick")
34-
use, intrinsic :: ISO_C_BINDING
35-
implicit none
36-
DOUBLE PRECISION :: PMPI_Wtick_f08
37-
end function PMPI_Wtick_f08
38-
end interface PMPI_Wtick
28+
use :: mpi, only : PMPI_Wtick, PMPI_Wtime
3929

40-
! MPI_Wtime is not a wrapper function
41-
!
42-
interface PMPI_Wtime
43-
function PMPI_Wtime_f08( ) BIND(C,name="PMPI_Wtime")
44-
use, intrinsic :: ISO_C_BINDING
45-
implicit none
46-
DOUBLE PRECISION :: PMPI_Wtime_f08
47-
end function PMPI_Wtime_f08
48-
end interface PMPI_Wtime
30+
#include "mpi-f08-interfaces.h"
4931

5032
end module pmpi_f08_interfaces

0 commit comments

Comments
 (0)