2021-01-02 15:10:28 +08:00
|
|
|
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
|
2020-12-24 07:39:40 +08:00
|
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
|
|
|
|
import glob
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
from spack import *
|
|
|
|
|
|
|
|
|
2021-01-06 01:37:46 +08:00
|
|
|
releases = {'2021.1.0':
|
2020-12-24 07:39:40 +08:00
|
|
|
{'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'
|
|
|
|
|
2021-01-06 01:37:46 +08:00
|
|
|
version('2021.1.0', sha256='666b1002de3eab4b6f3770c42bcf708743ac74efeba4c05b0834095ef27a11b9', expand=False)
|
2020-12-24 07:39:40 +08:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2021-02-04 04:04:23 +08:00
|
|
|
def _join_prefix(self, path):
|
|
|
|
return join_path(self.prefix, 'compiler', 'latest', 'linux', path)
|
|
|
|
|
|
|
|
def _ld_library_path(self):
|
|
|
|
dirs = ['lib',
|
|
|
|
'lib/x64',
|
|
|
|
'lib/emu',
|
|
|
|
'lib/oclfpga/host/linux64/lib',
|
|
|
|
'lib/oclfpga/linux64/lib',
|
|
|
|
'compiler/lib/intel64_lin',
|
|
|
|
'compiler/lib']
|
|
|
|
for dir in dirs:
|
|
|
|
yield self._join_prefix(dir)
|
|
|
|
|
2020-12-24 07:39:40 +08:00
|
|
|
def install(self, spec, prefix):
|
2021-02-04 04:04:23 +08:00
|
|
|
# For quick turnaround debugging, comment out line below and
|
|
|
|
# use the copy instead
|
2020-12-24 07:39:40 +08:00
|
|
|
super(IntelOneapiCompilers, self).install(spec, prefix)
|
2021-02-04 04:04:23 +08:00
|
|
|
# Copy installed compiler instead of running the installer
|
|
|
|
# from shutil import copytree
|
|
|
|
# copytree('/opt/intel/oneapi/compiler', join_path(prefix, 'compiler'),
|
|
|
|
# symlinks=True)
|
|
|
|
|
|
|
|
rpath = ':'.join(self._ld_library_path())
|
2020-12-24 07:39:40 +08:00
|
|
|
patch_dirs = ['compiler/lib/intel64_lin',
|
|
|
|
'compiler/lib/intel64',
|
|
|
|
'bin']
|
|
|
|
for pd in patch_dirs:
|
2021-02-04 04:04:23 +08:00
|
|
|
for file in glob.glob(self._join_prefix(join_path(pd, '*'))):
|
2020-12-24 07:39:40 +08:00
|
|
|
# Try to patch all files, patchelf will do nothing if
|
|
|
|
# file should not be patched
|
|
|
|
subprocess.call(['patchelf', '--set-rpath', rpath, file])
|
2021-01-07 02:45:42 +08:00
|
|
|
|
|
|
|
def setup_run_environment(self, env):
|
2021-02-04 04:04:23 +08:00
|
|
|
env.prepend_path('PATH', self._join_prefix('bin'))
|
|
|
|
env.prepend_path('CPATH', self._join_prefix('include'))
|
|
|
|
env.prepend_path('LIBRARY_PATH', self._join_prefix('lib'))
|
|
|
|
for dir in self._ld_library_path():
|
|
|
|
env.prepend_path('LD_LIBRARY_PATH', dir)
|
|
|
|
env.set('CC', self._join_prefix('bin/icx'))
|
|
|
|
env.set('CXX', self._join_prefix('bin/icpx'))
|
|
|
|
env.set('FC', self._join_prefix('bin/ifx'))
|
2021-02-04 08:21:54 +08:00
|
|
|
# Set these so that MPI wrappers will pick up these compilers
|
|
|
|
# when this module is loaded.
|
|
|
|
env.set('I_MPI_CC', 'icx')
|
|
|
|
env.set('I_MPI_CXX', 'icpx')
|
|
|
|
env.set('I_MPI_FC', 'ifx')
|