Skip to content

Commit

Permalink
[Fortran] Use mpi_f08 module to fix Intel compiler warnings (libocca#539
Browse files Browse the repository at this point in the history
)

Intel compiler version 19.1.0.20200306 (and above, presumably) complains:

error #8889: Explicit declaration of the EXTERNAL attribute is required

This can be solved by using the newer mpi_f08 module and accompanying
newer datatypes.
  • Loading branch information
Stefan Frijters authored Nov 24, 2021
1 parent 88e30e0 commit b07ec0b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions examples/fortran/10_mpi/main.f90
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
program main
use mpi
use mpi_f08
use occa
use, intrinsic :: iso_fortran_env, only : stdout=>output_unit, &
stderr=>error_unit

implicit none

integer :: ierr, id
integer :: myid, npes, gcomm, tag ! MPI variables
integer, dimension(2) :: request
integer, dimension(MPI_STATUS_SIZE) :: status
integer :: myid, npes, tag ! MPI variables
type(MPI_Comm) :: gcomm
type(MPI_Request), dimension(2) :: request
type(MPI_Status) :: status
integer :: otherID, offset
integer(occaUDim_t) :: iu
integer(occaUDim_t) :: entries = 8
Expand Down Expand Up @@ -97,15 +98,15 @@ program main
request = MPI_REQUEST_NULL
call MPI_IRecv(ab_ptr(otherID*offset+1), &
offset, &
MPI_FLOAT, &
MPI_REAL4, &
otherID, &
tag, &
gcomm, &
request(1), &
ierr)
call MPI_ISend(ab_ptr(myid*offset+1), &
offset, &
MPI_FLOAT, &
MPI_REAL4, &
otherID, &
tag, &
gcomm, &
Expand All @@ -121,7 +122,7 @@ program main
call flush(stdout)
ab_sum = myid
ab_gather = sum(ab_ptr)
call MPI_Gather(ab_gather, 1, MPI_FLOAT, ab_sum, 1, MPI_FLOAT, 0, gcomm, ierr)
call MPI_Gather(ab_gather, 1, MPI_REAL4, ab_sum, 1, MPI_REAL4, 0, gcomm, ierr)
if (myid == 0) then
if (abs(ab_sum(myid) - ab_sum(otherID)) > 1.0e-8) stop "*** Wrong result ***"
end if
Expand Down

0 comments on commit b07ec0b

Please sign in to comment.