<div dir="ltr">Dear all,<div><br></div><div>I am a bit confused as to how to link PETSc correctly in a code that already uses MPI natively. I wish to define a DMDA for my problem, but when I try to include petsc.h90, the compiler complains that MPI_XXXXX variables are already defined:</div><div><br></div><div><p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(9): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_SOURCE]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_SOURCE, MPI_TAG, MPI_ERROR</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(9): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_TAG]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_SOURCE, MPI_TAG, MPI_ERROR</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(9): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERROR]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_SOURCE, MPI_TAG, MPI_ERROR</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">------------------------------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(11): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_STATUS_SIZE]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_STATUS_SIZE</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(13): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_STATUS_IGNORE]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_STATUS_IGNORE(MPI_STATUS_SIZE)</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(14): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_STATUSES_IGNORE]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_STATUSES_IGNORE(MPI_STATUS_SIZE,1)</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(15): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERRCODES_IGNORE]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERRCODES_IGNORE(1)</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(16): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ARGVS_NULL]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       CHARACTER*1 MPI_ARGVS_NULL(1,1)</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">-------------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(17): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ARGV_NULL]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       CHARACTER*1 MPI_ARGV_NULL(1)</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">-------------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(18): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_SUCCESS]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_SUCCESS</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(20): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_SIZE]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_SIZE</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(22): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_INFO_KEY]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_INFO_KEY</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(24): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_FILE]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_FILE</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(26): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_AMODE]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_AMODE</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(28): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_TRUNCATE]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_TRUNCATE</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(30): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_BASE]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_BASE</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(32): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_OP]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_OP</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(34): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_ASSERT]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_ASSERT</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(36): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_NAME]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_NAME</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(38): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_NO_MEM]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_NO_MEM</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(40): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_INFO]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_INFO</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(42): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_COUNT]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_COUNT</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(44): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_SPAWN]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_SPAWN</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(46): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_CONVERSION]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_CONVERSION</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(48): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_GROUP]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_GROUP</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(50): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_RMA_SYNC]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_RMA_SYNC</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(52): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_NOT_SAME]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_NOT_SAME</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(54): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_KEYVAL]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_KEYVAL</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(56): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_ACCESS]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_ACCESS</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">/cm/shared/apps/mpich/ge/intel/3.2/include/mpif.h(58): error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [MPI_ERR_DIMS]</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">       INTEGER MPI_ERR_DIMS</span></p>
<p style="margin:0px;font-size:16px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">---------------^</span></p></div><div><br></div><div>I usually write everything consistently within PETSc, but for the first time, I have to use some PETSc routines in a code that is mostly standard FORTRAN 90.</div><div><br></div><div>Is including PETSc via <span style="font-family:menlo;font-size:16px;font-variant-ligatures:no-common-ligatures;color:rgb(125,124,166)">#include</span><span style="font-family:menlo;font-size:16px;font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span style="color:rgb(175,55,130);font-family:menlo;font-size:16px;font-variant-ligatures:no-common-ligatures"><petsc/finclude/petscdef.h> </span>the wrong method?</div><div><br></div><div>Best</div><div><br></div><div>Timothee</div><div><br></div><div><br></div></div>