Hi,
to add another data-point to this discussion: I found that adding
-DMPI_SKIP_MPICXX dramatically reduces the number of compiler warnings
arising from OpenMPI-code.
Without doing this, the important compiler warnings about my own code
get lost in the noise. Examples with and without -DOMPI_SKIP_MPICXX
below (coincidentally, this example triggers a warning on Petsc code).
Cheers,
Harald
WITH -DOMPI_SKIP_MPICXX
[pfeiffer at bee EllipticSolver]$ make -s
========== compile EllipticSolverCore.cpp
In file included from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petsc.h:1796,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscis.h:7,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscvec.h:9,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscmat.h:6,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscpc.h:6,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscksp.h:6,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscsnes.h:6,
from
/scratch/pfeiffer/SpEC/gccO/Elliptic/EllipticResidual/Petsc.hpp:8,
from
/scratch/pfeiffer/SpEC/gccO/Elliptic/Preconditioning/Preconditioner.hpp:13,
from EllipticSolverCore.hpp:11,
from EllipticSolverCore.cpp:9:
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petsc.hh: In
constructor ?PETSc::Exception::Exception(const std::string&)?:
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petsc.hh:10: warning:
declaration of ?msg? shadows a member of 'this'
WITHOUT -DOMPI_SKIP_MPICXX:
[pfeiffer at bee EllipticSolver]$ make -s
========== compile EllipticSolverCore.cpp
In file included from
/usr/include/openmpi/1.2.4-gcc/openmpi/ompi/mpi/cxx/mpicxx.h:246,
from /usr/include/openmpi/1.2.4-gcc/mpi.h:1783,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petsc.h:137,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscis.h:7,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscvec.h:9,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscmat.h:6,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscpc.h:6,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscksp.h:6,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscsnes.h:6,
from
/scratch/pfeiffer/SpEC/gccO/Elliptic/EllipticResidual/Petsc.hpp:8,
from
/scratch/pfeiffer/SpEC/gccO/Elliptic/Preconditioning/Preconditioner.hpp:13,
from EllipticSolverCore.hpp:11,
from EllipticSolverCore.cpp:9:
/usr/include/openmpi/1.2.4-gcc/openmpi/ompi/mpi/cxx/request_inln.h: In
static member function ?static MPI::Grequest MPI::Grequest::Start(int
(*)(void*, MPI::Status&), int (*)(void*), int (*)(void*, bool), void*)?:
/usr/include/openmpi/1.2.4-gcc/openmpi/ompi/mpi/cxx/request_inln.h:347:
warning: declaration ?struct MPI::Grequest_intercept_t? does not declare
anything
In file included from
/usr/include/openmpi/1.2.4-gcc/openmpi/ompi/mpi/cxx/mpicxx.h:247,
from /usr/include/openmpi/1.2.4-gcc/mpi.h:1783,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petsc.h:137,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscis.h:7,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscvec.h:9,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscmat.h:6,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscpc.h:6,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscksp.h:6,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscsnes.h:6,
from
/scratch/pfeiffer/SpEC/gccO/Elliptic/EllipticResidual/Petsc.hpp:8,
from
/scratch/pfeiffer/SpEC/gccO/Elliptic/Preconditioning/Preconditioner.hpp:13,
from EllipticSolverCore.hpp:11,
from EllipticSolverCore.cpp:9:
/usr/include/openmpi/1.2.4-gcc/openmpi/ompi/mpi/cxx/comm_inln.h: In
static member function ?static int MPI::Comm::NULL_COPY_FN(const
MPI::Comm&, int, void*, void*, void*, bool&)?:
/usr/include/openmpi/1.2.4-gcc/openmpi/ompi/mpi/cxx/comm_inln.h:641:
warning: the address of ?int
OMPI_C_MPI_NULL_COPY_FN(ompi_communicator_t*, int, void*, void*, void*,
int*)? will never be NULL
/usr/include/openmpi/1.2.4-gcc/openmpi/ompi/mpi/cxx/comm_inln.h: In
static member function ?static int MPI::Comm::NULL_DELETE_FN(MPI::Comm&,
int, void*, void*)?:
/usr/include/openmpi/1.2.4-gcc/openmpi/ompi/mpi/cxx/comm_inln.h:698:
warning: the address of ?int
OMPI_C_MPI_NULL_DELETE_FN(ompi_communicator_t*, int, void*, void*)? will
never be NULL
In file included from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petsc.h:1796,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscis.h:7,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscvec.h:9,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscmat.h:6,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscpc.h:6,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscksp.h:6,
from
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petscsnes.h:6,
from
/scratch/pfeiffer/SpEC/gccO/Elliptic/EllipticResidual/Petsc.hpp:8,
from
/scratch/pfeiffer/SpEC/gccO/Elliptic/Preconditioning/Preconditioner.hpp:13,
from EllipticSolverCore.hpp:11,
from EllipticSolverCore.cpp:9:
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petsc.hh: In
constructor ?PETSc::Exception::Exception(const std::string&)?:
/scratch/pfeiffer/opt/src/petsc-3.0.0-p9/include/petsc.hh:10: warning:
declaration of ?msg? shadows a member of 'this'
Barry Smith wrote:
>
> Eric,
>
> Could you describe, preferably with error messages printed by
> compilers etc, why this is necessary? I read the comment in petsc.h
>
>
> PETSc does not use the C++ binding of MPI at ALL. The following flag
> makes sure the C++ bindings are not included. The C++ bindings REQUIRE
> putting mpi.h before ANY C++ include files, we cannot control this
> with all PETSc users.
> */
>
> but could not reproduce the problem (I put C++ include files before
> mpi.h without that flag and everything compiled and ran fine for both
> MPICH and OpenMPI on my Apple).
>
> Do we really need the flags. I have no problem putting in the OpenMPI
> also, but it does mean that PETSc users cannot use the C++ bindings of
> MPI (which some may want to). So I would like to avoid both flags unless
> they are really needed.
>
> Thanks
>
> Barry
>
>
> On Jan 6, 2010, at 8:21 AM, Eric Chamberland wrote:
>
>> Hi,
>>
>> we have compile petsc-2.3.3-p15 with openMPI 1.3.4. To have it working
>> with our C++ code, I did a "#define OMPI_SKIP_MPICXX".
>>
>> In petsc.h, this is already done but for MPICH, on line #137:
>>
>> #define MPICH_SKIP_MPICXX 1
>>
>> It would be nice to also have a:
>>
>> #define OMPI_SKIP_MPICXX" 1
>>
>> But I don't know if it would be necessery also in petsc release 3.
>>
>> Thank you!
>>
>> Eric