[petsc-users] makefile changes since release 12
Satish Balay
balay at mcs.anl.gov
Fri Apr 24 10:27:31 CDT 2020
On Fri, 24 Apr 2020, Jed Brown wrote:
> I'd say yes, that's the right thing. These are vestigial remnants of
> the legacy make system.
>
> I believe PETSc doesn't use this anywhere internally, and thus can be
> removed. I don't know if the following patch would break any existing
> correct usage.
>
> diff --git i/lib/petsc/conf/variables w/lib/petsc/conf/variables
> index a7de68e2ae..07bc4254c9 100644
> --- i/lib/petsc/conf/variables
> +++ w/lib/petsc/conf/variables
> @@ -36,13 +36,13 @@ F_SH_LIB_PATH = ${PETSC_F_SH_LIB_PATH}
> PSOURCEC = $(SOURCEC:%=`pwd`/%)
> PSOURCECXX= $(SOURCECXX:%=`pwd`/%)
> PSOURCECU = $(SOURCECU:%=`pwd`/%)
> -PETSC_COMPILE = ${PCC} -c ${PCC_FLAGS} ${PFLAGS} ${CCPPFLAGS} ${PSOURCEC}
> +PETSC_COMPILE = ${PCC} -c ${PCC_FLAGS} ${PFLAGS} ${CCPPFLAGS}
> PETSC_CCOMPILE = ${CC} -c ${CC_FLAGS} ${CPPFLAGS} ${PETSC_CC_INCLUDES}
> -PETSC_CXXCOMPILE = ${CXX} -c ${CXX_FLAGS} ${CXXFLAGS} ${CXXCPPFLAGS} ${PSOURCECXX}
> +PETSC_CXXCOMPILE = ${CXX} -c ${CXX_FLAGS} ${CXXFLAGS} ${CXXCPPFLAGS}
> PETSC_COMPILE_SINGLE = ${PCC} -o $*.o -c ${PCC_FLAGS} ${PFLAGS} ${CCPPFLAGS}
> PETSC_CXXCOMPILE_SINGLE = ${CXX} -o $*.o -c ${CXX_FLAGS} ${CXXFLAGS} ${CXXCPPFLAGS}
> -PETSC_FCOMPILE = ${FC} -c ${FC_FLAGS} ${FFLAGS} ${FCPPFLAGS} ${SOURCEF} ${SOURCEF90}
> -PETSC_CUCOMPILE = ${CUDAC} ${CUDAC_FLAGS} -c --compiler-options="${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS}" ${PSOURCECU}
> +PETSC_FCOMPILE = ${FC} -c ${FC_FLAGS} ${FFLAGS} ${FCPPFLAGS}
> +PETSC_CUCOMPILE = ${CUDAC} ${CUDAC_FLAGS} -c --compiler-options="${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS}"
> PETSC_CUCOMPILE_SINGLE = ${CUDAC} -o $*.o ${CUDAC_FLAGS} -c --compiler-options="${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS}"
> #
> # define OBJSC OBJSCXX and OBJSF OBJSCU
I think Matt's approach is good for maint. Wrt cleanup - likely we just need PETSC_COMPILE_SINGLE and related stuff and not PETSC_COMPILE and related stuff
>
>
>
> Crossing over to dev discussion, I wish we could make these names more
> standard, like the following predefined ones (see `make -p`).
>
> COMPILE.F = $(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
> %.o: %.F
> # recipe to execute (built-in):
> $(COMPILE.F) $(OUTPUT_OPTION) $<
> LINK.F = $(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
> %: %.F
> # recipe to execute (built-in):
> $(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@
>
>
> So we could define PETSC_COMPILE.F, PETSC_LINK.F, etc., and a user could write
>
> COMPILE.F = PETSC_COMPILE.F
>
> if all their *.F sources use PETSc, in which case all the standard rules
> would work. Or, they could use PETSc-enabled build only for a subset of
> their sources:
>
> $(SOURCES_USING_PETSC:%.F=%.o) : %.o : %.F
> $(PETSC_COMPILE.F) $(OUTPUT_OPTION) $<
Hm - I thought we were going to leave the current rules file to be portable - and have gnumakefile syntax available via share/petsc/Makefile.user
Hence we have similar rules [as above] in lib/petsc/conf/test
Satish
>
> Aldo Bonfiglioli <aldo.bonfiglioli at unibas.it> writes:
>
> > Hi there,
> >
> > the makefile I have been using for ages (up to 11.4) now fails with 12.5.
> >
> > I noticed that there have been several changes in
> >
> > include $(PETSC_DIR)/lib/petsc/conf/variables
> > include $(PETSC_DIR)/lib/petsc/conf/rules
> >
> > btw. the two aforementioned versions.
> >
> > If I'm not wrong, *.F files should now be compiled with:
> >
> >>
> >> .F.o .F90.o .F95.o:
> >> ${PETSC_FCOMPILE} -o $@ $<
> > However, in ${PETSC_FCOMPILE} there are also my ${SOURCEF} fortran sources,
> >
> > so that I get the following compilation error:
> >
> >> gfortran -c -fPIC -Wall -ffree-line-length-0
> >> -Wno-unused-dummy-argument -g -I../../include/ -I.
> >> -I/home/abonfi/src/petsc-3.12.5/include
> >> -I/home/abonfi/src/petsc-3.12.5/linux_gnu/include getidx.f
> >> ApplicationFunction.F ApplicationFunction_t.F bndry_iset.F
> >> JacobianBoundaryConditions.F RHSFunction.F RHSFunction_t.F
> >> RHSJacobian.F RHSJacobian_t.F blockdata.f bndvflx.F clearmem.F
> >> lhsbc5.F lhsbc6.F exgeo.F newgeo.F ghost.F ghost2.F init.F iset.F
> >> iset_t.F main.F matsch.F MotionSolver.F myTS.F nodres.F nodres_t.F
> >> noname.f printmat2.F printmat.F printmatmm.F qb.F rdat.F readat.F
> >> rgrdpts.F rhsbc1.F rhsbc4.F rhsbc5.F rhsbc5c.F sclsch.F
> >> setbc4laplace.F setibc.F seterr.F setupRHS.F setupRHS_t.F setupLHS_b.F
> >> solzne.F MatAllocaSeq.F test.F tmodel.F turbini.F turbsch.F update2.F
> >> update3.F update4.F weakbc.F -o ApplicationFunction_t.o
> >> ApplicationFunction_t.F
> >> gfortran: fatal error: cannot specify ‘-o’ with ‘-c’, ‘-S’ or ‘-E’
> >> with multiple files
> >> compilation terminated.
> >
> > If I remove ${SOURCEF} from the ${PETSC_FCOMPILE} definition in
> >
> > $(PETSC_DIR)/lib/petsc/conf/variables
> >
> > things work, but I am not sure that this is the right thing to do.
> >
> > Thanks,
> >
> > Aldo
> >
> > PS My makefile is attached
> >
> > --
> > Dr. Aldo Bonfiglioli
> > Associate professor of Fluid Machines
> > Scuola di Ingegneria
> > Universita' della Basilicata
> > V.le dell'Ateneo lucano, 10 85100 Potenza ITALY
> > tel:+39.0971.205203 fax:+39.0971.205215
> > web: http://docenti.unibas.it/site/home/docente.html?m=002423
> >
> > VERSION = 3.12.0
> > PROGRAM = eulfs$(VERSION)-$(PETSC_ARCH)
> > all: $(PROGRAM)
> > FFLAGS = -I../../include/ -I.
> > FCPPFLAGS = $(FCPPFLAGS) -I../../include/ -I.
> > CFLAGS =
> > #
> > # ad hoc fix for SP3
> > #
> > #FCPPFLAGS = ${PETSC_INCLUDE} ${PCONF} ${PETSCFLAGS} ${PETSC_PARCH} \
> > ${FPPFLAGS} -I$(FSPL_DIR)/include/
> >
> > include $(PETSC_DIR)/lib/petsc/conf/variables
> > include $(PETSC_DIR)/lib/petsc/conf/rules
> >
> >
> > DEST = $(HOME)/bin/$(PETSC_ARCH)
> > INSTALL = cp
> > SOURCEC =
> > SOURCEF = \
> > getidx.f \
> > ApplicationFunction.F \
> > ApplicationFunction_t.F \
> > bndry_iset.F \
> > JacobianBoundaryConditions.F \
> > RHSFunction.F \
> > RHSFunction_t.F \
> > RHSJacobian.F \
> > RHSJacobian_t.F \
> > blockdata.f \
> > bndvflx.F \
> > clearmem.F \
> > lhsbc5.F \
> > lhsbc6.F \
> > exgeo.F \
> > newgeo.F \
> > ghost.F \
> > ghost2.F \
> > init.F \
> > iset.F \
> > iset_t.F \
> > main.F \
> > matsch.F \
> > MotionSolver.F \
> > myTS.F \
> > nodres.F \
> > nodres_t.F \
> > noname.f \
> > printmat2.F \
> > printmat.F \
> > printmatmm.F \
> > qb.F \
> > rdat.F \
> > readat.F \
> > rgrdpts.F \
> > rhsbc1.F \
> > rhsbc4.F \
> > rhsbc5.F \
> > rhsbc5c.F \
> > sclsch.F \
> > setbc4laplace.F \
> > setibc.F \
> > seterr.F \
> > setupRHS.F \
> > setupRHS_t.F \
> > setupLHS_b.F \
> > solzne.F \
> > MatAllocaSeq.F \
> > test.F \
> > tmodel.F \
> > turbini.F \
> > turbsch.F \
> > update2.F \
> > update3.F \
> > update4.F \
> > weakbc.F
> > SOURCEH =
> > OBJSC =
> > OBJSF = \
> > getidx.o \
> > ApplicationFunction.o \
> > ApplicationFunction_t.o \
> > bndry_iset.o \
> > JacobianBoundaryConditions.o \
> > RHSFunction.o \
> > RHSFunction_t.o \
> > RHSJacobian.o \
> > RHSJacobian_t.o \
> > blockdata.o \
> > bndvflx.o \
> > clearmem.o \
> > lhsbc5.o \
> > lhsbc6.o \
> > exgeo.o \
> > newgeo.o \
> > ghost.o \
> > ghost2.o \
> > init.o \
> > iset.o \
> > iset_t.o \
> > main.o \
> > matsch.o \
> > MotionSolver.o \
> > myTS.o \
> > nodres.o \
> > nodres_t.o \
> > noname.o \
> > printmat2.o \
> > printmat.o \
> > printmatmm.o \
> > qb.o \
> > rdat.o \
> > readat.o \
> > rgrdpts.o \
> > rhsbc1.o \
> > rhsbc4.o \
> > rhsbc5.o \
> > rhsbc5c.o \
> > sclsch.o \
> > setbc4laplace.o \
> > setibc.o \
> > seterr.o \
> > setupRHS.o \
> > setupRHS_t.o \
> > setupLHS_b.o \
> > solzne.o \
> > MatAllocaSeq.o \
> > test.o \
> > tmodel.o \
> > turbini.o \
> > turbsch.o \
> > update2.o \
> > update3.o \
> > update4.o \
> > weakbc.o
> > LIBBASE =
> > #LIBFLAGS = -L$(HOME)/lib/$(PETSC_ARCH) -lfxdr -lport -lmynag -lskit
> > LIBFLAGS = -L$(HOME)/lib/$(PETSC_ARCH) -lfxdr -lport -lsparse-blas -lskit -ltirpc
> > LIBS = \
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libscalar.a \
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libeuler.a \
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libspl.a \
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libns.a \
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libturbo.a \
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libgeo.a \
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libchem.a \
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libutil.a
> > #
> > # CLDFILES to be defined only for CRAY
> > #
> > #CLDFILES = dp_lapack.cld dp_blas.cld pat.cld
> > #CLDFILES = dp_lapack.cld dp_blas.cld
> >
> > #look:; @echo $(SOURCEALL) $(OBJSF)
> > look:; @echo "Look man! Isn't it weird? " $(PETSC_FCOMPILE)
> >
> >
> > $(PROGRAM): $(OBJSF) $(OBJSC) $(LIBS)
> > -$(FLINKER) $(CLDFILES) -o $(PROGRAM) $(OBJSF) $(OBJSC) $(LIBS) \
> > $(PETSC_FORTRAN_LIB) $(PETSC_LIB) $(LIBFLAGS)
> >
> >
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libgeo.a:
> > cd $(FSPL_DIR)/src/geometry; $(MAKE) install
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libeuler.a:
> > cd $(FSPL_DIR)/src/euler; $(MAKE) install
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libspl.a:
> > cd $(FSPL_DIR)/src/schemes; $(MAKE) install
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libns.a:
> > cd $(FSPL_DIR)/src/navier-stokes; $(MAKE) install
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libscalar.a:
> > cd $(FSPL_DIR)/src/scalar; $(MAKE) install
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libturbo.a:
> > cd $(FSPL_DIR)/src/turbo; $(MAKE) install
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libchem.a:
> > cd $(FSPL_DIR)/src/chemistry; $(MAKE) install
> > $(FSPL_DIR)/lib/$(PETSC_ARCH)/libutil.a:
> > cd $(FSPL_DIR)/src/util; $(MAKE) install
> >
> >
> > #.SUFFIXES:
> > #.F.o:
> > # $(U_FC) -c $(FFLAGS) $(FCPPFLAGS) $<
> > #.f.o:
> > # $(U_FC) -c $(FFLAGS) $<
> > #########
> >
> >
> > checkout:; @co $(SOURCEF)
> >
> > install: $(PROGRAM)
> > @echo Installing $(PROGRAM) in $(DEST)
> > @if [ $(DEST) != . ]; then \
> > (rm -f $(DEST)/$(PROGRAM); $(INSTALL) $(PROGRAM) $(DEST)); fi
> > ###
> > blockdata.o: ../../include/paramt.h ../../include/bnd.h \
> > ../../include/constants.h ../../include/bnd.com \
> > ../../include/conv.com ../../include/implicit.h \
> > ../../include/nboun.com ../../include/three.com
> > bndvflx.o: ../../include/paramt.h ../../include/constants.h \
> > ../../include/implicit.h ../../include/bnd.h ../../include/bnd.com \
> > ../../include/three.com ../../include/nloc.com ../../include/flags.com \
> > ../../include/stream.com ../../include/io.com
> > exgeo.o: ../../include/io.com ../../include/constants.h ../../include/nloc.com
> > iset.o: ../../include/iset.com
> > lhsbc5.o: ../../include/iset.com
> > main.o: ../../include/stack.com
> > matsch.o: ../../include/flags.com
> > mshcnt.o: ../../include/verbose.com ../../include/io.com
> > nodres.o: ../../include/paramt.h ../../include/bnd.h ../../include/constants.h \
> > ../../include/bnd.com ../../include/nloc.com ../../include/flags.com \
> > ../../include/stream.com ../../include/conv.com \
> > ../../include/nboun.com ../../include/implicit.h ../../include/io.com
> > psub.o: ../../include/constants.h ../../include/paramt.h ../../include/nloc.com \
> > ../../include/flags.com
> > rdat.o: ../../include/paramt.h ../../include/bnd.h ../../include/implicit.h \
> > ../../include/visco.com ../../include/constants.h \
> > ../../include/conv.com ../../include/stream.com \
> > ../../include/chorin.com ../../include/scalar.com \
> > ../../include/flags.com ../../include/turb.com \
> > ../../include/bnd.com ../../include/io.com \
> > ../../include/verbose.com
> > readat.o: ../../include/constants.h ../../include/bnd.h ../../include/paramt.h \
> > ../../include/io.com ../../include/nloc.com ../../include/flags.com \
> > ../../include/stream.com
> > rhsbc1.o: ../../include/paramt.h ../../include/constants.h \
> > ../../include/iset.com
> > rhsbc4.o: ../../include/paramt.h ../../include/constants.h \
> > ../../include/iset.com
> > rhsbc5.o: ../../include/paramt.h ../../include/iset.com \
> > ../../include/constants.h
> > sclsch.o: ../../include/flags.com
> > solzne.o: ../../include/io.com
> > turbcomp.o: ../../include/paramt.h ../../include/constants.h ../../include/nloc.com \
> > ../../include/three.com ../../include/flags.com ../../include/turb.com \
> > ../../include/trip.com ../../include/visco.com \
> > ../../include/nboun.com ../../include/implicit.h ../../include/io.com
> > update2.o: ../../include/constants.h ../../include/paramt.h \
> > ../../include/conv.com ../../include/nloc.com ../../include/verbose.com \
> > ../../include/implicit.h ../../include/iset.com \
> > ../../include/flags.com ../../include/io.com
> > update3.o: ../../include/constants.h ../../include/paramt.h \
> > ../../include/implicit.h ../../include/conv.com ../../include/nloc.com \
> > ../../include/verbose.com ../../include/iset.com \
> > ../../include/flags.com ../../include/io.com
> > update4.o: ../../include/constants.h ../../include/paramt.h \
> > ../../include/conv.com ../../include/nboun.com ../../include/nloc.com \
> > ../../include/verbose.com ../../include/implicit.h ../../include/io.com
> > weakbc.o: ../../include/paramt.h ../../include/constants.h ../../include/bnd.h \
> > ../../include/bnd.com ../../include/three.com ../../include/nloc.com \
> > ../../include/implicit.h rotaterhs.f rotaterhs2.f
>
More information about the petsc-users
mailing list