<div dir="ltr">Hi Praveen,<div><br></div><div>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.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-03-07 15:53 GMT+01:00 Praveen C <span dir="ltr"><<a href="mailto:cpraveen@gmail.com" target="_blank">cpraveen@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear all<div><br></div><div>In a code like this</div><div><br></div><div>







<p class="m_3289996205668537272gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">subroutine</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures"> checkgrid(g)</span></p>
<p class="m_3289996205668537272gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(195,55,32);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">#include </span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures"><petsc/finclude/petscsys.h></span></p>
<p class="m_3289996205668537272gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">   </span><span class="m_3289996205668537272gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">use</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures"> petscsys</span></p>
<p class="m_3289996205668537272gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">   </span><span class="m_3289996205668537272gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">use</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures"> mgrid</span></p>
<p class="m_3289996205668537272gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">   </span><span class="m_3289996205668537272gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">use</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures"> celldata</span></p>
<p class="m_3289996205668537272gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">   </span><span class="m_3289996205668537272gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">use</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures"> comdata</span></p>
<p class="m_3289996205668537272gmail-p3" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,188,38);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">   </span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">implicit</span><span class="m_3289996205668537272gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">none</span></p>
<p class="m_3289996205668537272gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">   </span><span class="m_3289996205668537272gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">type</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">(grid),</span><span class="m_3289996205668537272gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">intent</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">(</span><span class="m_3289996205668537272gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">in</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">) :: g</span></p>
<p class="m_3289996205668537272gmail-p4" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(82,48,225);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">   </span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">! Local variables</span></p>
<p class="m_3289996205668537272gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">   </span><span class="m_3289996205668537272gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">integer</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures"><span class="m_3289996205668537272gmail-Apple-converted-space">        </span>:: i, j, v, tc, nv</span></p>
<p class="m_3289996205668537272gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">   </span><span class="m_3289996205668537272gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(51,187,200)">PetscInt</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures"> <span class="m_3289996205668537272gmail-Apple-converted-space">      </span>:: v1, v2</span></p>
<p class="m_3289996205668537272gmail-p5" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(51,187,200);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">   </span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">PetscErrorCode</span><span class="m_3289996205668537272gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> :: ierr</span></p><p class="m_3289996205668537272gmail-p5" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(51,187,200);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"><br></span></p><p class="m_3289996205668537272gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(82,48,225);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"><span class="m_3289996205668537272gmail-Apple-converted-space">   </span></span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">! Sum g%nvl over all partitions.</span></p><p class="m_3289996205668537272gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures"><span class="m_3289996205668537272gmail-Apple-converted-space">   </span></span><span class="m_3289996205668537272gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(51,187,200)">Call</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures"> MPI_</span><span class="m_3289996205668537272gmail-s4" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">Allre</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">duce(g%nvl, nv, </span><span class="m_3289996205668537272gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">1</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures">, MPI_INT, MPI_SUM, </span><span class="m_3289996205668537272gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">&</span></p><p class="m_3289996205668537272gmail-p5" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(51,187,200);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">









</span></p><p class="m_3289996205668537272gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures"><span class="m_3289996205668537272gmail-Apple-converted-space">                      </span>PETSC_COMM_WORLD, ierr); CHKERRQ(ierr)</span></p></div><div>







<p class="m_3289996205668537272gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(213,59,211);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s1" style="font-variant-ligatures:no-common-ligatures">end subroutine</span><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> checkgrid</span></p><p class="m_3289996205668537272gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(213,59,211);background-color:rgb(255,255,255)"><span class="m_3289996205668537272gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"><br></span></p></div><div>we get an error while compiling with mpich-3.2.1 + ifort + petsc-3.8.x</div><div><br></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px">mpifort -c -O3 -fpp -nogen-interface -W1 -WB -DNS -DVERSION=\"f8e6c025\" -I/usr/local/share/<wbr>applications/Intel_Compiler/<wbr>petsc/include -I/usr/local/share/<wbr>applications/Intel_Compiler/<wbr>hdf5/include -DHDF5 -Tf checkgrid.F90 -o checkgrid.o -free</span><br></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px">checkgrid.F90(40): error #6405: The same named entity from different modules and/or program units cannot be referenced.   [MPI_SUM]</span><br style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px">   Call MPI_Allreduce(g%nvl, nv, 1, MPI_INT, MPI_SUM, &</span><br style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px">                      ------------------------------<wbr>---------------^</span><br></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span>compilation aborted for checkgrid.F90 (code 1)</span><br></span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span><br></span></span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span>It works fine with clang and gnu compilers.</span></span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span><br></span></span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span>Thanks</span></span></div><span class="HOEnZb"><font color="#888888"><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span>praveen</span></span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span><br></span></span></div></font></span></div>
</blockquote></div><br></div>