Well in spack world - the idea is to get flags from spack and use it in petsc build. Its possible that there are issues in this implementation.
Something spack does is - it internally adds in flags (to the compiler - via its compiler wrapper) - that petsc configure doesn't see. I see 'spack install cflags=-O3' is working - but not spack install cflags='-O3 -g' [something to debug] [there is also the alternative of adding flags to compiler spec file] The other issue is mapping cflags from spack to CFLAGS/COPTFLAGS - in some cases petsc build requires some default CLFAGS to work - and overriding them from spack might cause issues. [again this part is not properly handed].. Satish On Tue, 8 Aug 2023, Liu Wei AWE via petsc-dev wrote: > Hi all > > I am currently building a large software stack using Spack with PETSc 3.19 as > part of the dependency library. > > Spotted the following message during the build process > > Using default optimization C flags "-g -O". You might consider manually > setting optimal optimization flags for your system with > COPTFLAGS="optimization flags" see config/examples/arch-*-opt.py for examples > > Previously when we install PETSc manually, optimisation flags are enforced > via configure script e.g. > COPTFLAGS="-g -O3 -march=native" > CXXOPTFLAGS="-g -O3 -march=native" > ... > (or "-g -O3 -xhost" for intel compiler) > > Whilst spack spec syntax allows compiler parameters via cflags/cxxflags/fflags > https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/petsc/package.py<https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/petsc/package.py#L400> > the requirement is not obvious, especially in a long build process. > > The question is should optimisation be amended at spack recipe stage or > should PETSc configure enforce some compiler optimisation (if > -with-debugging=0 is set) ? > > Regards > > Dr Wei Liu > High Performance Computing > To chat with me on Teams click > here<https://teams.microsoft.com/l/chat/0/0?users=wei....@awe.co.uk> > T: +44 01189 856209 > M: wei....@awe.co.uk<mailto:wei....@awe.co.uk> > AWE Aldermaston, > Reading, Berkshire, RG7 4PR > > The information in this email and in any attachment(s) is commercial in > confidence. If you are not the named addressee(s) or if you receive this > email in error then any distribution, copying or use of this communication or > the information in it is strictly prohibited. Please notify us immediately by > email at admin.internet(at)awe.co.uk, and then delete this message from your > computer. While attachments are virus checked, AWE plc does not accept any > liability in respect of any virus which is not detected. AWE Plc Registered > in England and Wales Registration No 02763902 AWE, Aldermaston, Reading, RG7 > 4PR >