[petsc-users] Fortran preprocessor not work in pets-dev

Satish Balay balay at mcs.anl.gov
Sun May 7 09:14:42 CDT 2023


Perhaps you are not using the latest 'main' (or release) branch?

I get (with current main):

$  mpiexec -n 4 ./petsc_fppflags
 compiled by STANDARD_FORTRAN compiler
 called by rank            0
 called by rank            1
 called by rank            2
 called by rank            3

There was a issue with early petsc-3.19 release - here one had to reorder the lines from:

FPPFLAGS =
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules

to

include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules
FPPFLAGS =

But this is fixed in latest release and main branches.

Satish

On Sun, 7 May 2023, Danyang Su wrote:

> Hi Satish,
> 
> Sorry, this is a typo when copy to the email. I use FPPFLAGS in the makefile. Not sure why this occurs.
> 
> Actually not only the preprocessor fails, the petsc initialize does not work either. Attached is a very simple fortran code and below is the test results. Looks like the petsc is not properly installed. I am working on macOS Monterey version 12.5 (Intel Xeon W processor).
> 
> Compiled using petsc-3.18
> (base) ➜  petsc-dev-fppflags mpiexec -n 4 ./petsc_fppflags
>  compiled by STANDARD_FORTRAN compiler
>  called by rank            0
>  called by rank            1
>  called by rank            2
>  called by rank            3
> 
> compiled using petsc-dev
> (base) ➜  petsc-dev-fppflags mpiexec -n 4 ./petsc_fppflags
>  called by rank            2
>  called by rank            2
>  called by rank            2
>  called by rank            2
> 
> Thanks,
> 
> Danyang
> 
> On 2023-05-06, 10:22 PM, "Satish Balay" <balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>> wrote:
> 
> 
> On Sat, 6 May 2023, Danyang Su wrote:
> 
> 
> > Hi All,
> > 
> > 
> > 
> > My code has some FPP. It works fine in PETSc 3.18 and earlier version, but stops working in the latest PETSc-Dev. For example the following FPP STANDARD_FORTRAN is not recognized. 
> > 
> > 
> > 
> > #ifdef STANDARD_FORTRAN
> > 
> > 1 format(15x,1000a15)
> > 
> > 2 format(1pe15.6e3,1000(1pe15.6e3))
> > 
> > #else
> > 
> > 1 format(15x,<ncol>a15) 
> > 
> > 2 format(1pe15.6e3,<ncol>(1pe15.6e3))
> > 
> > #endif
> > 
> > 
> > 
> > In the makefile, I define the preprocessor as PPFLAGS.
> > 
> > 
> > 
> > PPFLAGS := -DLINUX -DRELEASE -DRELEASE_X64 -DSTANDARD_FORTRAN
> 
> 
> Shouldn't this be FPPFLAGS?
> 
> 
> 
> 
> Can you send us a simple test case [with the makefile] that we can try to demonstrate this problem?
> 
> 
> Satish
> 
> 
> > 
> > …
> > 
> > exe: $(OBJS) chkopts
> > 
> > -${FLINKER} $(FFLAGS) $(FPPFLAGS) $(CPPFLAGS) -o $(EXENAME) $(OBJS) ${PETSC_LIB} ${LIS_LIB} ${DLIB} ${SLIB}
> > 
> > 
> > 
> > Any idea on this problem?
> > 
> > 
> > 
> > All the best,
> > 
> > 
> > 
> > 
> > 
> > 
> 
> 
> 
> 


More information about the petsc-users mailing list