xref: /petsc/config/examples/arch-cray-xc40-knl-opt.py (revision 3edb0b5bec17ce51581242f6b19c5facd9c2a6b4)
1*3edb0b5bSRichard Tran Mills#!/usr/bin/python
2*3edb0b5bSRichard Tran Mills
3*3edb0b5bSRichard Tran Mills# Example configure script for Cray XC-series systems with Intel "Knights
4*3edb0b5bSRichard Tran Mills# Landing" (KNL) processors.
5*3edb0b5bSRichard Tran Mills# This script was constructed for and tested on the Cori XC40 system, but
6*3edb0b5bSRichard Tran Mills# should work (or be easily modified to do so) on other Cray XC-series systems.
7*3edb0b5bSRichard Tran Mills
8*3edb0b5bSRichard Tran Millsif __name__ == '__main__':
9*3edb0b5bSRichard Tran Mills  import os
10*3edb0b5bSRichard Tran Mills  import sys
11*3edb0b5bSRichard Tran Mills  sys.path.insert(0, os.path.abspath('config'))
12*3edb0b5bSRichard Tran Mills  import configure
13*3edb0b5bSRichard Tran Mills  configure_options = [
14*3edb0b5bSRichard Tran Mills    # We use the Cray compiler wrappers below, regardless of what underlying
15*3edb0b5bSRichard Tran Mills    # compilers we are actually using.
16*3edb0b5bSRichard Tran Mills    '--with-cc=cc',
17*3edb0b5bSRichard Tran Mills    '--with-cxx=CC',
18*3edb0b5bSRichard Tran Mills    '--with-fc=ftn',
19*3edb0b5bSRichard Tran Mills
20*3edb0b5bSRichard Tran Mills    # Cray supports the use of Intel, Cray, or GCC compilers.
21*3edb0b5bSRichard Tran Mills    # Make sure that the correct programming environment module is loaded,
22*3edb0b5bSRichard Tran Mills    # and then comment/uncomment the apprpriate stanzas below.
23*3edb0b5bSRichard Tran Mills
24*3edb0b5bSRichard Tran Mills    # Flags for the Intel compilers:
25*3edb0b5bSRichard Tran Mills    # NOTE: We are specifying the undocumented compiler option
26*3edb0b5bSRichard Tran Mills    # '-mP2OPT_hpo_vec_remainder=F', which disables generation of vectorized
27*3edb0b5bSRichard Tran Mills    # remainder loops; this works around some incorrect code generation in the
28*3edb0b5bSRichard Tran Mills    # Intel compiler version 17.0, up to and including version 17.0.4
29*3edb0b5bSRichard Tran Mills    # This option has not been tested, and should NOT be used, with later
30*3edb0b5bSRichard Tran Mills    # compiler versions -- the behavior may change without warning between
31*3edb0b5bSRichard Tran Mills    # versions. It is anticipated that the code generation issue will be fixed
32*3edb0b5bSRichard Tran Mills    # in the version 18 compiler at release
33*3edb0b5bSRichard Tran Mills    '--COPTFLAGS=-g -xMIC-AVX512 -O3 -mP2OPT_hpo_vec_remainder=F',
34*3edb0b5bSRichard Tran Mills    '--CXXOPTFLAGS=-g -xMIC-AVX512 -O3 -mP2OPT_hpo_vec_remainder=F',
35*3edb0b5bSRichard Tran Mills    '--FOPTFLAGS=-g -xMIC-AVX512 -O3 -mP2OPT_hpo_vec_remainder=F',
36*3edb0b5bSRichard Tran Mills    # Use  BLAS and LAPACK provided by Intel MKL.
37*3edb0b5bSRichard Tran Mills    # (Below only works when PrgEnv-intel is loaded; it is possible, but not
38*3edb0b5bSRichard Tran Mills    # straightfoward, to use MKL on Cray systems with non-Intel compilers.)
39*3edb0b5bSRichard Tran Mills    # If Cray libsci is preferred, comment out the line below.
40*3edb0b5bSRichard Tran Mills    '--with-blaslapack-lib=-mkl -L' + os.environ['MKLROOT'] + '/lib/intel64',
41*3edb0b5bSRichard Tran Mills
42*3edb0b5bSRichard Tran Mills    # Flags for the Cray compilers:
43*3edb0b5bSRichard Tran Mills#    '--COPTFLAGS=-g -hcpu=mic-knl'
44*3edb0b5bSRichard Tran Mills#    '--CXXOPTFLAGS=-g -hcpu=mic-knl'
45*3edb0b5bSRichard Tran Mills#    '--FOPTFLAGS=-g -hcpu=mic-knl'
46*3edb0b5bSRichard Tran Mills
47*3edb0b5bSRichard Tran Mills    # Flags for the GCC compilers:
48*3edb0b5bSRichard Tran Mills#    '--COPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf',
49*3edb0b5bSRichard Tran Mills#    '--CXXOPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf',
50*3edb0b5bSRichard Tran Mills#    '--FOPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf',
51*3edb0b5bSRichard Tran Mills
52*3edb0b5bSRichard Tran Mills    '--with-debugging=no',
53*3edb0b5bSRichard Tran Mills    '--with-memalign=64',
54*3edb0b5bSRichard Tran Mills    '--with-mpiexec=srun',
55*3edb0b5bSRichard Tran Mills    '--known-mpi-shared-libraries=1',
56*3edb0b5bSRichard Tran Mills    '--with-clib-autodetect=0',
57*3edb0b5bSRichard Tran Mills    '--with-fortranlib-autodetect=0',
58*3edb0b5bSRichard Tran Mills    '--with-cxxlib-autodetect=0',
59*3edb0b5bSRichard Tran Mills    '--LIBS=-lstdc++',
60*3edb0b5bSRichard Tran Mills    '--LDFLAGS=-dynamic', # Needed if wish to use dynamic shared libraries.
61*3edb0b5bSRichard Tran Mills
62*3edb0b5bSRichard Tran Mills    # Below "--known-" options are from the "reconfigure.py" script generated
63*3edb0b5bSRichard Tran Mills    # after an intial configure.py run using '--with-batch'.
64*3edb0b5bSRichard Tran Mills    '--known-level1-dcache-size=32768',
65*3edb0b5bSRichard Tran Mills    '--known-level1-dcache-linesize=64',
66*3edb0b5bSRichard Tran Mills    '--known-level1-dcache-assoc=8',
67*3edb0b5bSRichard Tran Mills    '--known-sizeof-char=1',
68*3edb0b5bSRichard Tran Mills    '--known-sizeof-void-p=8',
69*3edb0b5bSRichard Tran Mills    '--known-sizeof-short=2',
70*3edb0b5bSRichard Tran Mills    '--known-sizeof-int=4',
71*3edb0b5bSRichard Tran Mills    '--known-sizeof-long=8',
72*3edb0b5bSRichard Tran Mills    '--known-sizeof-long-long=8',
73*3edb0b5bSRichard Tran Mills    '--known-sizeof-float=4',
74*3edb0b5bSRichard Tran Mills    '--known-sizeof-double=8',
75*3edb0b5bSRichard Tran Mills    '--known-sizeof-size_t=8',
76*3edb0b5bSRichard Tran Mills    '--known-bits-per-byte=8',
77*3edb0b5bSRichard Tran Mills    '--known-memcmp-ok=1',
78*3edb0b5bSRichard Tran Mills    '--known-sizeof-MPI_Comm=4',
79*3edb0b5bSRichard Tran Mills    '--known-sizeof-MPI_Fint=4',
80*3edb0b5bSRichard Tran Mills    '--known-mpi-long-double=1',
81*3edb0b5bSRichard Tran Mills    '--known-mpi-int64_t=1',
82*3edb0b5bSRichard Tran Mills    '--known-mpi-c-double-complex=1',
83*3edb0b5bSRichard Tran Mills    '--known-sdot-returns-double=0',
84*3edb0b5bSRichard Tran Mills    '--known-snrm2-returns-double=0',
85*3edb0b5bSRichard Tran Mills    '--known-has-attribute-aligned=1',
86*3edb0b5bSRichard Tran Mills    '--with-batch=1',
87*3edb0b5bSRichard Tran Mills  ]
88*3edb0b5bSRichard Tran Mills  configure.petsc_configure(configure_options)
89