address flake8 issues
This commit is contained in:
parent
e9b71872a8
commit
e3cd0a67d0
5 changed files with 103 additions and 59 deletions
|
@ -1,8 +1,9 @@
|
|||
from spack import *
|
||||
import sys, os, re
|
||||
import os
|
||||
|
||||
from spack.pkg.builtin.intel import IntelInstaller
|
||||
|
||||
|
||||
class Daal(IntelInstaller):
|
||||
"""Intel Data Analytics Acceleration Library.
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
from spack import *
|
||||
import sys, os, re
|
||||
import os
|
||||
import re
|
||||
|
||||
from spack.pkg.builtin.intel import IntelInstaller, filter_pick, get_all_components
|
||||
|
||||
|
||||
class IntelParallelStudio(IntelInstaller):
|
||||
"""Intel Parallel Studio.
|
||||
|
||||
|
@ -14,25 +16,31 @@ class IntelParallelStudio(IntelInstaller):
|
|||
|
||||
# TODO: can also try the online installer (will download files on demand)
|
||||
version('composer.2016.2', '1133fb831312eb519f7da897fec223fa',
|
||||
url="file://%s/parallel_studio_xe_2016_composer_edition_update2.tgz" % os.getcwd())
|
||||
url="file://%s/parallel_studio_xe_2016_composer_edition_update2.tgz"
|
||||
% os.getcwd())
|
||||
version('professional.2016.2', '70be832f2d34c9bf596a5e99d5f2d832',
|
||||
url="file://%s/parallel_studio_xe_2016_update2.tgz" % os.getcwd())
|
||||
url="file://%s/parallel_studio_xe_2016_update2.tgz" % os.getcwd())
|
||||
version('cluster.2016.2', '70be832f2d34c9bf596a5e99d5f2d832',
|
||||
url="file://%s/parallel_studio_xe_2016_update2.tgz" % os.getcwd())
|
||||
url="file://%s/parallel_studio_xe_2016_update2.tgz" % os.getcwd())
|
||||
version('composer.2016.3', '3208eeabee951fc27579177b593cefe9',
|
||||
url="file://%s/parallel_studio_xe_2016_composer_edition_update3.tgz" % os.getcwd())
|
||||
url="file://%s/parallel_studio_xe_2016_composer_edition_update3.tgz"
|
||||
% os.getcwd())
|
||||
version('professional.2016.3', 'eda19bb0d0d19709197ede58f13443f3',
|
||||
url="file://%s/parallel_studio_xe_2016_update3.tgz" % os.getcwd())
|
||||
url="file://%s/parallel_studio_xe_2016_update3.tgz" % os.getcwd())
|
||||
version('cluster.2016.3', 'eda19bb0d0d19709197ede58f13443f3',
|
||||
url="file://%s/parallel_studio_xe_2016_update3.tgz" % os.getcwd())
|
||||
url="file://%s/parallel_studio_xe_2016_update3.tgz" % os.getcwd())
|
||||
|
||||
variant('rpath', default=True, description="Add rpath to .cfg files")
|
||||
variant('all', default=False, description="Install all files associated with the requested edition")
|
||||
variant('mpi', default=True, description="Install the Intel MPI library and ITAC tool")
|
||||
variant('all', default=False,
|
||||
description="Install all files associated with the requested edition")
|
||||
variant('mpi', default=True,
|
||||
description="Install the Intel MPI library and ITAC tool")
|
||||
variant('mkl', default=True, description="Install the Intel MKL library")
|
||||
variant('daal', default=True, description="Install the Intel DAAL libraries")
|
||||
variant('daal',
|
||||
default=True, description="Install the Intel DAAL libraries")
|
||||
variant('ipp', default=True, description="Install the Intel IPP libraries")
|
||||
variant('tools', default=True, description="Install the Intel Advisor, VTune Amplifier, and Inspector tools")
|
||||
variant('tools', default=True, description="""Install the Intel Advisor,\
|
||||
VTune Amplifier, and Inspector tools""")
|
||||
|
||||
provides('mpi', when='@cluster:+mpi')
|
||||
provides('mkl', when='+mkl')
|
||||
|
@ -41,23 +49,29 @@ class IntelParallelStudio(IntelInstaller):
|
|||
|
||||
def install(self, spec, prefix):
|
||||
|
||||
base_components = "ALL" # when in doubt, install everything
|
||||
base_components = "ALL" # when in doubt, install everything
|
||||
mpi_components = ""
|
||||
mkl_components = ""
|
||||
daal_components = ""
|
||||
ipp_components = ""
|
||||
tools_components = ""
|
||||
|
||||
if spec.satisfies('+all'):
|
||||
base_components = "ALL"
|
||||
else:
|
||||
all_components = get_all_components()
|
||||
base_components = filter_pick(all_components, re.compile('(comp|openmp|intel-tbb|icc|ifort|psxe|icsxe-pset)').search)
|
||||
mpi_components = filter_pick(all_components, re.compile('(icsxe|imb|mpi|itac|intel-tc|clck)').search)
|
||||
mkl_components = filter_pick(all_components, re.compile('(mkl)').search)
|
||||
daal_components = filter_pick(all_components, re.compile('(daal)').search)
|
||||
ipp_components = filter_pick(all_components, re.compile('(ipp)').search)
|
||||
tool_components = filter_pick(all_components, re.compile('(gdb|vtune|inspector|advisor)').search)
|
||||
base_components = filter_pick(all_components,
|
||||
re.compile('(comp|openmp|intel-tbb|icc|ifort|psxe|icsxe-pset)'
|
||||
).search)
|
||||
mpi_components = filter_pick(all_components,
|
||||
re.compile('(icsxe|imb|mpi|itac|intel-tc|clck)').search)
|
||||
mkl_components = filter_pick(all_components,
|
||||
re.compile('(mkl)').search)
|
||||
daal_components = filter_pick(all_components,
|
||||
re.compile('(daal)').search)
|
||||
ipp_components = filter_pick(all_components,
|
||||
re.compile('(ipp)').search)
|
||||
tool_components = filter_pick(all_components,
|
||||
re.compile('(gdb|vtune|inspector|advisor)').search)
|
||||
|
||||
components = base_components
|
||||
if not spec.satisfies('+all'):
|
||||
|
@ -69,32 +83,45 @@ def install(self, spec, prefix):
|
|||
components += daal_components
|
||||
if spec.satisfies('+ipp'):
|
||||
components += ipp_components
|
||||
if spec.satisfies('+tools') and (spec.satisfies('@cluster') or spec.satisfies('@professional')):
|
||||
if spec.satisfies('+tools') and (spec.satisfies('@cluster') or\
|
||||
spec.satisfies('@professional')):
|
||||
components += tool_components
|
||||
|
||||
self.intel_components = ';'.join(components)
|
||||
IntelInstaller.install(self, spec, prefix)
|
||||
|
||||
absbindir = os.path.dirname(os.path.realpath(os.path.join(self.prefix.bin, "icc")))
|
||||
abslibdir = os.path.dirname(os.path.realpath(os.path.join(self.prefix.lib, "intel64", "libimf.a")))
|
||||
absbindir = os.path.dirname(os.path.realpath(os.path.join(
|
||||
self.prefix.bin, "icc")))
|
||||
abslibdir = os.path.dirname(os.path.realpath(os.path.join
|
||||
(self.prefix.lib, "intel64", "libimf.a")))
|
||||
|
||||
relbindir = absbindir.strip(os.path.commonprefix([self.prefix, absbindir]))
|
||||
os.symlink(self.global_license_file, os.path.join(absbindir, "license.lic"))
|
||||
if spec.satisfies('+tools') and (spec.satisfies('@cluster') or spec.satisfies('@professional')):
|
||||
relbindir = absbindir.strip(os.path.commonprefix([self.prefix,
|
||||
absbindir]))
|
||||
os.symlink(self.global_license_file, os.path.join(absbindir,
|
||||
"license.lic"))
|
||||
if spec.satisfies('+tools') and (spec.satisfies('@cluster') or\
|
||||
spec.satisfies('@professional')):
|
||||
os.mkdir(os.path.join(self.prefix, "inspector_xe/licenses"))
|
||||
os.symlink(self.global_license_file, os.path.join(self.prefix, "inspector_xe/licenses", "license.lic"))
|
||||
os.symlink(self.global_license_file, os.path.join(
|
||||
self.prefix, "inspector_xe/licenses", "license.lic"))
|
||||
os.mkdir(os.path.join(self.prefix, "advisor_xe/licenses"))
|
||||
os.symlink(self.global_license_file, os.path.join(self.prefix, "advisor_xe/licenses", "license.lic"))
|
||||
os.symlink(self.global_license_file, os.path.join(
|
||||
self.prefix, "advisor_xe/licenses", "license.lic"))
|
||||
os.mkdir(os.path.join(self.prefix, "vtune_amplifier_xe/licenses"))
|
||||
os.symlink(self.global_license_file, os.path.join(self.prefix, "vtune_amplifier_xe/licenses", "license.lic"))
|
||||
os.symlink(self.global_license_file, os.path.join(
|
||||
self.prefix, "vtune_amplifier_xe/licenses", "license.lic"))
|
||||
|
||||
if (spec.satisfies('+all') or spec.satisfies('+mpi')) and spec.satisfies('@cluster'):
|
||||
os.symlink(self.global_license_file, os.path.join(self.prefix, "itac_latest", "license.lic"))
|
||||
if (spec.satisfies('+all') or spec.satisfies('+mpi')) and\
|
||||
spec.satisfies('@cluster'):
|
||||
os.symlink(self.global_license_file, os.path.join(
|
||||
self.prefix, "itac_latest", "license.lic"))
|
||||
|
||||
if spec.satisfies('+rpath'):
|
||||
for compiler_command in ["icc", "icpc", "ifort"]:
|
||||
cfgfilename = os.path.join(absbindir, "%s.cfg" %(compiler_command))
|
||||
cfgfilename = os.path.join(absbindir, "%s.cfg" %\
|
||||
compiler_command)
|
||||
with open(cfgfilename, "w") as f:
|
||||
f.write('-Xlinker -rpath -Xlinker %s\n' %(abslibdir))
|
||||
f.write('-Xlinker -rpath -Xlinker %s\n' % abslibdir)
|
||||
|
||||
os.symlink(os.path.join(self.prefix.man, "common", "man1"), os.path.join(self.prefix.man, "man1"))
|
||||
os.symlink(os.path.join(self.prefix.man, "common", "man1"),
|
||||
os.path.join(self.prefix.man, "man1"))
|
||||
|
|
|
@ -1,16 +1,22 @@
|
|||
from spack import *
|
||||
import sys, os, re
|
||||
import os
|
||||
import re
|
||||
|
||||
|
||||
def filter_pick(input_list, regex_filter):
|
||||
"""Returns the items in input_list that are found in the regex_filter"""
|
||||
return [l for l in input_list for m in (regex_filter(l),) if m]
|
||||
|
||||
|
||||
def unfilter_pick(input_list, regex_filter):
|
||||
"""Returns the items in input_list that are not found in the regex_filter"""
|
||||
"""Returns the items in input_list that are not found in the
|
||||
regex_filter"""
|
||||
return [l for l in input_list for m in (regex_filter(l),) if not m]
|
||||
|
||||
|
||||
def get_all_components():
|
||||
"""Returns a list of all the components associated with the downloaded Intel package"""
|
||||
"""Returns a list of all the components associated with the downloaded
|
||||
Intel package"""
|
||||
all_components = []
|
||||
with open("pset/mediaconfig.xml", "r") as f:
|
||||
lines = f.readlines()
|
||||
|
@ -20,6 +26,7 @@ def get_all_components():
|
|||
all_components.append(component)
|
||||
return all_components
|
||||
|
||||
|
||||
class IntelInstaller(Package):
|
||||
"""Base package containing common methods for installing Intel software"""
|
||||
|
||||
|
@ -29,7 +36,8 @@ class IntelInstaller(Package):
|
|||
license_comment = '#'
|
||||
license_files = ['Licenses/license.lic']
|
||||
license_vars = ['INTEL_LICENSE_FILE']
|
||||
license_url = 'https://software.intel.com/en-us/articles/intel-license-manager-faq'
|
||||
license_url = \
|
||||
'https://software.intel.com/en-us/articles/intel-license-manager-faq'
|
||||
|
||||
@property
|
||||
def global_license_file(self):
|
||||
|
@ -41,9 +49,12 @@ def global_license_file(self):
|
|||
|
||||
def install(self, spec, prefix):
|
||||
|
||||
# remove the installation DB, otherwise it will try to install into location of other Intel builds
|
||||
if os.path.exists(os.path.join(os.environ["HOME"], "intel", "intel_sdp_products.db")):
|
||||
os.remove(os.path.join(os.environ["HOME"], "intel", "intel_sdp_products.db"))
|
||||
# Remove the installation DB, otherwise it will try to install into
|
||||
# location of other Intel builds
|
||||
if os.path.exists(os.path.join(os.environ["HOME"], "intel",
|
||||
"intel_sdp_products.db")):
|
||||
os.remove(os.path.join(os.environ["HOME"], "intel",
|
||||
"intel_sdp_products.db"))
|
||||
|
||||
if not hasattr(self, "intel_prefix"):
|
||||
self.intel_prefix = self.prefix
|
||||
|
@ -58,6 +69,7 @@ def install(self, spec, prefix):
|
|||
ACTIVATION_LICENSE_FILE=%s
|
||||
ACTIVATION_TYPE=license_file
|
||||
PHONEHOME_SEND_USAGE_DATA=no
|
||||
CONTINUE_WITH_OPTIONAL_ERROR=yes
|
||||
COMPONENTS=%s
|
||||
""" %(self.intel_prefix, self.global_license_file, self.intel_components))
|
||||
|
||||
|
@ -76,37 +88,39 @@ class Intel(IntelInstaller):
|
|||
|
||||
# TODO: can also try the online installer (will download files on demand)
|
||||
version('16.0.2', '1133fb831312eb519f7da897fec223fa',
|
||||
url="file://%s/parallel_studio_xe_2016_composer_edition_update2.tgz" % os.getcwd())
|
||||
url="file://%s/parallel_studio_xe_2016_composer_edition_update2.tgz"\
|
||||
% os.getcwd())
|
||||
version('16.0.3', '3208eeabee951fc27579177b593cefe9',
|
||||
url="file://%s/parallel_studio_xe_2016_composer_edition_update3.tgz" % os.getcwd())
|
||||
url="file://%s/parallel_studio_xe_2016_composer_edition_update3.tgz"\
|
||||
% os.getcwd())
|
||||
|
||||
variant('rpath', default=True, description="Add rpath to .cfg files")
|
||||
|
||||
def install(self, spec, prefix):
|
||||
|
||||
# remove the installation DB, otherwise it will try to install into location of other Intel builds
|
||||
try:
|
||||
os.remove(os.path.join(os.environ["HOME"], "intel", "intel_sdp_products.db"))
|
||||
except OSError:
|
||||
pass # if the file does not exist
|
||||
|
||||
components = []
|
||||
all_components = get_all_components()
|
||||
components = filter_pick(all_components, re.compile('(comp|openmp|intel-tbb|icc|ifort|psxe|icsxe-pset)').search)
|
||||
components = filter_pick(all_components,
|
||||
re.compile('(comp|openmp|intel-tbb|icc|ifort|psxe|icsxe-pset)'
|
||||
).search)
|
||||
|
||||
self.intel_components = ';'.join(components)
|
||||
IntelInstaller.install(self, spec, prefix)
|
||||
|
||||
absbindir = os.path.split(os.path.realpath(os.path.join(self.prefix.bin, "icc")))[0]
|
||||
abslibdir = os.path.split(os.path.realpath(os.path.join(self.prefix.lib, "intel64", "libimf.a")))[0]
|
||||
absbindir = os.path.split(os.path.realpath(os.path.join(
|
||||
self.prefix.bin, "icc")))[0]
|
||||
abslibdir = os.path.split(os.path.realpath(os.path.join(
|
||||
self.prefix.lib, "intel64", "libimf.a")))[0]
|
||||
|
||||
# symlink or copy?
|
||||
os.symlink(self.global_license_file, os.path.join(absbindir, "license.lic"))
|
||||
os.symlink(self.global_license_file, os.path.join(absbindir,
|
||||
"license.lic"))
|
||||
|
||||
if spec.satisfies('+rpath'):
|
||||
for compiler_command in ["icc", "icpc", "ifort"]:
|
||||
cfgfilename = os.path.join(absbindir, "%s.cfg" %(compiler_command))
|
||||
cfgfilename = os.path.join(absbindir, "%s.cfg" %\
|
||||
compiler_command)
|
||||
with open(cfgfilename, "w") as f:
|
||||
f.write('-Xlinker -rpath -Xlinker %s\n' %(abslibdir))
|
||||
f.write('-Xlinker -rpath -Xlinker %s\n' % abslibdir)
|
||||
|
||||
os.symlink(os.path.join(self.prefix.man, "common", "man1"), os.path.join(self.prefix.man, "man1"))
|
||||
os.symlink(os.path.join(self.prefix.man, "common", "man1"),
|
||||
os.path.join(self.prefix.man, "man1"))
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
from spack import *
|
||||
import sys, os, re
|
||||
import os
|
||||
|
||||
from spack.pkg.builtin.intel import IntelInstaller
|
||||
|
||||
|
||||
class Ipp(IntelInstaller):
|
||||
"""Intel Integrated Performance Primitives.
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
from spack import *
|
||||
import os, re, sys
|
||||
import os
|
||||
|
||||
from spack.pkg.builtin.intel import IntelInstaller
|
||||
|
||||
|
||||
class Mkl(IntelInstaller):
|
||||
"""Intel Math Kernel Library.
|
||||
|
||||
|
|
Loading…
Reference in a new issue