0
$\begingroup$

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
subroutine readParameters(MPI_COMMUNICATOR, PROC_RANK_LOCAL, NUM_PROCESSES)
implicit none
integer, intent(in) :: MPI_COMMUNICATOR, PROC_RANK_LOCAL, NUM_PROCESSES
integer :: ierr
    if(PROC_RANK_LOCAL == 0) then
    ! Read variables 
    end if
    call MPI_Bcast(UD_INITIAL,1, MPI_DOUBLE_PRECISION,0, MPI_COMMUNICATOR, ierr)
end subroutine ReadParameters    
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.

Thank you for your help.

$\endgroup$
  • $\begingroup$ Can you guarantee that every process in this communicator called this subroutine? $\endgroup$ – Bill Barth Jun 25 '14 at 22:52
  • $\begingroup$ 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. $\endgroup$ – Salim Jun 25 '14 at 23:51
  • $\begingroup$ Sorry, I meant, did every process call readParameters? $\endgroup$ – Bill Barth Jun 26 '14 at 1:52
  • $\begingroup$ Yes. since they all display the print statement I just mentioned that I put in immediately before the end of the subroutine. $\endgroup$ – Salim Jun 26 '14 at 2:03
  • 1
    $\begingroup$ If you make a program that contains nothing but this module and a main program that calls its subroutine, does it work? $\endgroup$ – Bill Barth Jun 26 '14 at 2:10
0
$\begingroup$

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.

Thanks for the help.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.