# IT4Innovations 2020
# LK

easyblock = "ConfigureMake"

name = 'magma'
version = '2.5.3'

homepage = 'http://icl.cs.utk.edu/magma/'
description = """The MAGMA project aims to develop a dense linear algebra library similar to
 LAPACK but for heterogeneous/hybrid architectures, starting with current Multicore+GPU systems."""

toolchain = {'name': 'foss', 'version': '2018a'}
toolchainopts = {'pic': True, 'openmp': True}

source_urls = ['http://icl.cs.utk.edu/projectsfiles/magma/downloads/']
sources = [SOURCE_TAR_GZ]
patches = [('%(name)s-2.5.0-fix-makefile.patch')]

dependencies = [
    ('CUDA', '10.2.89', '', True),
]

skipsteps = ['configure']

prebuildopts = 'touch make.inc && '
# magma 2.5.0 does not build on sm_30 - so remove Kepler and specify sm_35
# http://icl.cs.utk.edu/magma/forum/viewtopic.php?f=2&t=1906&sid=7048fadfd48a0d00c3c4294ddef6a096
prebuildopts += 'GPU_TARGET="sm_35 Maxwell Pascal Volta" '

installopts = 'prefix=%(installdir)s'

sanity_check_paths = {
    'files': ['lib/libmagma.so', 'lib/libmagma.a'],
    'dirs': ['include'],
}

moduleclass = 'math'
