summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGregory Becker <becker33@llnl.gov>2016-01-07 12:43:39 -0800
committerGregory Becker <becker33@llnl.gov>2016-01-07 12:43:39 -0800
commit83917c4c302851a0d4ff91ef652fdd1b26fb1e08 (patch)
treebcc48284fdd598335ad6dddfcaae347a1e8a5363 /lib
parent6ccd9d6fa4baa9b14e0cea19e55b24ad19d053f0 (diff)
downloadspack-83917c4c302851a0d4ff91ef652fdd1b26fb1e08.tar.gz
spack-83917c4c302851a0d4ff91ef652fdd1b26fb1e08.tar.bz2
spack-83917c4c302851a0d4ff91ef652fdd1b26fb1e08.tar.xz
spack-83917c4c302851a0d4ff91ef652fdd1b26fb1e08.zip
Improved target specification
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/architecture.py2
-rw-r--r--lib/spack/spack/concretize.py38
-rw-r--r--lib/spack/spack/platforms/bgq.py2
3 files changed, 37 insertions, 5 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py
index a269767fab..6b9ae33b3e 100644
--- a/lib/spack/spack/architecture.py
+++ b/lib/spack/spack/architecture.py
@@ -93,6 +93,8 @@ class Target(object):
return self.__str__()
def __str__(self):
+ if self.platform_name:
+ return self.platform_name + '-' + self.name
return self.name
@key_ordering
diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py
index fcd23a6055..ce86786004 100644
--- a/lib/spack/spack/concretize.py
+++ b/lib/spack/spack/concretize.py
@@ -33,11 +33,13 @@ or user preferences.
TODO: make this customizable and allow users to configure
concretization policies.
"""
+from llnl.util.filesystem import join_path
import spack
import spack.spec
import spack.compilers
import spack.architecture
import spack.error
+from spack.util.naming import mod_to_class
from spack.version import *
from functools import partial
from spec import DependencyMap
@@ -207,6 +209,36 @@ class DefaultConcretizer(object):
return True # Things changed
+ def class_from_platform_name(self, platform_name):
+ file_path = join_path(spack.platform_path, platform_name)
+ platform_mod = imp.load_source('spack.platforms', file_path + '.py')
+ cls = getattr(platform_mod, mod_to_class(platform_name))
+
+ return cls
+
+ def spec_add_target_from_string(self, spec, target):
+ """If only a target is provided, spack will assume the default architecture.
+ A platform-target pair can be input delimited by a '-'. If either portion of
+ a platform-target pair is empty, spack will supply a default, in the case of
+ a blank target the default will be dependent on the platform.
+ E.g. x86_64 -> 64 bit x86
+ bgq- -> default bgq target (back end/powerpc)
+ cray-hawswell -> haswell target on cray platform
+ """
+ if '-' in target:
+ platform, target = target.split('-')
+ else:
+ platform = ''
+
+ if platform != '':
+ cls = self.class_from_platform_name(platform)
+ platform = cls()
+ else:
+ platform = spack.architecture.sys_type()
+ if target != '':
+ spec.target = platform.target(target)
+ else:
+ spec.target = platform.target('default')
def concretize_target(self, spec):
"""If the spec already has an target and it is a an target type,
@@ -219,16 +251,14 @@ class DefaultConcretizer(object):
if isinstance(spec.target,spack.architecture.Target):
return False
else:
- platform = spack.architecture.sys_type()
- spec.target = platform.target(spec.target)
+ self.spec_add_target_from_string(spec, spec.target)
return True #changed
if spec.root.target:
if isinstance(spec.root.target,spack.architecture.Target):
spec.target = spec.root.target
else:
- platform = spack.architecture.sys_type()
- spec.target = platform.target(spec.root.target)
+ self.spec_add_target_from_string(spec, spec.root.target)
else:
platform = spack.architecture.sys_type()
spec.target = platform.target('default')
diff --git a/lib/spack/spack/platforms/bgq.py b/lib/spack/spack/platforms/bgq.py
index 988e67023c..6e872d2e72 100644
--- a/lib/spack/spack/platforms/bgq.py
+++ b/lib/spack/spack/platforms/bgq.py
@@ -9,7 +9,7 @@ class Bgq(Platform):
default = 'powerpc'
def __init__(self):
- super(Bgq, self).__init__('cray')
+ super(Bgq, self).__init__('bgq')
self.add_target(self.front_end, Target(self.front_end, 'PATH'))
self.add_target(self.back_end, Target(self.back_end, 'PATH'))