Start with one use statement and slowly add more. My guess is multiple ones 
of those modules use the MPI module hence MPI_SUM appears through multiple 
paths.

   Barry


> On Mar 7, 2018, at 8:53 AM, Praveen C <cprav...@gmail.com> wrote:
> 
> Dear all
> 
> In a code like this
> 
> subroutine checkgrid(g)
> #include <petsc/finclude/petscsys.h>
>    use petscsys
>    use mgrid
>    use celldata
>    use comdata
>    implicit none
>    type(grid),intent(in) :: g
>    ! Local variables
>    integer        :: i, j, v, tc, nv
>    PetscInt       :: v1, v2
>    PetscErrorCode :: ierr
> 
>    ! Sum g%nvl over all partitions.
>    Call MPI_Allreduce(g%nvl, nv, 1, MPI_INT, MPI_SUM, &
>                       PETSC_COMM_WORLD, ierr); CHKERRQ(ierr)
> end subroutine checkgrid
> 
> we get an error while compiling with mpich-3.2.1 + ifort + petsc-3.8.x
> 
> mpifort -c -O3 -fpp -nogen-interface -W1 -WB -DNS -DVERSION=\"f8e6c025\" 
> -I/usr/local/share/applications/Intel_Compiler/petsc/include 
> -I/usr/local/share/applications/Intel_Compiler/hdf5/include -DHDF5 -Tf 
> checkgrid.F90 -o checkgrid.o -free
> checkgrid.F90(40): error #6405: The same named entity from different modules 
> and/or program units cannot be referenced.   [MPI_SUM]
>    Call MPI_Allreduce(g%nvl, nv, 1, MPI_INT, MPI_SUM, &
>                       ---------------------------------------------^
> compilation aborted for checkgrid.F90 (code 1)
> 
> It works fine with clang and gnu compilers.
> 
> Thanks
> praveen
> 

Reply via email to