summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py
blob: 3c56f9c1496186fba2763af7e2e0b8a198032884 (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
# 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)

import glob
import subprocess
from os import path

from spack import *


releases = {'2021.1':
            {'irc_id': '17427', 'build': '2684'}}


class IntelOneapiCompilers(IntelOneApiPackage):
    """Intel oneAPI compilers.

    Contains icc, icpc, icx, icpx, dpcpp, ifort, ifx.

    """

    maintainers = ['rscohn2']

    homepage = 'https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/dpc-compiler.html'

    version('2021.1', sha256='666b1002de3eab4b6f3770c42bcf708743ac74efeba4c05b0834095ef27a11b9', expand=False)

    depends_on('patchelf', type='build')

    def __init__(self, spec):
        self.component_info(
            dir_name='compiler',
            components=('intel.oneapi.lin.dpcpp-cpp-compiler-pro'
                        ':intel.oneapi.lin.ifort-compiler'),
            releases=releases,
            url_name='HPCKit')
        super(IntelOneapiCompilers, self).__init__(spec)

    def install(self, spec, prefix):
        super(IntelOneapiCompilers, self).install(spec, prefix)
        # For quick turnaround debugging, copy instead of install
        # copytree('/opt/intel/oneapi/compiler', path.join(prefix, 'compiler'),
        #          symlinks=True)
        rpath_dirs = ['lib',
                      'lib/x64',
                      'lib/emu',
                      'lib/oclfpga/host/linux64/lib',
                      'lib/oclfpga/linux64/lib',
                      'compiler/lib/intel64_lin',
                      'compiler/lib']
        patch_dirs = ['compiler/lib/intel64_lin',
                      'compiler/lib/intel64',
                      'bin']
        eprefix = path.join(prefix, 'compiler', 'latest', 'linux')
        rpath = ':'.join([path.join(eprefix, c) for c in rpath_dirs])
        for pd in patch_dirs:
            for file in glob.glob(path.join(eprefix, pd, '*')):
                # Try to patch all files, patchelf will do nothing if
                # file should not be patched
                subprocess.call(['patchelf', '--set-rpath', rpath, file])