summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/pastix/package.py
blob: 63ad654b93b8da8e85888c896933236af1408bfd (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Copyright 2013-2022 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)


class Pastix(CMakePackage, CudaPackage):
    """a high performance parallel solver for very large sparse linear systems
       based on direct methods"""
    homepage = "https://gitlab.inria.fr/solverstack/pastix/blob/master/README.md"
    url      = "https://gitlab.inria.fr/solverstack/pastix/uploads/baa57033d98378e0f3affbf45900fb6e/pastix-6.2.1.tar.gz"
    git      = "https://gitlab.inria.fr/solverstack/pastix.git"
    maintainers = ['fpruvost', 'mfaverge', 'ramet']

    version('master', branch='master', submodules=True)
    version('6.2.1', '50742cc0e6e03728f7529fc607d5c65b9e14205f192947678d6103a872a6210c')

    # cmake's specific
    variant('shared', default=True, description='Build Pastix as a shared library')

    # pastix's specific
    variant('doc', default=False, description='Enable documentation')
    variant('int64', default=False, description='To use 64 bits integers')
    variant('metis', default=False, description='Enable Metis')
    variant('scotch', default=True, description='Enable Scotch')
    variant(
        'runtime', default='none', description='Runtime support',
        values=('none', 'starpu'), multi=False
    )
    variant('cuda', default=False, when='runtime=starpu', description='Enable CUDA')
    variant('mpi', default=False, description='Enable MPI')

    # Dependencies
    depends_on("pkgconfig", type='build')
    depends_on("hwloc")
    depends_on("lapack")
    # ensure openblas use threads=openmp to be thread-safe
    depends_on('openblas threads=openmp', when='^openblas')
    with when("+metis"):
        depends_on("metis@5.1:")
        depends_on("metis@5.1:+int64", when='+int64')
    with when("+scotch"):
        depends_on("scotch~metis")
        depends_on("scotch~metis+int64", when='+int64')
        depends_on("scotch~metis~mpi", when='~mpi')
    with when("runtime=starpu"):
        depends_on("starpu")
        depends_on("starpu~mpi", when='~mpi')
        depends_on("starpu+mpi", when='+mpi')
        depends_on("starpu~cuda", when='~cuda')
        depends_on("starpu+cuda", when='+cuda')
        depends_on("cuda", when='+cuda')
    depends_on("mpi", when='+mpi')

    def cmake_args(self):
        spec = self.spec

        args = [
            "-Wno-dev",
            self.define("CMAKE_COLOR_MAKEFILE", "ON"),
            self.define("CMAKE_VERBOSE_MAKEFILE", "ON"),
            self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
            self.define_from_variant("PASTIX_INT64", "int64"),
            self.define_from_variant("PASTIX_ORDERING_METIS", "metis"),
            self.define_from_variant("PASTIX_ORDERING_SCOTCH", "scotch"),
            self.define("PASTIX_WITH_PARSEC", "OFF"),
            self.define_from_variant("PASTIX_WITH_MPI", "mpi")
        ]

        if spec.satisfies('runtime=starpu'):
            args.extend([self.define("PASTIX_WITH_STARPU", "ON")])
            args.extend([self.define_from_variant("PASTIX_WITH_CUDA", "cuda")])

        if ('^intel-mkl' in spec or '^intel-parallel-studio+mkl' in spec):
            args.extend([self.define("BLA_VENDOR", "Intel10_64lp_seq")])
        elif ('^netlib-lapack' in spec):
            args.extend([self.define("BLA_VENDOR", "Generic")])
        elif ('^openblas' in spec):
            args.extend([self.define("BLA_VENDOR", "OpenBLAS")])

        if spec.satisfies('+mpi'):
            args.extend([
                self.define("MPI_C_COMPILER", self.spec['mpi'].mpicc),
                self.define("MPI_CXX_COMPILER", self.spec['mpi'].mpicxx),
                self.define("MPI_Fortran_COMPILER", self.spec['mpi'].mpifc)
            ])

        return args