<div dir="ltr">Hi,<div><br></div><div>Thank you! Yes it is 3.7</div><div> Indeed I found that there was a 'use mpi'  somewhere in the tree of modules called. I could break the module apart without great difficulty, so that I don't call mpi anymore in the affected portion of the code. It looks like it indeed fixes the issue. But it's also nice to give me the other solution with PETSC_AVOID_MPIF_H, which could have been very useful if I hadn't been able to easily break the module apart.</div><div><br></div><div>Cheers</div><div><br></div><div>Timothee</div><div> </div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-01-31 17:21 GMT+01:00 Satish Balay <span dir="ltr"><<a href="mailto:balay@mcs.anl.gov" target="_blank">balay@mcs.anl.gov</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is petsc-3.7?<br>
<br>
Looks like mpif.h is getting included in some module that your code<br>
is currently using.<br>
<br>
Is this module your code - or petsc code?<br>
<br>
Is using mpi via module [perhaps mpi.mod is preferable over mpif.h] -<br>
then you can do something like:<br>
<br>
#define PETSC_AVOID_MPIF_H<br>
#include <petsc/finclude/petsc.h90><br>
<span class="HOEnZb"><font color="#888888"><br>
Satish<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Tue, 31 Jan 2017, Timothée Nicolas wrote:<br>
<br>
> Dear all,<br>
><br>
> I am a bit confused as to how to link PETSc correctly in a code that<br>
> already uses MPI natively. I wish to define a DMDA for my problem, but when<br>
> I try to include petsc.h90, the compiler complains that MPI_XXXXX variables<br>
> are already defined:<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(9): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_SOURCE]<br>
><br>
>        INTEGER MPI_SOURCE, MPI_TAG, MPI_ERROR<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(9): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_TAG]<br>
><br>
>        INTEGER MPI_SOURCE, MPI_TAG, MPI_ERROR<br>
><br>
> ---------------------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(9): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERROR]<br>
><br>
>        INTEGER MPI_SOURCE, MPI_TAG, MPI_ERROR<br>
><br>
> ------------------------------<wbr>------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(11): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_STATUS_SIZE]<br>
><br>
>        INTEGER MPI_STATUS_SIZE<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(13): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_STATUS_IGNORE]<br>
><br>
>        INTEGER MPI_STATUS_IGNORE(MPI_STATUS_<wbr>SIZE)<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(14): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_STATUSES_IGNORE]<br>
><br>
>        INTEGER MPI_STATUSES_IGNORE(MPI_<wbr>STATUS_SIZE,1)<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(15): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERRCODES_IGNORE]<br>
><br>
>        INTEGER MPI_ERRCODES_IGNORE(1)<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(16): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ARGVS_NULL]<br>
><br>
>        CHARACTER*1 MPI_ARGVS_NULL(1,1)<br>
><br>
> -------------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(17): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ARGV_NULL]<br>
><br>
>        CHARACTER*1 MPI_ARGV_NULL(1)<br>
><br>
> -------------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(18): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_SUCCESS]<br>
><br>
>        INTEGER MPI_SUCCESS<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(20): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_SIZE]<br>
><br>
>        INTEGER MPI_ERR_SIZE<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(22): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_INFO_KEY]<br>
><br>
>        INTEGER MPI_ERR_INFO_KEY<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(24): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_FILE]<br>
><br>
>        INTEGER MPI_ERR_FILE<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(26): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_AMODE]<br>
><br>
>        INTEGER MPI_ERR_AMODE<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(28): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_TRUNCATE]<br>
><br>
>        INTEGER MPI_ERR_TRUNCATE<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(30): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_BASE]<br>
><br>
>        INTEGER MPI_ERR_BASE<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(32): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_OP]<br>
><br>
>        INTEGER MPI_ERR_OP<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(34): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_ASSERT]<br>
><br>
>        INTEGER MPI_ERR_ASSERT<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(36): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_NAME]<br>
><br>
>        INTEGER MPI_ERR_NAME<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(38): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_NO_MEM]<br>
><br>
>        INTEGER MPI_ERR_NO_MEM<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(40): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_INFO]<br>
><br>
>        INTEGER MPI_ERR_INFO<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(42): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_COUNT]<br>
><br>
>        INTEGER MPI_ERR_COUNT<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(44): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_SPAWN]<br>
><br>
>        INTEGER MPI_ERR_SPAWN<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(46): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_CONVERSION]<br>
><br>
>        INTEGER MPI_ERR_CONVERSION<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(48): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_GROUP]<br>
><br>
>        INTEGER MPI_ERR_GROUP<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(50): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_RMA_SYNC]<br>
><br>
>        INTEGER MPI_ERR_RMA_SYNC<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(52): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_NOT_SAME]<br>
><br>
>        INTEGER MPI_ERR_NOT_SAME<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(54): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_KEYVAL]<br>
><br>
>        INTEGER MPI_ERR_KEYVAL<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(56): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_ACCESS]<br>
><br>
>        INTEGER MPI_ERR_ACCESS<br>
><br>
> ---------------^<br>
><br>
> /cm/shared/apps/mpich/ge/<wbr>intel/3.2/include/mpif.h(58): error #6401: The<br>
> attributes of this name conflict with those made accessible by a USE<br>
> statement.   [MPI_ERR_DIMS]<br>
><br>
>        INTEGER MPI_ERR_DIMS<br>
><br>
> ---------------^<br>
><br>
> I usually write everything consistently within PETSc, but for the first<br>
> time, I have to use some PETSc routines in a code that is mostly standard<br>
> FORTRAN 90.<br>
><br>
> Is including PETSc via #include <petsc/finclude/petscdef.h> the wrong<br>
> method?<br>
><br>
> Best<br>
><br>
> Timothee<br>
><br>
</div></div></blockquote></div><br></div>