xref: /petsc/config/examples/arch-cray-xc40-knl-opt.py (revision 7b5fd022a6ba26727040df7457b27566b4c6742d)
1df3bd252SSatish Balay#!/usr/bin/env python3
23edb0b5bSRichard Tran Mills
33edb0b5bSRichard Tran Mills# Example configure script for Cray XC-series systems with Intel "Knights
43edb0b5bSRichard Tran Mills# Landing" (KNL) processors.
53edb0b5bSRichard Tran Mills# This script was constructed for and tested on the Cori XC40 system, but
63edb0b5bSRichard Tran Mills# should work (or be easily modified to do so) on other Cray XC-series systems.
73edb0b5bSRichard Tran Mills
83edb0b5bSRichard Tran Millsif __name__ == '__main__':
93edb0b5bSRichard Tran Mills  import os
103edb0b5bSRichard Tran Mills  import sys
113edb0b5bSRichard Tran Mills  sys.path.insert(0, os.path.abspath('config'))
123edb0b5bSRichard Tran Mills  import configure
133edb0b5bSRichard Tran Mills  configure_options = [
143edb0b5bSRichard Tran Mills    # We use the Cray compiler wrappers below, regardless of what underlying
153edb0b5bSRichard Tran Mills    # compilers we are actually using.
163edb0b5bSRichard Tran Mills    '--with-cc=cc',
173edb0b5bSRichard Tran Mills    '--with-cxx=CC',
183edb0b5bSRichard Tran Mills    '--with-fc=ftn',
193edb0b5bSRichard Tran Mills
203edb0b5bSRichard Tran Mills    # Cray supports the use of Intel, Cray, or GCC compilers.
213edb0b5bSRichard Tran Mills    # Make sure that the correct programming environment module is loaded,
22*d5b43468SJose E. Roman    # and then comment/uncomment the appropriate stanzas below.
233edb0b5bSRichard Tran Mills
243edb0b5bSRichard Tran Mills    # Flags for the Intel compilers:
256d811058SRichard Tran Mills    # NOTE: For versions of the Intel compiler < 18.x, one may need to specify
266d811058SRichard Tran Mills    # the undocumented compiler option '-mP2OPT_hpo_vec_remainder=F', which
276d811058SRichard Tran Mills    # disables generation of vectorized remainder loops; this works around
286d811058SRichard Tran Mills    # some incorrect code generation. This option should NOT be used with later
296d811058SRichard Tran Mills    # compiler versions -- it is detrimental to performance, and the behavior
306d811058SRichard Tran Mills    # may change without warning because this is an undocumented option.
316d811058SRichard Tran Mills    '--COPTFLAGS=-g -xMIC-AVX512 -O3',
326d811058SRichard Tran Mills    '--CXXOPTFLAGS=-g -xMIC-AVX512 -O3',
336d811058SRichard Tran Mills    '--FOPTFLAGS=-g -xMIC-AVX512 -O3',
343edb0b5bSRichard Tran Mills    # Use  BLAS and LAPACK provided by Intel MKL.
353edb0b5bSRichard Tran Mills    # (Below only works when PrgEnv-intel is loaded; it is possible, but not
366aad120cSJose E. Roman    # straightforward, to use MKL on Cray systems with non-Intel compilers.)
373edb0b5bSRichard Tran Mills    # If Cray libsci is preferred, comment out the line below.
383edb0b5bSRichard Tran Mills    '--with-blaslapack-lib=-mkl -L' + os.environ['MKLROOT'] + '/lib/intel64',
39ef4c6e81SRichard Tran Mills    # Prefer hand-coded kernels using AVX-512 intrinsics when available.
40ef4c6e81SRichard Tran Mills    '--with-avx512-kernels=1',
413edb0b5bSRichard Tran Mills
423edb0b5bSRichard Tran Mills    # Flags for the Cray compilers:
433edb0b5bSRichard Tran Mills#    '--COPTFLAGS=-g -hcpu=mic-knl'
443edb0b5bSRichard Tran Mills#    '--CXXOPTFLAGS=-g -hcpu=mic-knl'
453edb0b5bSRichard Tran Mills#    '--FOPTFLAGS=-g -hcpu=mic-knl'
463edb0b5bSRichard Tran Mills
473edb0b5bSRichard Tran Mills    # Flags for the GCC compilers:
483edb0b5bSRichard Tran Mills#    '--COPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf',
493edb0b5bSRichard Tran Mills#    '--CXXOPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf',
503edb0b5bSRichard Tran Mills#    '--FOPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf',
513edb0b5bSRichard Tran Mills
523edb0b5bSRichard Tran Mills    '--with-debugging=no',
533edb0b5bSRichard Tran Mills    '--with-memalign=64',
549da85933SRichard Tran Mills    '--with-mpiexec=srun', # Some systems (e.g., ALCF Theta) use '--with-mpiexec=aprun' instead.
553edb0b5bSRichard Tran Mills    '--known-mpi-shared-libraries=1',
563edb0b5bSRichard Tran Mills    '--with-clib-autodetect=0',
573edb0b5bSRichard Tran Mills    '--with-fortranlib-autodetect=0',
583edb0b5bSRichard Tran Mills    '--with-cxxlib-autodetect=0',
593edb0b5bSRichard Tran Mills    '--LIBS=-lstdc++',
603edb0b5bSRichard Tran Mills    '--LDFLAGS=-dynamic', # Needed if wish to use dynamic shared libraries.
613edb0b5bSRichard Tran Mills
623edb0b5bSRichard Tran Mills    # Below "--known-" options are from the "reconfigure.py" script generated
63*d5b43468SJose E. Roman    # after an initial configure.py run using '--with-batch'.
643edb0b5bSRichard Tran Mills    '--known-level1-dcache-size=32768',
653edb0b5bSRichard Tran Mills    '--known-level1-dcache-linesize=64',
663edb0b5bSRichard Tran Mills    '--known-level1-dcache-assoc=8',
673edb0b5bSRichard Tran Mills    '--known-sdot-returns-double=0',
683edb0b5bSRichard Tran Mills    '--known-snrm2-returns-double=0',
693edb0b5bSRichard Tran Mills    '--known-has-attribute-aligned=1',
7034985b15SBarry Smith    '--known-64-bit-blas-indices=0',
713edb0b5bSRichard Tran Mills    '--with-batch=1',
723edb0b5bSRichard Tran Mills  ]
733edb0b5bSRichard Tran Mills  configure.petsc_configure(configure_options)
74