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: 253edb0b5bSRichard Tran Mills # NOTE: We are specifying the undocumented compiler option 263edb0b5bSRichard Tran Mills # '-mP2OPT_hpo_vec_remainder=F', which disables generation of vectorized 273edb0b5bSRichard Tran Mills # remainder loops; this works around some incorrect code generation in the 283edb0b5bSRichard Tran Mills # Intel compiler version 17.0, up to and including version 17.0.4 293edb0b5bSRichard Tran Mills # This option has not been tested, and should NOT be used, with later 303edb0b5bSRichard Tran Mills # compiler versions -- the behavior may change without warning between 313edb0b5bSRichard Tran Mills # versions. It is anticipated that the code generation issue will be fixed 3201ab9332SRichard Tran Mills # in the version 18 compiler at release. 333edb0b5bSRichard Tran Mills '--COPTFLAGS=-g -xMIC-AVX512 -O3 -mP2OPT_hpo_vec_remainder=F', 343edb0b5bSRichard Tran Mills '--CXXOPTFLAGS=-g -xMIC-AVX512 -O3 -mP2OPT_hpo_vec_remainder=F', 353edb0b5bSRichard Tran Mills '--FOPTFLAGS=-g -xMIC-AVX512 -O3 -mP2OPT_hpo_vec_remainder=F', 363edb0b5bSRichard Tran Mills # Use BLAS and LAPACK provided by Intel MKL. 373edb0b5bSRichard Tran Mills # (Below only works when PrgEnv-intel is loaded; it is possible, but not 383edb0b5bSRichard Tran Mills # straightfoward, to use MKL on Cray systems with non-Intel compilers.) 393edb0b5bSRichard Tran Mills # If Cray libsci is preferred, comment out the line below. 403edb0b5bSRichard Tran Mills '--with-blaslapack-lib=-mkl -L' + os.environ['MKLROOT'] + '/lib/intel64', 41*ef4c6e81SRichard Tran Mills # Prefer hand-coded kernels using AVX-512 intrinsics when available. 42*ef4c6e81SRichard Tran Mills '--with-avx512-kernels=1', 433edb0b5bSRichard Tran Mills 443edb0b5bSRichard Tran Mills # Flags for the Cray compilers: 453edb0b5bSRichard Tran Mills# '--COPTFLAGS=-g -hcpu=mic-knl' 463edb0b5bSRichard Tran Mills# '--CXXOPTFLAGS=-g -hcpu=mic-knl' 473edb0b5bSRichard Tran Mills# '--FOPTFLAGS=-g -hcpu=mic-knl' 483edb0b5bSRichard Tran Mills 493edb0b5bSRichard Tran Mills # Flags for the GCC compilers: 503edb0b5bSRichard Tran Mills# '--COPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf', 513edb0b5bSRichard Tran Mills# '--CXXOPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf', 523edb0b5bSRichard Tran Mills# '--FOPTFLAGS=-g -march=knl -O3 -mavx512f -mavx512cd -mavx512er -mavx512pf', 533edb0b5bSRichard Tran Mills 543edb0b5bSRichard Tran Mills '--with-debugging=no', 553edb0b5bSRichard Tran Mills '--with-memalign=64', 569da85933SRichard Tran Mills '--with-mpiexec=srun', # Some systems (e.g., ALCF Theta) use '--with-mpiexec=aprun' instead. 573edb0b5bSRichard Tran Mills '--known-mpi-shared-libraries=1', 583edb0b5bSRichard Tran Mills '--with-clib-autodetect=0', 593edb0b5bSRichard Tran Mills '--with-fortranlib-autodetect=0', 603edb0b5bSRichard Tran Mills '--with-cxxlib-autodetect=0', 613edb0b5bSRichard Tran Mills '--LIBS=-lstdc++', 623edb0b5bSRichard Tran Mills '--LDFLAGS=-dynamic', # Needed if wish to use dynamic shared libraries. 633edb0b5bSRichard Tran Mills 643edb0b5bSRichard Tran Mills # Below "--known-" options are from the "reconfigure.py" script generated 653edb0b5bSRichard Tran Mills # after an intial configure.py run using '--with-batch'. 663edb0b5bSRichard Tran Mills '--known-level1-dcache-size=32768', 673edb0b5bSRichard Tran Mills '--known-level1-dcache-linesize=64', 683edb0b5bSRichard Tran Mills '--known-level1-dcache-assoc=8', 693edb0b5bSRichard Tran Mills '--known-sizeof-char=1', 703edb0b5bSRichard Tran Mills '--known-sizeof-void-p=8', 713edb0b5bSRichard Tran Mills '--known-sizeof-short=2', 723edb0b5bSRichard Tran Mills '--known-sizeof-int=4', 733edb0b5bSRichard Tran Mills '--known-sizeof-long=8', 743edb0b5bSRichard Tran Mills '--known-sizeof-long-long=8', 753edb0b5bSRichard Tran Mills '--known-sizeof-float=4', 763edb0b5bSRichard Tran Mills '--known-sizeof-double=8', 773edb0b5bSRichard Tran Mills '--known-sizeof-size_t=8', 783edb0b5bSRichard Tran Mills '--known-bits-per-byte=8', 793edb0b5bSRichard Tran Mills '--known-memcmp-ok=1', 803edb0b5bSRichard Tran Mills '--known-sizeof-MPI_Comm=4', 813edb0b5bSRichard Tran Mills '--known-sizeof-MPI_Fint=4', 823edb0b5bSRichard Tran Mills '--known-mpi-long-double=1', 833edb0b5bSRichard Tran Mills '--known-mpi-int64_t=1', 843edb0b5bSRichard Tran Mills '--known-mpi-c-double-complex=1', 853edb0b5bSRichard Tran Mills '--known-sdot-returns-double=0', 863edb0b5bSRichard Tran Mills '--known-snrm2-returns-double=0', 873edb0b5bSRichard Tran Mills '--known-has-attribute-aligned=1', 8834985b15SBarry Smith '--known-snrm2-returns-double=0', 8934985b15SBarry Smith '--known-sdot-returns-double=0', 9034985b15SBarry Smith '--known-64-bit-blas-indices=0', 913edb0b5bSRichard Tran Mills '--with-batch=1', 923edb0b5bSRichard Tran Mills ] 933edb0b5bSRichard Tran Mills configure.petsc_configure(configure_options) 94