summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/dmlc-core/package.py
blob: 93da95f932813de433ce77494cc4175cf9da2ae8 (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
# Copyright 2013-2018 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 import *


class DmlcCore(CMakePackage):
    """DMLC-Core is the backbone library to support all DMLC projects,
    offers the bricks to build efficient and scalable
    distributed machine learning libraries."""

    homepage = "https://github.com/dmlc/dmlc-core"
    git      = "https://github.com/dmlc/dmlc-core.git"

    version('master')
    version('20170508', commit='a6c5701219e635fea808d264aefc5b03c3aec314')

    variant('openmp', default=False, description='Enable OpenMP support')

    patch('cmake.patch')

    def patch(self):
        filter_file('export CC = gcc', '', 'make/config.mk', string=True)
        filter_file('export CXX = g++', '', 'make/config.mk', string=True)
        filter_file('export MPICXX = mpicxx', '',
                    'make/config.mk', string=True)
        filter_file(r'^USE_OPENMP\s*=.*',
                    'USE_OPENMP=%s' % ('1' if '+openmp' in self.spec else '0'),
                    'make/config.mk')

    def cmake_args(self):
        spec = self.spec
        return [
            '-DUSE_OPENMP=%s' % ('ON' if '+openmp' in spec else 'OFF'),
        ]