diff options
author | Mario Melara <maamelara@gmail.com> | 2015-11-04 12:57:29 -0800 |
---|---|---|
committer | Mario Melara <maamelara@gmail.com> | 2015-11-04 12:57:29 -0800 |
commit | 37260962e545366d0d882b205be807562c36f3b7 (patch) | |
tree | 541ff723f59a83432df8b01d3eca3afb00c292f1 /lib | |
parent | 058e72d29c3cd934f91ba626392b25ebaa50e2cc (diff) | |
download | spack-37260962e545366d0d882b205be807562c36f3b7.tar.gz spack-37260962e545366d0d882b205be807562c36f3b7.tar.bz2 spack-37260962e545366d0d882b205be807562c36f3b7.tar.xz spack-37260962e545366d0d882b205be807562c36f3b7.zip |
changed some potential syntax errors and added a way for target to recognize class
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/architecture.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index 442180242b..b251b82dcc 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -48,20 +48,29 @@ class NoSysTypeError(serr.SpackError): class Target(object): - """ This is the processor type e.g. cray-ivybridge """ + """ Target is the processor of the host machine. The host machine may have different front-end + and back-end targets, especially if it is a Cray machine. The target will have a name and + also the module_name (e.g craype-compiler). Targets will also recognize which architecture + they came from using the set_architecture method. Targets will have compiler finding strategies + """ + default_strategy = None # Can probably add a compiler path here def __init__(self,name, module_name=None): self.name = name # case of cray "ivybridge" but if it's x86_64 self.module_name = module_name # craype-ivybridge + def set_architecture(self, architecture): # Target should get the architecture class. + self.architecture = architecture + @property def compiler_strategy(self): - if self.module_name: # If there is a module_name given then use MODULES + if default_strategy: + return default_strategy + elif self.module_name: # If there is a module_name given then use MODULES return "MODULES" else: return "PATH" - class Architecture(object): """ Abstract class that each type of Architecture will subclass. Will return a instance of it once it is returned @@ -77,8 +86,8 @@ class Architecture(object): self.name = name def add_target(self, name, target): - self.targets[name] = target - + target.set_architecture(self) + self.targets[name] = target def target(self, name): """This is a getter method for the target dictionary that handles defaulting based @@ -163,7 +172,7 @@ def get_sys_type_from_config_file(): def all_architectures(): modules = [] for name in list_modules(spack.arch_path): - mod_name = 'spack.architectures.' + name + mod_name = 'spack.architectures' + name path = join_path(spack.arch_path, name) + ".py" mod = imp.load_source(mod_name, path) class_name = mod_to_class(name) |