xref: /petsc/config/examples/arch-cray-xc40-knl-opt.py (revision 7b5fd022a6ba26727040df7457b27566b4c6742d)
1#!/usr/bin/env python3
2
3# Example configure script for Cray XC-series systems with Intel "Knights
4# Landing" (KNL) processors.
5# This script was constructed for and tested on the Cori XC40 system, but
6# should work (or be easily modified to do so) on other Cray XC-series systems.
7
8if __name__ == '__main__':
9  import os
10  import sys
11  sys.path.insert(0, os.path.abspath('config'))
12  import configure
13  configure_options = [
14    # We use the Cray compiler wrappers below, regardless of what underlying
15    # compilers we are actually using.
16    '--with-cc=cc',
17    '--with-cxx=CC',
18    '--with-fc=ftn',
19
20    # Cray supports the use of Intel, Cray, or GCC compilers.
21    # Make sure that the correct programming environment module is loaded,
22    # and then comment/uncomment the appropriate stanzas below.
23
24    # Flags for the Intel compilers:
25    # NOTE: For versions of the Intel compiler < 18.x, one may need to specify
26    # the undocumented compiler option '-mP2OPT_hpo_vec_remainder=F', which
27    # disables generation of vectorized remainder loops; this works around
28    # some incorrect code generation. This option should NOT be used with later
29    # compiler versions -- it is detrimental to performance, and the behavior
30    # may change without warning because this is an undocumented option.
31    '--COPTFLAGS=-g -xMIC-AVX512 -O3',
32    '--CXXOPTFLAGS=-g -xMIC-AVX512 -O3',
33    '--FOPTFLAGS=-g -xMIC-AVX512 -O3',
34    # Use  BLAS and LAPACK provided by Intel MKL.
35    # (Below only works when PrgEnv-intel is loaded; it is possible, but not
36    # straightforward, to use MKL on Cray systems with non-Intel compilers.)
37    # If Cray libsci is preferred, comment out the line below.
38    '--with-blaslapack-lib=-mkl -L' + os.environ['MKLROOT'] + '/lib/intel64',
39    # Prefer hand-coded kernels using AVX-512 intrinsics when available.
40    '--with-avx512-kernels=1',
41
42    # Flags for the Cray compilers:
43#    '--COPTFLAGS=-g -hcpu=mic-knl'
44#    '--CXXOPTFLAGS=-g -hcpu=mic-knl'
45#    '--FOPTFLAGS=-g -hcpu=mic-knl'
46
47    # Flags for the GCC compilers:
48#    '--COPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf',
49#    '--CXXOPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf',
50#    '--FOPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf',
51
52    '--with-debugging=no',
53    '--with-memalign=64',
54    '--with-mpiexec=srun', # Some systems (e.g., ALCF Theta) use '--with-mpiexec=aprun' instead.
55    '--known-mpi-shared-libraries=1',
56    '--with-clib-autodetect=0',
57    '--with-fortranlib-autodetect=0',
58    '--with-cxxlib-autodetect=0',
59    '--LIBS=-lstdc++',
60    '--LDFLAGS=-dynamic', # Needed if wish to use dynamic shared libraries.
61
62    # Below "--known-" options are from the "reconfigure.py" script generated
63    # after an initial configure.py run using '--with-batch'.
64    '--known-level1-dcache-size=32768',
65    '--known-level1-dcache-linesize=64',
66    '--known-level1-dcache-assoc=8',
67    '--known-sdot-returns-double=0',
68    '--known-snrm2-returns-double=0',
69    '--known-has-attribute-aligned=1',
70    '--known-64-bit-blas-indices=0',
71    '--with-batch=1',
72  ]
73  configure.petsc_configure(configure_options)
74