added target method to architecture.py and minor cleanup
This commit is contained in:
parent
0a004e0fce
commit
d177184777
@ -58,9 +58,10 @@ class Target(object):
|
|||||||
# architecture classes handling the aliasing for front-end, back-end and default
|
# architecture classes handling the aliasing for front-end, back-end and default
|
||||||
|
|
||||||
def __init__(self,name, module_name=None):
|
def __init__(self,name, module_name=None):
|
||||||
self.name = name # case of cray "ivybridge but if it's x86_64
|
self.name = name # case of cray "ivybridge" but if it's x86_64
|
||||||
self.module_name = module_name # craype-ivybridge
|
self.module_name = module_name # craype-ivybridge
|
||||||
|
|
||||||
|
@property
|
||||||
def compiler_strategy(self):
|
def compiler_strategy(self):
|
||||||
if 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"
|
return "MODULES"
|
||||||
@ -73,10 +74,9 @@ class Architecture(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
priority = None # Subclass needs to set this number. This controls order in which arch is detected.
|
priority = None # Subclass needs to set this number. This controls order in which arch is detected.
|
||||||
front = None
|
front-end = None
|
||||||
back = None
|
back-end = None
|
||||||
default_front = None # The default front end target. On cray sandybridge
|
default = None # The default back end target. On cray ivybridge
|
||||||
default_back = None # The default back end target. On cray ivybridge
|
|
||||||
|
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.targets = {}
|
self.targets = {}
|
||||||
@ -85,6 +85,18 @@ def __init__(self, name):
|
|||||||
def add_target(self, name, target):
|
def add_target(self, name, target):
|
||||||
self.targets[name] = target
|
self.targets[name] = target
|
||||||
|
|
||||||
|
def target(self, name):
|
||||||
|
"""This is a getter method for the target dictionary that handles defaulting based
|
||||||
|
on the values provided by default, front-end, and back-end. This can be overwritten
|
||||||
|
by a subclass for which we want to provide further aliasing options.
|
||||||
|
"""
|
||||||
|
if name == 'default':
|
||||||
|
name = default
|
||||||
|
elif name == 'front_end':
|
||||||
|
name = front-end
|
||||||
|
elif name == 'back_end':
|
||||||
|
name = back-end
|
||||||
|
return self.targets[name]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def detect(self):
|
def detect(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user