Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-15 Thread Jed Brown
Pierre Jolivet writes: > I’m playing the Devil’s advocate since the beginning, we’ve had a > --enable-generic (off by default) which turns -march=native into > -march=generic for 20+ years (I’m seeing references to PPC7450 and Intel > Coppermine in our configure…). > We turn this flag on when

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-15 Thread Pierre Jolivet
> On 15 Feb 2021, at 1:41 AM, Barry Smith wrote: > > > >> On Feb 14, 2021, at 4:04 PM, Jed Brown wrote: >> >> Barry Smith writes: >> >>> My feeling is 90+% of users don't care about portability, they want to get >>> fast performance on the machine they are compiling with (or a collecti

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Barry Smith
> On Feb 14, 2021, at 4:04 PM, Jed Brown wrote: > > Barry Smith writes: > >> My feeling is 90+% of users don't care about portability, they want to get >> fast performance on the machine they are compiling with (or a collection of >> machines they have around). > > This is an exclusio

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Jed Brown
Jacob Faibussowitsch writes: >> working out dispatch in MatCreate_XXX() instead of for each function. > > Or use compiler extensions for multiversioned functions (I recall GCC has > something similar): > https://clang.llvm.org/docs/AttributeReference.html#target >

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Jacob Faibussowitsch
> working out dispatch in MatCreate_XXX() instead of for each function. Or use compiler extensions for multiversioned functions (I recall GCC has something similar): https://clang.llvm.org/docs/AttributeReference.html#target Best rega

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Jed Brown
Barry Smith writes: >> On Feb 14, 2021, at 12:13 PM, Jed Brown wrote: >> >> Barry Smith writes: >> This is a reasonable message to print on the screen, but I don’t think this is a reasonable flag to impose by default. You are basically asking all package managers to add a new

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Jed Brown
Barry Smith writes: >My feeling is 90+% of users don't care about portability, they want to get > fast performance on the machine they are compiling with (or a collection of > machines they have around). This is an exclusionary view of users. PETSc could and would be used in more places

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Barry Smith
> On Feb 14, 2021, at 1:25 PM, Zhang, Hong wrote: > > > >> On Feb 14, 2021, at 12:04 PM, Barry Smith wrote: >> >> >> For our handcoded AVX functions this is fine, we can handle the dispatching >> ourselves. > > Cool. _may_i_use_cpu_feature() would be very useful to determine the optim

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Zhang, Hong via petsc-dev
Oops, a typo in the command line. Should be AVX. SSE3 or above and AVX are not used for -O3. hongzhang@petsc-02:/nfs/gce/projects/TSAdjoint$ icc -O3 -E -dM - < /dev/null | grep SSE #define __SSE__ 1 #define __SSE_MATH__ 1 #define __SSE2__ 1 #define __SSE2_MATH__ 1 hongzhang@petsc-02:/nfs/gce/pro

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Zhang, Hong via petsc-dev
> On Feb 14, 2021, at 12:04 PM, Barry Smith wrote: > > > For our handcoded AVX functions this is fine, we can handle the dispatching > ourselves. Cool. _may_i_use_cpu_feature() would be very useful to determine the optimal AVX code path at runtime. Theoretically we just need to query for

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Barry Smith
> On Feb 14, 2021, at 12:13 PM, Jed Brown wrote: > > Barry Smith writes: > >>> This is a reasonable message to print on the screen, but I don’t think this >>> is a reasonable flag to impose by default. >>> You are basically asking all package managers to add a new flag >>> (-march=generic)

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Jed Brown
Barry Smith writes: >> This is a reasonable message to print on the screen, but I don’t think this >> is a reasonable flag to impose by default. >> You are basically asking all package managers to add a new flag >> (-march=generic) which was previously not needed. > > This is a tough constrai

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Barry Smith
For our handcoded AVX functions this is fine, we can handle the dispatching ourselves. But what about all the tons of regular code in PETSc, somehow we need to have the same function compiled twice and dispatched properly. Do we use what Hong suggested with fat binaries? So fat-binaries

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Barry Smith
> On Feb 14, 2021, at 10:09 AM, Pierre Jolivet wrote: > > > >> On 14 Feb 2021, at 4:52 PM, Zhang, Hong via petsc-dev > > wrote: >> >> >> > > This is a reasonable message to print on the screen, but I don’t think this > is a reasonable flag to impose by defau

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Jed Brown
Pierre Jolivet writes: Expecting PETSc users to automatically add -march= is not realistic. I will try to rig something up in configure where if the user does not provide march something reasonable is selected. >>> A softer (yet trivial to implement) option might also be to j

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Barry Smith
> On Feb 14, 2021, at 10:18 AM, Zhang, Hong via petsc-dev > wrote: > > >> > > This is doable using Intel compilers with -ax options at the cost of > generating fat binaries. For example, > > -axCORE-AVX512,MIC-AVX512 > -axAVX,CORE-AVX2-axarch > Thanks. What does this actually do? Is

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Zhang, Hong via petsc-dev
On Feb 14, 2021, at 10:09 AM, Pierre Jolivet mailto:pie...@joliv.et>> wrote: On 14 Feb 2021, at 4:52 PM, Zhang, Hong via petsc-dev mailto:petsc-dev@mcs.anl.gov>> wrote: On Feb 14, 2021, at 5:05 AM, Patrick Sanan mailto:patrick.sa...@gmail.com>> wrote: Am 14.02.2021 um 07:22 schrieb Ba

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Pierre Jolivet
> On 14 Feb 2021, at 4:52 PM, Zhang, Hong via petsc-dev > wrote: > > > >> On Feb 14, 2021, at 5:05 AM, Patrick Sanan > > wrote: >> >> >> >>> Am 14.02.2021 um 07:22 schrieb Barry Smith >> >: >>> >>> >>> On Feb 13, 2021, at 11

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Zhang, Hong via petsc-dev
On Feb 14, 2021, at 5:05 AM, Patrick Sanan mailto:patrick.sa...@gmail.com>> wrote: Am 14.02.2021 um 07:22 schrieb Barry Smith mailto:bsm...@petsc.dev>>: On Feb 13, 2021, at 11:58 PM, Jed Brown mailto:j...@jedbrown.org>> wrote: I usually configure --with-debugging=0 COPTFLAGS='-O2 -march

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-14 Thread Patrick Sanan
> Am 14.02.2021 um 07:22 schrieb Barry Smith : > > > >> On Feb 13, 2021, at 11:58 PM, Jed Brown wrote: >> >> I usually configure --with-debugging=0 COPTFLAGS='-O2 -march=native' or >> similar. There's a tension here between optimizing aggressively for the >> current machine and making bina

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-13 Thread Barry Smith
> On Feb 13, 2021, at 11:58 PM, Jed Brown wrote: > > I usually configure --with-debugging=0 COPTFLAGS='-O2 -march=native' or > similar. There's a tension here between optimizing aggressively for the > current machine and making binaries that work on other machines. Most > configure systems

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-13 Thread Jed Brown
I usually configure --with-debugging=0 COPTFLAGS='-O2 -march=native' or similar. There's a tension here between optimizing aggressively for the current machine and making binaries that work on other machines. Most configure systems default to making somewhat portable binaries, so that's a princi

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-13 Thread Barry Smith
Thanks. Configure should always be running this to log the information to configure.log I will add it. Barry > On Feb 13, 2021, at 11:50 PM, Zhang, Hong wrote: > > The CPU supports avx2, but the compiler or the OS may not. You can print out > the macros that the compiler defines and gre

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-13 Thread Zhang, Hong via petsc-dev
The CPU supports avx2, but the compiler or the OS may not. You can print out the macros that the compiler defines and grep for avx2. The commands can be found at https://stackoverflow.com/questions/9349754/generate-list-of-preprocessor-macros-defined-by-the-compiler Hong On Feb 13, 2021, at 8

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-13 Thread Barry Smith
Shouldn't configure be setting something appropriate for this automatically? This is nuts, it means when users do a ./configure make unless they pass weird arguments they sure as heck don't know about to the compiler they won't get any of the glory that they expect and that has been in almos

Re: [petsc-dev] error with flags PETSc uses for determining AVX

2021-02-13 Thread Jed Brown
Use -march=native or similar. The default target is basic x86_64, which has only SSE2. Barry Smith writes: > PETSc source has code like defined(__AVX2__) in the source but it does not > seem to be able to find any of these macros (icc or gcc) on the petsc-02 > system > > Are these macros supp

[petsc-dev] error with flags PETSc uses for determining AVX

2021-02-13 Thread Barry Smith
PETSc source has code like defined(__AVX2__) in the source but it does not seem to be able to find any of these macros (icc or gcc) on the petsc-02 system Are these macros supposed to be defined? How does on get them to be defined? Why are they not define? What am I doing wrong? Keep reading $