First possibly working version of the crayport. Not sufficiently tested at all.
This commit is contained in:
parent
95a34628a3
commit
271a839957
7 changed files with 46 additions and 61 deletions
|
@ -64,13 +64,15 @@ def set_architecture(self, architecture): # Target should get the architecture c
|
|||
|
||||
@property
|
||||
def compiler_strategy(self):
|
||||
if default_strategy:
|
||||
return default_strategy
|
||||
elif self.module_name: # If there is a module_name given then use MODULES
|
||||
if self.module_name: # If there is a module_name given then use MODULES
|
||||
return "MODULES"
|
||||
else:
|
||||
return "PATH"
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Architecture(object):
|
||||
""" Abstract class that each type of Architecture will subclass. Will return a instance of it once it
|
||||
is returned
|
||||
|
@ -116,6 +118,9 @@ def detect(self):
|
|||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
import subprocess
|
||||
from spack.architecture import Architecture
|
||||
from spack.architecture import Architecture, Target
|
||||
|
||||
class Linux(Architecture):
|
||||
priority = 60
|
||||
front_end = "x86_64"
|
||||
back_end = "x86_64"
|
||||
default = "x86_64"
|
||||
front_end = 'linux'
|
||||
back_end = 'linux'
|
||||
default = 'linux'
|
||||
|
||||
def __init__(self):
|
||||
super(Linux, self).__init__('linux')
|
||||
self.add_target('linux', Target('linux'))
|
||||
|
||||
@classmethod
|
||||
def detect(self):
|
||||
|
|
|
@ -307,8 +307,12 @@ def __repr__(self):
|
|||
|
||||
def __str__(self):
|
||||
"""Return a string represntation of the compiler toolchain."""
|
||||
return "%s(%s)" % (
|
||||
self.name, '\n '.join((str(s) for s in (self.cc, self.cxx, self.f77, self.fc))))
|
||||
if self.modules:
|
||||
return "%s(%s)" % (
|
||||
self.name, '\n '.join((str(s) for s in (self.cc, self.cxx, self.f77, self.fc, self.modules))))
|
||||
else:
|
||||
return "%s(%s)" % (
|
||||
self.name, '\n '.join((str(s) for s in (self.cc, self.cxx, self.f77, self.fc))))
|
||||
|
||||
|
||||
class CompilerAccessError(spack.error.SpackError):
|
||||
|
|
|
@ -44,15 +44,15 @@
|
|||
|
||||
_imported_compilers_module = 'spack.compilers'
|
||||
_required_instance_vars = ['cc', 'cxx', 'f77', 'fc']
|
||||
_optional_instance_vars = ['module']
|
||||
_optional_instance_vars = ['modules']
|
||||
|
||||
_default_order = ['gcc', 'intel', 'pgi', 'clang', 'xlc']
|
||||
|
||||
def _auto_compiler_spec(function):
|
||||
def converter(cspec_like):
|
||||
def converter(cspec_like, *args):
|
||||
if not isinstance(cspec_like, spack.spec.CompilerSpec):
|
||||
cspec_like = spack.spec.CompilerSpec(cspec_like)
|
||||
return function(cspec_like)
|
||||
return function(cspec_like, *args)
|
||||
return converter
|
||||
|
||||
|
||||
|
|
|
@ -97,32 +97,6 @@ def concretize_version(self, spec):
|
|||
|
||||
|
||||
def concretize_architecture(self, spec):
|
||||
"""If the spec already had an architecture, return. Otherwise if
|
||||
the root of the DAG has an architecture, then use that.
|
||||
Otherwise take the system's default architecture.
|
||||
|
||||
Intuition: Architectures won't be set a lot, and generally you
|
||||
want the host system's architecture. When architectures are
|
||||
mised in a spec, it is likely because the tool requries a
|
||||
cross-compiled component, e.g. for tools that run on BlueGene
|
||||
or Cray machines. These constraints will likely come directly
|
||||
from packages, so require the user to be explicit if they want
|
||||
to mess with the architecture, and revert to the default when
|
||||
they're not explicit.
|
||||
"""
|
||||
if spec.architecture is not None:
|
||||
return False
|
||||
|
||||
if spec.root.architecture:
|
||||
spec.architecture = spec.root.architecture
|
||||
else:
|
||||
spec.architecture = spack.architecture.sys_type()
|
||||
|
||||
assert(spec.architecture is not None)
|
||||
return True # changed
|
||||
|
||||
|
||||
def new_concretize_architecture(self, spec):
|
||||
"""If the spec already has an architecture and it is a an architecture type,
|
||||
return. Otherwise, if it has an architecture that is a string type, generate an
|
||||
architecture based on that type. If it has no architecture and the root of the
|
||||
|
|
|
@ -199,6 +199,7 @@ def get_config(category_name):
|
|||
category.result_dict = _merge_dicts(category.result_dict, result)
|
||||
else:
|
||||
category.result_dict = result
|
||||
|
||||
return category.result_dict
|
||||
|
||||
|
||||
|
@ -208,7 +209,7 @@ def get_compilers_config(arch=None):
|
|||
configuration"""
|
||||
global _compiler_by_arch
|
||||
if not arch:
|
||||
arch = spack.architecture.sys_type()
|
||||
arch = str(spack.architecture.sys_type())
|
||||
if arch in _compiler_by_arch:
|
||||
return _compiler_by_arch[arch]
|
||||
|
||||
|
@ -305,7 +306,7 @@ def add_to_compiler_config(addition_dict, scope=None, arch=None):
|
|||
"""Add compilerss to the configuration files"""
|
||||
if not arch:
|
||||
arch = spack.architecture.sys_type()
|
||||
add_to_config('compilers', { arch : addition_dict }, scope)
|
||||
add_to_config('compilers', { str(arch) : addition_dict }, scope)
|
||||
clear_config_caches()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue