Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated VTune easyblock to behave like sourcing the amplxe-vars.sh script #1229

Merged
merged 9 commits into from
Dec 7, 2017
Merged
35 changes: 8 additions & 27 deletions easybuild/easyblocks/a/advisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,16 @@ def __init__(self, *args, **kwargs):
"""Constructor, initialize class variables."""
super(EB_Advisor, self).__init__(*args, **kwargs)
if LooseVersion(self.version) < LooseVersion('2017'):
self.base_path = 'advisor_xe'
self.subdir = 'advisor_xe'
else:
self.base_path = 'advisor'
self.subdir = 'advisor'

def make_module_req_guess(self):
"""Find reasonable paths for Advisor"""
return self.get_guesses_tools()

def sanity_check_step(self):
"""Custom sanity check paths for Advisor"""

custom_paths = {
'files': [],
'dirs': ['%s/bin64' % self.base_path, '%s/lib64' % self.base_path]
}

binaries = ['advixe-cl', 'advixe-feedback', 'advixe-gui', 'advixe-runss', 'advixe-runtrc', 'advixe-runtc']
custom_paths = self.get_custom_paths_tools(binaries)
super(EB_Advisor, self).sanity_check_step(custom_paths=custom_paths)

def make_module_req_guess(self):
"""
A dictionary of possible directories to look for
"""
guesses = super(EB_Advisor, self).make_module_req_guess()

lib_path = '%s/lib64' % self.base_path
include_path = '%s/include' % self.base_path

guesses.update({
'CPATH': [include_path],
'INCLUDE': [include_path],
'LD_LIBRARY_PATH': [lib_path],
'LIBRARY_PATH': [lib_path],
'PATH': ['%s/bin64' % self.base_path],
})

return guesses
39 changes: 38 additions & 1 deletion easybuild/easyblocks/generic/intelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
@author: Jens Timmerman (Ghent University)
@author: Ward Poelmans (Ghent University)
@author: Lumir Jasiok (IT4Innovations)
@author: Damian Alvarez (Forschungszentrum Juelich GmbH)
"""

import os
Expand Down Expand Up @@ -111,6 +112,42 @@ def __init__(self, *args, **kwargs):

self.install_components = None

def get_guesses_tools(self):
"""Find reasonable paths for a subset of Intel tools, ignoring CPATH, LD_LIBRARY_PATH and LIBRARY_PATH"""

guesses = super(IntelBase, self).make_module_req_guess()

if self.cfg['m32']:
guesses['PATH'] = [os.path.join(self.subdir, 'bin32')]
else:
guesses['PATH'] = [os.path.join(self.subdir, 'bin64')]

guesses['MANPATH'] = [os.path.join(self.subdir, 'man')]

# make sure $CPATH, $LD_LIBRARY_PATH and $LIBRARY_PATH are not updated in generated module file,
# because that leads to problem when the libraries included with VTune/Advisor/Inspector are being picked up
for key in ['CPATH', 'LD_LIBRARY_PATH', 'LIBRARY_PATH']:
if key in guesses:
self.log.debug("Purposely not updating $%s in %s module file", key, self.name)
del guesses[key]

return guesses

def get_custom_paths_tools(self, binaries):
"""Custom sanity check paths for certain Intel tools."""
if self.cfg['m32']:
files = [os.path.join('bin32', b) for b in binaries]
dirs = ['lib32', 'include']
else:
files = [os.path.join('bin64', b) for b in binaries]
dirs = ['lib64', 'include']

custom_paths = {
'files': [os.path.join(self.subdir, f) for f in files],
'dirs': [os.path.join(self.subdir, d) for d in dirs],
}
return custom_paths

@staticmethod
def extra_options(extra_vars=None):
extra_vars = EasyBlock.extra_options(extra_vars)
Expand Down Expand Up @@ -383,7 +420,7 @@ def move_after_install(self):
shutil.rmtree(os.path.join(self.installdir, self.name))
except OSError, err:
raise EasyBuildError("Failed to move contents of %s to %s: %s", subdir, self.installdir, err)

def sanity_check_rpath(self):
"""Skip the rpath sanity check, this is binary software"""
self.log.info("RPATH sanity check is skipped when using %s easyblock (derived from IntelBase)",
Expand Down
47 changes: 7 additions & 40 deletions easybuild/easyblocks/i/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
EasyBuild support for installing Intel Inspector, implemented as an easyblock

@author: Kenneth Hoste (Ghent University)
@author: Damian Alvarez (Forschungzentrum Juelich GmbH)
"""
import os
from distutils.version import LooseVersion

from easybuild.easyblocks.generic.intelbase import IntelBase, ACTIVATION_NAME_2012, LICENSE_FILE_NAME_2012
Expand All @@ -44,9 +44,10 @@ def __init__(self, *args, **kwargs):

# recent versions of Inspector are installed to a subdirectory
self.subdir = ''
if LooseVersion(self.version) >= LooseVersion('2013_update7') and LooseVersion(self.version) < LooseVersion('2017'):
loosever = LooseVersion(self.version)
if loosever >= LooseVersion('2013_update7') and loosever < LooseVersion('2017'):
self.subdir = 'inspector_xe'
elif LooseVersion(self.version) >= LooseVersion('2017'):
elif loosever >= LooseVersion('2017'):
self.subdir = 'inspector'

