# MPI_ERR_TRUNCATE appears for no understandable reason

I am developing some parallel CFD code using Fortran 90 and OpenMPI. The processes are structured into two groups such that half perform a certain type of calculations (let's say Velocity, Pressure and Temperature) while the other half performs a different type of calculations (let's say Turbulence modelling using K-omega). As a result the program splits itself arbitrarily into two communicators, let's call them Comm1 and Comm2.

I'm trying to use Process of local rank 0 in Comm 1 to read some parameters from Namelist files and Broadcast them to all processes in Comm1. For some reason, even though it is just a scalar, I get MPI_ERR_TRUNCATE: message truncated as an error message. I'm wondering if anybody's experienced anything similar.

Code is below.

module myModule
use mpi
double precision, public :: KOMEGA_CMU, KOMEGA_ELOG, KOMEGA_CTRANS, TED_INITIAL, UD_INITIAL
! Other Variable declarations
! ...
contains
implicit none
integer, intent(in) :: MPI_COMMUNICATOR, PROC_RANK_LOCAL, NUM_PROCESSES
integer :: ierr
if(PROC_RANK_LOCAL == 0) then
end if
call MPI_Bcast(UD_INITIAL,1, MPI_DOUBLE_PRECISION,0, MPI_COMMUNICATOR, ierr)
end module MyModule


this for some reason results in MPI_ERR_TRUNCATE in all processes but the root process (Rank 0), even though the variable is declared for double precision and message buffer is for double precision as well. This happens with integers too.

• Yes, I did that by enabling the error handler MPI_RETURN_ERRORS and printing out the value of the variable right after call MPI_Bcast(). The root process displays the value of UD_INITIAL read from file while the other processes show 0. – Salim Jun 25 '14 at 23:51
• Sorry, I meant, did every process call readParameters? – Bill Barth Jun 26 '14 at 1:52
It turns out the problem came from a previously called subroutine by the subgroup of processes whose last MPI statement accidentally broadcast an $M \times N$ ($M\neq 0, N\neq 0$) array with zero count on the message envelope. It looks like the buffer overflew as a result to subsequent MPI collective operations within the subgroup communicator. As soon as I caught that mistake everything seemed to work fine.