[petsc-dev] Fwd: [petsc-maint #75297] Issue when saving an MPI dense matrix

Jed Brown jed at 59A2.org
Sat Jun 4 12:59:23 CDT 2011


On Fri, Jun 3, 2011 at 20:27, Barry Smith <bsmith at mcs.anl.gov> wrote:

> Actually aside from the MPI calls it looks like the big problems are:
>
> #elif defined(PETSC_HAVE_ISINF) && defined(PETSC_HAVE_ISNAN) &&
> !defined(_GLIBCXX_CMATH)
> PETSC_STATIC_INLINE PetscErrorCode PetscIsInfOrNanScalar(PetscScalar a) {
>  return isinf(PetscAbsScalar(a)) || isnan(PetscAbsScalar(a));
> }
>
> which wants floats, not doubles. I tried casting to float and it didn't
> help so not sure how to fix.
>

I don't understand this issue, but it has to do with PetscAbsScalar()
operating on undetermined types. I made PetscAbsScalar() an inline function
so its argument and return type is specified and this issue goes away.


>   And
>
>
> #if defined(PETSC_HAVE_BUILTIN_EXPECT)
> #  define PetscUnlikely(cond)   __builtin_expect(!!(cond),0)
> #  define PetscLikely(cond)     __builtin_expect(!!(cond),1)
>
> which I also didn't know how to fix.
>

I didn't see this using gcc-4.6 or clang-2.9. Clang also has
-Wshorten-64-to-32 which does exactly what you want.

I just configured

./configure --with-mpi-dir=~/usr/mpich-clang --with-fortran=0
--with-shared-libraries --with-64-bit-indices --CFLAGS='-Wall -Wextra
-Wconversion -Wno-unused-parameter -Wno-sign-conversion'

and almost all the warnings are MPI-related. There are still a lot of
warnings, but they are relevant. I like Clang's warnings much more, but GCC
warnings should be relevant here too.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110604/f14d7710/attachment.html>


More information about the petsc-dev mailing list