Skip to content

Commit

Permalink
Fix #3183
Browse files Browse the repository at this point in the history
The constant MPI_MAX_PROCESSOR_NAME is only defined if mpi headers are
included, so it *must* be used only inside blocks guarded by `#ifdef _MPI`

Also, removing redundant inclusion of mpif.h.
  • Loading branch information
bartgol authored and dqwu committed Sep 18, 2019
1 parent c45c15b commit 7150717
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions components/homme/src/share/parallel_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ subroutine init_par(par,npes_in,npes_stride)
type(parallel_t), intent(out) :: par

#ifdef _MPI
#include <mpif.h>

integer(kind=int_kind) :: ierr
logical :: running ! state of MPI at beginning of initmp call
#ifdef CAM
Expand Down Expand Up @@ -182,15 +180,14 @@ end subroutine init_par

subroutine initmp_from_par(par)
type (parallel_t),intent(in):: par
#ifdef _MPI
character(len=MPI_MAX_PROCESSOR_NAME) :: my_name
character(len=MPI_MAX_PROCESSOR_NAME), allocatable :: the_names(:)
integer(kind=int_kind),allocatable :: tarray(:)
integer(kind=int_kind) :: namelen,i
integer(kind=int_kind) :: ierr,tmp_min,tmp_max
integer :: node_color

#ifdef _MPI
#include <mpif.h>
if (MPI_DOUBLE_PRECISION==20 .and. MPI_REAL8==18) then
! LAM MPI defined MPI_REAL8 differently from MPI_DOUBLE_PRECISION
! and LAM MPI's allreduce does not accept on MPI_REAL8
Expand Down Expand Up @@ -354,7 +351,6 @@ subroutine syncmp(par)
type (parallel_t) par

#ifdef _MPI
#include <mpif.h>
integer :: errorcode,errorlen,ierr
character(len=MPI_MAX_ERROR_STRING) :: errorstring

Expand All @@ -379,7 +375,6 @@ subroutine syncmp_comm(comm)
integer :: comm

#ifdef _MPI
#include <mpif.h>
integer :: errorcode,errorlen,ierr
character(len=MPI_MAX_ERROR_STRING) :: errorstring

Expand Down

0 comments on commit 7150717

Please sign in to comment.