def make_installdir(self):
Expand All @@ -70,45 +71,11 @@ def install_step(self):
super(EB_Inspector, self).install_step(silent_cfg_names_map=silent_cfg_names_map)

def make_module_req_guess(self):
"""
A dictionary of possible directories to look for
"""

guesses = super(EB_Inspector, self).make_module_req_guess()

if self.cfg['m32']:
guesses.update({
'PATH': [os.path.join(self.subdir, 'bin32')],
'LD_LIBRARY_PATH': [os.path.join(self.subdir, 'lib32')],
'LIBRARY_PATH': [os.path.join(self.subdir, 'lib32')],
})
else:
guesses.update({
'PATH': [os.path.join(self.subdir, 'bin64')],
'LD_LIBRARY_PATH': [os.path.join(self.subdir, 'lib64')],
'LIBRARY_PATH': [os.path.join(self.subdir, 'lib64')],
})

guesses.update({
'CPATH': [os.path.join(self.subdir, 'include')],
'MANPATH': [os.path.join(self.subdir, 'man')],
})

return guesses
"""Find reasonable paths for Inspector"""
return self.get_guesses_tools()

def sanity_check_step(self):
"""Custom sanity check paths for Intel Inspector."""

binaries = ['inspxe-cl', 'inspxe-feedback', 'inspxe-gui', 'inspxe-runmc', 'inspxe-runtc']
if self.cfg['m32']:
files = [os.path.join('bin32', b) for b in binaries]
dirs = ['lib32', 'include']
else:
files = [os.path.join('bin64', b) for b in binaries]
dirs = ['lib64', 'include']

custom_paths = {
'files': [os.path.join(self.subdir, f) for f in files],
'dirs': [os.path.join(self.subdir, d) for d in dirs],
}
custom_paths = self.get_custom_paths_tools(binaries)
super(EB_Inspector, self).sanity_check_step(custom_paths=custom_paths)
51 changes: 10 additions & 41 deletions easybuild/easyblocks/v/vtune.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
EasyBuild support for installing Intel VTune, implemented as an easyblock

@author: Kenneth Hoste (Ghent University)
@author: Damian Alvarez (Forschungzentrum Juelich GmbH)
"""
import os
from distutils.version import LooseVersion

from easybuild.easyblocks.generic.intelbase import IntelBase, ACTIVATION_NAME_2012, LICENSE_FILE_NAME_2012
Expand All @@ -42,10 +42,13 @@ def __init__(self, *args, **kwargs):
"""Easyblock constructor; define class variables."""
super(EB_VTune, self).__init__(*args, **kwargs)

# recent versions of Inspector are installed to a subdirectory
# recent versions of VTune are installed to a subdirectory
self.subdir = ''
if LooseVersion(self.version) >= LooseVersion('2013_update12'):
loosever = LooseVersion(self.version)
if loosever >= LooseVersion('2013_update12') and loosever < LooseVersion('2018'):
self.subdir = 'vtune_amplifier_xe'
elif loosever >= LooseVersion('2018'):
self.subdir = 'vtune_amplifier'

def make_installdir(self):
"""Do not create installation directory, install script handles that already."""
Expand All @@ -68,45 +71,11 @@ def install_step(self):
super(EB_VTune, self).install_step(silent_cfg_names_map=silent_cfg_names_map)

def make_module_req_guess(self):
"""
A dictionary of possible directories to look for
"""

guesses = super(EB_VTune, self).make_module_req_guess()

if self.cfg['m32']:
guesses.update({
'PATH': [os.path.join(self.subdir, 'bin32')],
'LD_LIBRARY_PATH': [os.path.join(self.subdir, 'lib32')],
'LIBRARY_PATH': [os.path.join(self.subdir, 'lib32')],
})
else:
guesses.update({
'PATH': [os.path.join(self.subdir, 'bin64')],
'LD_LIBRARY_PATH': [os.path.join(self.subdir, 'lib64')],
'LIBRARY_PATH': [os.path.join(self.subdir, 'lib64')],
})

guesses.update({
'CPATH': [os.path.join(self.subdir, 'include')],
'MANPATH': [os.path.join(self.subdir, 'man')],
})

return guesses
"""Find reasonable paths for VTune"""
return self.get_guesses_tools()

def sanity_check_step(self):
"""Custom sanity check paths for Intel VTune."""

"""Custom sanity check paths for VTune."""
binaries = ['amplxe-cl', 'amplxe-feedback', 'amplxe-gui', 'amplxe-runss']
if self.cfg['m32']:
files = ['bin32/%s' % x for x in binaries]
dirs = ['lib32', 'include']
else:
files = ['bin64/%s' % x for x in binaries]
dirs = ['lib64', 'include']

custom_paths = {
'files': [os.path.join(self.subdir, f) for f in files],
'dirs': [os.path.join(self.subdir, d) for d in dirs],
}
custom_paths = self.get_custom_paths_tools(binaries)
super(EB_VTune, self).sanity_check_step(custom_paths=custom_paths)