Re: [petsc-users] error with MPI + ifort

2018-03-07 Thread Satish Balay
One gets such a error message if mpif.h is used in multiple modules.

mpi.mod [if used] is one module that will have this symbol. And if
there is a user module [or petsc module] also using mpif.h - then it
will get a duplicate copy of these symbols - and will result in such a
conflict.

Satish


On Wed, 7 Mar 2018, Smith, Barry F. wrote:

> 
>You have multiple 
> 
> use 
> 
> make sure they don't have multiple paths back to MPI. For example if two 
> of them have use petscsys etc
> 
>Barry
> 
> 
> > On Mar 7, 2018, at 10:11 AM, Praveen C  wrote:
> > 
> > 
> > 
> >> On 07-Mar-2018, at 9:34 PM, Smith, Barry F.  wrote:
> >> 
> >>   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
> > 
> > Hello Barry
> > 
> > If you mean use of “use mpi”, then I have dont have this anywhere in my 
> > code. I only include petsc includes and modules.
> > 
> > Thanks
> > praveen
> 
> 


Re: [petsc-users] error with MPI + ifort

2018-03-07 Thread Praveen C


> On 07-Mar-2018, at 9:52 PM, Smith, Barry F.  wrote:
> 
>   You have multiple 
> 
>use 
> 
>make sure they don't have multiple paths back to MPI. For example if two 
> of them have use petscsys etc
> 
>   Barry

None of the other modules I include have “use petscsys” inside them.

Thanks
praveen

Re: [petsc-users] error with MPI + ifort

2018-03-07 Thread Smith, Barry F.

   You have multiple 

use 

make sure they don't have multiple paths back to MPI. For example if two of 
them have use petscsys etc

   Barry


> On Mar 7, 2018, at 10:11 AM, Praveen C  wrote:
> 
> 
> 
>> On 07-Mar-2018, at 9:34 PM, Smith, Barry F.  wrote:
>> 
>>   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
> 
> Hello Barry
> 
> If you mean use of “use mpi”, then I have dont have this anywhere in my code. 
> I only include petsc includes and modules.
> 
> Thanks
> praveen



Re: [petsc-users] error with MPI + ifort

2018-03-07 Thread Smith, Barry F.

   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  wrote:
> 
> Dear all
> 
> In a code like this
> 
> subroutine checkgrid(g)
> #include 
>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
> 



Re: [petsc-users] error with MPI + ifort

2018-03-07 Thread Adrián Amor
Hi Praveen,

did you try to include the PETSC_AVOID_MPIF_H? I mean, include:
-DPETSC_AVOID_MPIF_H=1 when using mpiifort and I think that the problem
will be solved.

2018-03-07 15:53 GMT+01:00 Praveen C :

> Dear all
>
> In a code like this
>
> subroutine checkgrid(g)
>
> #include 
>
>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
>
>