xref: /petsc/config/examples/arch-cray-xc40-knl-opt.py (revision 6d8110582b37b675d24ec4a8dae788c4104f5ee5)
13edb0b5bSRichard Tran Mills#!/usr/bin/python
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,
223edb0b5bSRichard Tran Mills    # and then comment/uncomment the apprpriate stanzas below.
233edb0b5bSRichard Tran Mills
243edb0b5bSRichard Tran Mills    # Flags for the Intel compilers:
25*6d811058SRichard Tran Mills    # NOTE: For versions of the Intel compiler < 18.x, one may need to specify
26*6d811058SRichard Tran Mills    # the undocumented compiler option '-mP2OPT_hpo_vec_remainder=F', which
27*6d811058SRichard Tran Mills    # disables generation of vectorized remainder loops; this works around
28*6d811058SRichard Tran Mills    # some incorrect code generation. This option should NOT be used with later
29*6d811058SRichard Tran Mills    # compiler versions -- it is detrimental to performance, and the behavior
30*6d811058SRichard Tran Mills    # may change without warning because this is an undocumented option.
31*6d811058SRichard Tran Mills    '--COPTFLAGS=-g -xMIC-AVX512 -O3',
32*6d811058SRichard Tran Mills    '--CXXOPTFLAGS=-g -xMIC-AVX512 -O3',
33*6d811058SRichard 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
363edb0b5bSRichard Tran Mills    # straightfoward, 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',
393edb0b5bSRichard Tran Mills
403edb0b5bSRichard Tran Mills    # Flags for the Cray compilers:
413edb0b5bSRichard Tran Mills#    '--COPTFLAGS=-g -hcpu=mic-knl'
423edb0b5bSRichard Tran Mills#    '--CXXOPTFLAGS=-g -hcpu=mic-knl'
433edb0b5bSRichard Tran Mills#    '--FOPTFLAGS=-g -hcpu=mic-knl'
443edb0b5bSRichard Tran Mills
453edb0b5bSRichard Tran Mills    # Flags for the GCC compilers:
463edb0b5bSRichard Tran Mills#    '--COPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf',
473edb0b5bSRichard Tran Mills#    '--CXXOPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf',
483edb0b5bSRichard Tran Mills#    '--FOPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf',
493edb0b5bSRichard Tran Mills
503edb0b5bSRichard Tran Mills    '--with-debugging=no',
513edb0b5bSRichard Tran Mills    '--with-memalign=64',
529da85933SRichard Tran Mills    '--with-mpiexec=srun', # Some systems (e.g., ALCF Theta) use '--with-mpiexec=aprun' instead.
533edb0b5bSRichard Tran Mills    '--known-mpi-shared-libraries=1',
543edb0b5bSRichard Tran Mills    '--with-clib-autodetect=0',
553edb0b5bSRichard Tran Mills    '--with-fortranlib-autodetect=0',
563edb0b5bSRichard Tran Mills    '--with-cxxlib-autodetect=0',
573edb0b5bSRichard Tran Mills    '--LIBS=-lstdc++',
583edb0b5bSRichard Tran Mills    '--LDFLAGS=-dynamic', # Needed if wish to use dynamic shared libraries.
593edb0b5bSRichard Tran Mills
603edb0b5bSRichard Tran Mills    # Below "--known-" options are from the "reconfigure.py" script generated
613edb0b5bSRichard Tran Mills    # after an intial configure.py run using '--with-batch'.
623edb0b5bSRichard Tran Mills    '--known-level1-dcache-size=32768',
633edb0b5bSRichard Tran Mills    '--known-level1-dcache-linesize=64',
643edb0b5bSRichard Tran Mills    '--known-level1-dcache-assoc=8',
653edb0b5bSRichard Tran Mills    '--known-sizeof-char=1',
663edb0b5bSRichard Tran Mills    '--known-sizeof-void-p=8',
673edb0b5bSRichard Tran Mills    '--known-sizeof-short=2',
683edb0b5bSRichard Tran Mills    '--known-sizeof-int=4',
693edb0b5bSRichard Tran Mills    '--known-sizeof-long=8',
703edb0b5bSRichard Tran Mills    '--known-sizeof-long-long=8',
713edb0b5bSRichard Tran Mills    '--known-sizeof-float=4',
723edb0b5bSRichard Tran Mills    '--known-sizeof-double=8',
733edb0b5bSRichard Tran Mills    '--known-sizeof-size_t=8',
743edb0b5bSRichard Tran Mills    '--known-bits-per-byte=8',
753edb0b5bSRichard Tran Mills    '--known-memcmp-ok=1',
763edb0b5bSRichard Tran Mills    '--known-sizeof-MPI_Comm=4',
773edb0b5bSRichard Tran Mills    '--known-sizeof-MPI_Fint=4',
783edb0b5bSRichard Tran Mills    '--known-mpi-long-double=1',
793edb0b5bSRichard Tran Mills    '--known-mpi-int64_t=1',
803edb0b5bSRichard Tran Mills    '--known-mpi-c-double-complex=1',
813edb0b5bSRichard Tran Mills    '--known-sdot-returns-double=0',
823edb0b5bSRichard Tran Mills    '--known-snrm2-returns-double=0',
833edb0b5bSRichard Tran Mills    '--known-has-attribute-aligned=1',
8434985b15SBarry Smith    '--known-snrm2-returns-double=0',
8534985b15SBarry Smith    '--known-sdot-returns-double=0',
8634985b15SBarry Smith    '--known-64-bit-blas-indices=0',
873edb0b5bSRichard Tran Mills    '--with-batch=1',
883edb0b5bSRichard Tran Mills  ]
893edb0b5bSRichard Tran Mills  configure.petsc_configure(configure_options)
90