<div dir="ltr">Dear all<div><br></div><div>In a code like this</div><div><br></div><div>
<p class="gmail-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="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">subroutine</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> checkgrid(g)</span></p>
<p class="gmail-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="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">#include </span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures"><petsc/finclude/petscsys.h></span></p>
<p class="gmail-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="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> </span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">use</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> petscsys</span></p>
<p class="gmail-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="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> </span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">use</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> mgrid</span></p>
<p class="gmail-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="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> </span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">use</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> celldata</span></p>
<p class="gmail-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="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> </span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">use</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> comdata</span></p>
<p class="gmail-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="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">implicit</span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">none</span></p>
<p class="gmail-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="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> </span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">type</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">(grid),</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">intent</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">(</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">in</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">) :: g</span></p>
<p class="gmail-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="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">! Local variables</span></p>
<p class="gmail-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="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> </span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">integer</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>:: i, j, v, tc, nv</span></p>
<p class="gmail-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="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> </span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(51,187,200)">PetscInt</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> <span class="gmail-Apple-converted-space"> </span>:: v1, v2</span></p>
<p class="gmail-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="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">PetscErrorCode</span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> :: ierr</span></p><p class="gmail-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="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"><br></span></p><p class="gmail-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="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"><span class="gmail-Apple-converted-space"> </span></span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">! Sum g%nvl over all partitions.</span></p><p class="gmail-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="gmail-s2" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span></span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(51,187,200)">Call</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures"> MPI_</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">Allre</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">duce(g%nvl, nv, </span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">1</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">, MPI_INT, MPI_SUM, </span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">&</span></p><p class="gmail-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="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">
</span></p><p class="gmail-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="gmail-s2" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>PETSC_COMM_WORLD, ierr); CHKERRQ(ierr)</span></p></div><div>
<p class="gmail-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="gmail-s1" style="font-variant-ligatures:no-common-ligatures">end subroutine</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> checkgrid</span></p><p class="gmail-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="gmail-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/applications/Intel_Compiler/petsc/include -I/usr/local/share/applications/Intel_Compiler/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"> ---------------------------------------------^</span><br></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span style="text-size-adjust: auto;">compilation aborted for checkgrid.F90 (code 1)</span><br style="text-size-adjust: auto;"></span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span style="text-size-adjust: auto;"><br></span></span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span style="text-size-adjust: auto;">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 style="text-size-adjust: auto;"><br></span></span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span style="text-size-adjust: auto;">Thanks</span></span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span style="text-size-adjust: auto;">praveen</span></span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13px"><span style="text-size-adjust: auto;"><br></span></span></div></div>