# IT4Innovations
# LK 2023

name = 'ELPA'
version = '2022.05.001'

homepage = 'https://elpa.mpcdf.mpg.de/'
description = """Eigenvalue SoLvers for Petaflop-Applications."""

toolchain = {'name': 'intel', 'version': '2022b'}
toolchainopts = {'openmp': True, 'usempi': True}

source_urls = ['https://gitlab.mpcdf.mpg.de/elpa/elpa/-/archive/new_release_%(version)s/']
sources = ['elpa-new_release_%(version)s.tar.gz']
#patches = ['%(name)s-%(version)s_fix_hardcoded_perl_path.patch']
checksums = [
    {'elpa-new_release_2022.05.001.tar.gz': '96ff14abe53cc3652ba290a0e309d238147fbbfe054d783efee9890f5f23802d'},
#    {'ELPA-2022.05.001_fix_hardcoded_perl_path.patch':
#     '1666a133393b3947a80069ae170a51f4d574956f384c01b7018e4b551726a3a2'},
]

builddependencies = [
    ('Autotools', '20220317'),
    # remove_xcompiler script requires 'python' command,
#    ('Python', '3.10.8'),
#    ('Perl', '5.36.0'),
]

preconfigopts = './autogen.sh && '
preconfigopts += 'export LDFLAGS="-lm $LDFLAGS" && '
preconfigopts += 'autoreconf && '
preconfigopts = "export FC='mpiifort' && "
preconfigopts += "export CC='mpicc' && "
preconfigopts += 'export FCFLAGS="-O3 -xAVX2" && '
preconfigopts += 'export CFLAGS="-O3 -march=native -mavx2 -mfma -funsafe-loop-optimizations -funsafe-math-optimizations -ftree-vect-loop-version -ftree-vectorize" && '
preconfigopts += 'export SCALAPACK_LDFLAG=S"-L$MKLROOT/lib/intel64 -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lmkl_blacs_intelmpi_lp64 -lpthread " && '
preconfigopts += 'export SCALAPACK_FCFLAGS="-I$MKL_HOME/include/intel64/lp64" && '

maxparallel = 1

moduleclass = 'math'
