[petsc-users] FLAGS in makefile

Matthew Knepley knepley at gmail.com
Tue Sep 13 17:32:57 CDT 2016


On Tue, Sep 13, 2016 at 5:28 PM, Timothée Nicolas <
timothee.nicolas at gmail.com> wrote:

> 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?
>

It dangerous because you can make source incompatible with the previously
compiled libraries. You can insert other
headers in front of those used by the libraries, change type size, name
mangling, etc.

Configuring should not take that long. A complete configure and build takes
about 8min at the Bitbucket regression
tests. Are you running on a slow file system?

  Thanks,

     Matt


> 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
>
>
>


-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160913/2e6a2969/attachment.html>


More information about the petsc-users mailing list