summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/amdblis/package.py
blob: 7e3ebba99f01fd9275747f077a92d6972bf15bb6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.pkg.builtin.blis import BlisBase


class Amdblis(BlisBase):
    """AMD Optimized BLIS.

    BLIS is a portable software framework for instantiating high-performance
    BLAS-like dense linear algebra libraries. The framework was designed to
    isolate essential kernels of computation that, when optimized, immediately
    enable optimized implementations of most of its commonly used and
    computationally intensive operations.
    """

    _name = 'amdblis'
    homepage = "https://developer.amd.com/amd-aocl/blas-library/"
    url = "https://github.com/amd/blis/archive/3.0.tar.gz"
    git = "https://github.com/amd/blis.git"

    maintainers = ['amd-toolchain-support']

    version('3.1', sha256='2891948925b9db99eec02a1917d9887a7bee9ad2afc5421c9ba58602a620f2bf')
    version('3.0.1', sha256='dff643e6ef946846e91e8f81b75ff8fe21f1f2d227599aecd654d184d9beff3e')
    version('3.0', sha256='ac848c040cd6c3550fe49148dbdf109216cad72d3235763ee7ee8134e1528517')
    version('2.2', sha256='e1feb60ac919cf6d233c43c424f6a8a11eab2c62c2c6e3f2652c15ee9063c0c9')

    variant(
        'ilp64',
        default=False,
        description='Build with ILP64 support')

    conflicts(
        '+ilp64',
        when='@:3.0.0',
        msg='ilp64 is supported from amdblis 3.0.1 version onwards')

    def configure_args(self):
        spec = self.spec
        args = super(Amdblis, self).configure_args()

        if spec.satisfies('+ilp64'):
            args.append('--blas-int-size=64')

        """ To enable Fortran to C calling convention for
        complex types when compiling with aocc flang"""
        if self.spec.satisfies("@3.0 %aocc"):
            args.append('CFLAGS={0}'.format("-DAOCL_F2C"))
            args.append('CXXFLAGS={0}'.format("-DAOCL_F2C"))
        elif self.spec.satisfies("@3.0.1: %aocc"):
            args.append('--complex-return=intel')

        if self.spec.satisfies("@3.1:"):
            args.append('--disable-aocl-dynamic')

        return args

    def configure(self, spec, prefix):
        config_args = self.configure_args()

        # "amdzen" - A fat binary or multiarchitecture binary
        # support for 3.1 release onwards
        if self.spec.satisfies("@3.1:"):
            config_args.append("amdzen")
        else:
            config_args.append("auto")

        configure("--prefix=" + prefix,
                  *config_args)