# IT4Innovations
# PH 2024

name = 'ELPA'
version = '2023.05.001'
versionsuffix = '-CUDA-12.1.1'

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

toolchain = {'name': 'foss', 'version': '2023a'}
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',
    '%(name)s-%(version)s_fix_AVX512_support.patch',
]
checksums = [
    {'%(namelower)s-new_release_%(version)s.tar.gz':
     '7e07ca287ab07c0a73d97df71d5a5431c847b8e4d5c759aae99e12672e6decf3'},
    {'%(name)s-%(version)s_fix_hardcoded_perl_path.patch':
     '0548105065777a2ed07dde306636251c4f96e555a801647564de37d1ddd7b0b5'},
    {'%(name)s-%(version)s_fix_AVX512_support.patch':
     'ecf08b64fe1da432a218040fa45d4ecfbb3269d58cb018b12da5a2d854bf96be'},
]

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

dependencies = [
    ('CUDA', '12.1.1', '', SYSTEM),
]
cuda_compute_capabilities = ['8.0']

preconfigopts = './autogen.sh && '
preconfigopts += 'export LDFLAGS="-lm $LDFLAGS" && '
preconfigopts += 'autoreconf && '

configopts = '--enable-nvidia-gpu '
configopts += '--with-nvidia-gpu-support-only '

# When building in parallel, the file test_setup_mpi.mod is sometimes
# used before it is built, leading to an error.  This must be a bug in
# the makefile affecting parallel builds.
maxparallel = 1

moduleclass = 'math'
