[petsc-users] FLAGS in makefile
Timothée Nicolas
timothee.nicolas at gmail.com
Tue Sep 13 17:28:33 CDT 2016
OK, thank you.
Regarding point 3, no I didn't realize this was dangerous. But
reconfiguring petsc everytime is quite lengthy. How to do if you just want
to test a few compilation options, before knowing what you need?
Timothée
2016-09-13 19:56 GMT+02:00 Satish Balay <balay at mcs.anl.gov>:
> On Tue, 13 Sep 2016, Matthew Knepley wrote:
>
> > On Tue, Sep 13, 2016 at 12:16 PM, Timothée Nicolas <
> > timothee.nicolas at gmail.com> wrote:
> >
> > > Hi all,
> > >
> > > I can't seem to figure out how to specify my compilation options with
> > > PETSc. For my makefiles, I've always been using Petsc examples inspired
> > > makefiles, just tuning them to my needs, and I have never played with
> > > compilation options so far. Now, I am trying to add some compilation
> > > options, but they are not taken into account by the compiler. My
> makefile
> > > looks like this
> > >
> > > all: energy
> > >
> > >
> > > include ${PETSC_DIR}/lib/petsc/conf/variables
> > >
> > > include ${PETSC_DIR}/lib/petsc/conf/rules
> > >
> > >
> > > #FLAGS = -g -O0 -fbounds-check
> > >
> > >
> > >
> > >
> > > MYFLAGS = -mcmodel=medium -shared-intel
> > >
> > >
> > > OBJS = main.o \
> > >
> > > modules.o \
> > >
> > > diags.o \
> > >
> > > functions.o \
> > >
> > > conservation.o \
> > >
> > >
> > > EXEC = energy
> > >
> > >
> > > main.o: modules.o \
> > >
> > > functions.o \
> > >
> > > conservation.o \
> > >
> > > diags.o \
> > >
> > >
> > > energy: $(OBJS) chkopts
> > >
> > > -$(FLINKER) -o $(EXEC) $(MYFLAGS) $(FLAGS) $(OBJS) $(
> > > PETSC_SNES_LIB)
> > >
> > >
> > > clean_all:
> > >
> > > $(RM) $(OBJS) $(EXEC)
> > >
> > >
> > > The compiler then executes things like
> > >
> > > /opt/mpi/bullxmpi/1.2.8.4/bin/mpif90 -c -fPIC -g -O3
> > > -I/ccc/scratch/cont003/gen0198/lutjensh/Timothee/petsc-3.7.3/include
> > > -I/ccc/scratch/cont003/gen0198/lutjensh/Timothee/
> > > petsc-3.7.3/arch-linux2-c-debug/include -I/opt/mpi/bullxmpi/1.2.8.4/
> > > include -o modules.o modules.F90
> > >
> > >
> > > without taking my variable MYFLAGS into account. What may be the
> reason?
> > > Also, what does "chkopts" mean ?
> > >
> >
> > 1) You want to change CFLAGS or FFLAGS
> >
> > 2) 'chkopts' is an internal check for PETSc
> >
> > 3) You realize that it is very dangerous to compile with options not
> > configure with.
>
> And generally - you have to declare FFLAGS - before the 'include'
> statement You can set:
>
> FPPFLAGS - for preprocessing [or compile only flags]
> FFLAGS - for compile & link flags
>
> For link only flags - you can add them to the link command - as you've
> done with MYFLAGS..
>
> Satish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160914/3e305957/attachment.html>
More information about the petsc-users
mailing list