Merge pull request #1319 from LLNL/cray-linker

Cray linker
This commit is contained in:
Todd Gamblin 2016-07-20 12:56:01 -07:00 committed by GitHub
commit cd4f429f72
4 changed files with 25 additions and 9 deletions

View File

@ -1866,6 +1866,10 @@ to call the Cray compiler wrappers during build time.
For more on compiler configuration, check out :ref:`compiler-config`. For more on compiler configuration, check out :ref:`compiler-config`.
Spack sets the default Cray link type to dynamic, to better match other
other platforms. Individual packages can enable static linking (which is the
default outside of Spack on cray systems) using the -static flag.
Setting defaults and using Cray modules Setting defaults and using Cray modules
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -76,7 +76,6 @@
will be responsible for compiler detection. will be responsible for compiler detection.
""" """
import os import os
import imp
import inspect import inspect
from llnl.util.lang import memoized, list_modules, key_ordering from llnl.util.lang import memoized, list_modules, key_ordering
@ -190,6 +189,12 @@ def operating_system(self, name):
return self.operating_sys.get(name, None) return self.operating_sys.get(name, None)
@classmethod
def setup_platform_environment(self, pkg, env):
""" Subclass can override this method if it requires any
platform-specific build environment modifications.
"""
pass
@classmethod @classmethod
def detect(self): def detect(self):
@ -200,15 +205,12 @@ def detect(self):
""" """
raise NotImplementedError() raise NotImplementedError()
def __repr__(self): def __repr__(self):
return self.__str__() return self.__str__()
def __str__(self): def __str__(self):
return self.name return self.name
def _cmp_key(self): def _cmp_key(self):
t_keys = ''.join(str(t._cmp_key()) for t in t_keys = ''.join(str(t._cmp_key()) for t in
sorted(self.targets.values())) sorted(self.targets.values()))
@ -279,7 +281,7 @@ def find_compilers(self, *paths):
# ensure all the version calls we made are cached in the parent # ensure all the version calls we made are cached in the parent
# process, as well. This speeds up Spack a lot. # process, as well. This speeds up Spack a lot.
clist = reduce(lambda x, y: x+y, compiler_lists) clist = reduce(lambda x, y: x + y, compiler_lists)
return clist return clist
def find_compiler(self, cmp_cls, *path): def find_compiler(self, cmp_cls, *path):
@ -320,7 +322,7 @@ def find_compiler(self, cmp_cls, *path):
# prefer the one with more compilers. # prefer the one with more compilers.
prev_paths = [prev.cc, prev.cxx, prev.f77, prev.fc] prev_paths = [prev.cc, prev.cxx, prev.f77, prev.fc]
newcount = len([p for p in paths if p is not None]) newcount = len([p for p in paths if p is not None])
prevcount = len([p for p in prev_paths if p is not None]) prevcount = len([p for p in prev_paths if p is not None])
# Don't add if it's not an improvement over prev compiler. # Don't add if it's not an improvement over prev compiler.
@ -337,6 +339,7 @@ def to_dict(self):
d['version'] = self.version d['version'] = self.version
return d return d
@key_ordering @key_ordering
class Arch(object): class Arch(object):
"""Architecture is now a class to help with setting attributes. """Architecture is now a class to help with setting attributes.
@ -377,11 +380,9 @@ def __str__(self):
else: else:
return '' return ''
def __contains__(self, string): def __contains__(self, string):
return string in str(self) return string in str(self)
def _cmp_key(self): def _cmp_key(self):
if isinstance(self.platform, Platform): if isinstance(self.platform, Platform):
platform = self.platform.name platform = self.platform.name
@ -424,7 +425,7 @@ def _operating_system_from_dict(os_name, plat=None):
if isinstance(os_name, dict): if isinstance(os_name, dict):
name = os_name['name'] name = os_name['name']
version = os_name['version'] version = os_name['version']
return plat.operating_system(name+version) return plat.operating_system(name + version)
else: else:
return plat.operating_system(os_name) return plat.operating_system(os_name)

View File

@ -444,6 +444,7 @@ def setup_package(pkg, dirty=False):
set_compiler_environment_variables(pkg, spack_env) set_compiler_environment_variables(pkg, spack_env)
set_build_environment_variables(pkg, spack_env, dirty) set_build_environment_variables(pkg, spack_env, dirty)
pkg.spec.architecture.platform.setup_platform_environment(pkg, spack_env)
load_external_modules(pkg) load_external_modules(pkg)
# traverse in postorder so package can use vars from its dependencies # traverse in postorder so package can use vars from its dependencies
spec = pkg.spec spec = pkg.spec

View File

@ -44,6 +44,16 @@ def __init__(self):
self.add_operating_system(str(linux_dist), linux_dist) self.add_operating_system(str(linux_dist), linux_dist)
self.add_operating_system('CNL10', Cnl()) self.add_operating_system('CNL10', Cnl())
@classmethod
def setup_platform_environment(self, pkg, env):
""" Change the linker to default dynamic to be more
similar to linux/standard linker behavior
"""
env.set('CRAYPE_LINK_TYPE', 'dynamic')
cray_wrapper_names = join_path(spack.build_env_path, 'cray')
if os.path.isdir(cray_wrapper_names):
env.prepend_path('PATH', cray_wrapper_names)
@classmethod @classmethod
def detect(self): def detect(self):
try: try: