[petsc-users] missing types in petscsysdef.h

Satish Balay balay at mcs.anl.gov
Tue Feb 7 09:01:53 CST 2017


PETSC_USE_REAL_DOUBLE should be defined in petscconf.h

You did mention earlier that you found it in configure.log. Please
verify if this exists in petscconf.h for your install.

And how are you compiling your code? Not using petsc makefiles?
Perhaps your makefiles are picking up the wrong petscconf.h?

Please check the -I flags that you are passing to the compiler. And
verify by checking the contents of preprocessed sourcefile.

>>>>>>>>>>
balay at asterix /home/balay/petsc/src/ksp/ksp/examples/tutorials (next=)
$ make ex2f.o FFLAGS=-E
mpif90 -c -fPIC -Wall -ffree-line-length-0 -Wno-unused-dummy-argument -g   -E -I/home/balay/petsc/include -I/home/balay/petsc/arch-linux2-c-debug/include    -o ex2f.o ex2f.F
balay at asterix /home/balay/petsc/src/ksp/ksp/examples/tutorials (next=)
$ grep petscconf.h ex2f.o
# 1 "/home/balay/petsc/arch-linux2-c-debug/include/petscconf.h" 1
balay at asterix /home/balay/petsc/src/ksp/ksp/examples/tutorials (next=)
$ 
<<<<<<<<<<

For my build - its using the correct petscconf.h

You can use the following commands with a petsc makefile - to get buildinfo that you should use in  your makefile

balay at asterix /home/balay/petsc (next=)
$ make getincludedirs
-I/home/balay/petsc/include -I/home/balay/petsc/arch-linux2-c-debug/include
balay at asterix /home/balay/petsc (next=)
$ make getlinklibs
-Wl,-rpath,/home/balay/petsc/arch-linux2-c-debug/lib -Wl,-rpath,/home/balay/petsc/arch-linux2-c-debug/lib -L/home/balay/petsc/arch-linux2-c-debug/lib -lpetsc -llapack -lblas -lX11 -lpthread -lm -Wl,-rpath,/home/balay/soft/mpich-3.1.4/lib -L/home/balay/soft/mpich-3.1.4/lib -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/6.3.1 -L/usr/lib/gcc/x86_64-redhat-linux/6.3.1 -lmpifort -lgfortran -lm -lgfortran -lm -lquadmath -lm -lmpicxx -lstdc++ -Wl,-rpath,/home/balay/soft/mpich-3.1.4/lib -L/home/balay/soft/mpich-3.1.4/lib -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/6.3.1 -L/usr/lib/gcc/x86_64-redhat-linux/6.3.1 -ldl -Wl,-rpath,/home/balay/soft/mpich-3.1.4/lib -lmpi -lgcc_s -ldl

Satish

On Tue, 7 Feb 2017, Lukas van de Wiel wrote:

> Hi Matt,
> 
> thank you for your fast reply.
> 
> I have tried this with the dev version.
> The structure of the include files is a lot more transparent, now! Thanks!
> 
> However, PetscReal is still not defined.
> 
> 
> I can use my old method to change the third to last line from petscsys.h block
> 
> #if defined (PETSC_USE_REAL_SINGLE)
> #define PetscReal PetscFortranFloat
> #elif defined(PETSC_USE_REAL___FLOAT128)
> #define PetscReal PetscFortranLongDouble
> #elif defined(PETSC_USE_REAL_DOUBLE)
> #define PetscReal PetscFortranDouble
> #endif
> 
> to
> 
> #if defined (PETSC_USE_REAL_SINGLE)
> #define PetscReal PetscFortranFloat
> #elif defined(PETSC_USE_REAL___FLOAT128)
> #define PetscReal PetscFortranLongDouble
> #else
> #define PetscReal PetscFortranDouble
> #endif
> 
> To make sure it PetscReal is defined as double, even wthen there is no
> PETSC_USE_REAL_[TYPE] defined, and similar for PetscScalar, but that
> is ugly. :-\
> 
> Cheers
> Lukas
> 
> On 2/7/17, Matthew Knepley <knepley at gmail.com> wrote:
> > On Tue, Feb 7, 2017 at 5:12 AM, Lukas van de Wiel <
> > lukas.drinkt.thee at gmail.com> wrote:
> >
> >> Dear fellow PETSc users,
> >>
> >> I have been using PETSc for several years now, but I notice that after
> >> every upgrade I have to make changes to include/finclude/petscsysdef.h
> >> to get my Fortran code to work with it (or, in 3.7.5
> >> include/petsc/finclude/petscsysdef.h)
> >>
> >
> > We will definitely fix this. However, the entire Fortran interface has been
> > rewritten to make it simpler,
> > and allow using all the features os F90. Please see the bottom of
> > http://www.mcs.anl.gov/petsc/documentation/changes/dev.html
> >
> > Would you be able to try out the master branch of PETSc development
> > (instructions here http://www.mcs.anl.gov/petsc/developers/index.html)?
> > This would let us know if the bug is still there.
> >
> >   Thanks,
> >
> >      Matt
> >
> >
> >> I have been running 3.4.2 for a few years, and PetscReal and
> >> PetscScalar were never defined, apparently because no
> >> PETSC_USE_REAL_[TYPE] was never defined.
> >>
> >> In 3.7.5 I have the same problem, and it also affects
> >> PetscFortranComplex which also depends on PETSC_USE_REAL_[TYPE].
> >>
> >> However, my configure.log nicely shows:
> >>
> >> #ifndef PETSC_USE_REAL_DOUBLE
> >> #define PETSC_USE_REAL_DOUBLE 1
> >> #endif
> >>
> >> It seems that changing petscsysdef.h is not the proper solution. Is
> >> there a more elegant way for me to fix this?
> >>
> >> Thanks for your expertise,
> >> Lukas
> >>
> >
> >
> >
> > --
> > What most experimenters take for granted before they begin their
> > experiments is infinitely more interesting than any results to which their
> > experiments lead.
> > -- Norbert Wiener
> >
> 



More information about the petsc-users mailing list