summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/architecture.py52
-rw-r--r--lib/spack/spack/build_environment.py24
-rw-r--r--lib/spack/spack/compilers/craype.py9
-rw-r--r--lib/spack/spack/concretize.py6
4 files changed, 70 insertions, 21 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py
index e4b3dbf9c7..05dc969ebe 100644
--- a/lib/spack/spack/architecture.py
+++ b/lib/spack/spack/architecture.py
@@ -22,6 +22,58 @@
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
+"""
+This module contains all the elements that are required to create an
+architecture object. These include, the target processor, the operating system,
+and the architecture platform (i.e. cray, darwin, linux, bgq, etc) classes.
+
+On a multiple architecture machine, the architecture spec field can be set to
+build a package against any target and operating system that is present on the
+platform. On Cray platforms or any other architecture that has different front and
+back end environments, the operating system will determine the method of compiler
+detection.
+
+There are two different types of compiler detection:
+ 1. Through the $PATH env variable (front-end detection)
+ 2. Through the tcl module system. (back-end detection)
+
+Depending on which operating system is specified, the compiler will be detected
+using one of those methods.
+
+For platforms such as linux and darwin, the operating system is autodetected and
+the target is set to be x86_64.
+
+The command line syntax for specifying an architecture is as follows:
+
+ target=<Target name> os=<OperatingSystem name>
+
+If the user wishes to use the defaults, either target or os can be left out of
+the command line and Spack will concretize using the default. These defaults are
+set in the 'platforms/' directory which contains the different subclasses for
+platforms. If the machine has multiple architectures, the user can
+also enter front-end, or fe or back-end or be. These settings will concretize
+to their respective front-end and back-end targets and operating systems.
+Additional platforms can be added by creating a subclass of Platform
+and adding it inside the platform directory.
+
+Platforms are an abstract class that are extended by subclasses. If the user
+wants to add a new type of platform (such as cray_xe), they can create a subclass
+and set all the class attributes such as priority, front_target ,back_target,
+front_os, back_os. Platforms also contain a priority class attribute. A lower
+number signifies higher priority. These numbers are arbitrarily set and can be
+changed though often there isn't much need unless a new platform is added and
+the user wants that to be detected first.
+
+Targets are created inside the platform subclasses. Most architecture (like linux,
+and darwin) will have only one target (x86_64) but in the case of Cray machines,
+there is both a frontend and backend processor. The user can specify which targets
+are present on front-end and back-end architecture
+
+Depending on the platform, operating systems are either auto-detected or are
+set. The user can set the front-end and back-end operating setting by the class
+attributes front_os and back_os. The operating system as described earlier, will
+be responsible for compiler detection.
+"""
import os
from collections import namedtuple
import imp
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 7aeea5c672..4f4ca26cbc 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -113,7 +113,6 @@ class MakeExecutable(Executable):
return super(MakeExecutable, self).__call__(*args, **kwargs)
-
def load_module(mod):
"""Takes a module name and removes modules until it is possible to
load that module. It then loads the provided module. Depends on the
@@ -145,7 +144,6 @@ def get_path_from_module(mod):
# Read the module
text = modulecmd('show', mod, output=str, error=str).split('\n')
-
# If it lists its package directory, return that
for line in text:
if line.find(mod.upper()+'_DIR') >= 0:
@@ -166,15 +164,14 @@ def get_path_from_module(mod):
# If it sets the LD_LIBRARY_PATH or CRAY_LD_LIBRARY_PATH, use that
for line in text:
- if line.find('LD_LIBRARY_PATH') >= 0:
+ if line.find('LD_LIBRARY_PATH') >= 0:
words = line.split()
path = words[2]
return path[:path.find('/lib')]
-
# Unable to find module path
return None
-def set_compiler_environment_variables(pkg):
+def set_compiler_environment_variables(pkg, env):
assert(pkg.spec.concrete)
compiler = pkg.compiler
flags = pkg.spec.compiler_flags
@@ -276,14 +273,12 @@ def set_build_environment_variables(pkg, env):
env.set(SPACK_DEBUG_LOG_DIR, spack.spack_working_dir)
# Add any pkgconfig directories to PKG_CONFIG_PATH
- pkg_config_dirs = []
- for p in dep_prefixes:
- for maybe in ('lib', 'lib64', 'share'):
- pcdir = join_path(p, maybe, 'pkgconfig')
+ for pre in dep_prefixes:
+ for directory in ('lib', 'lib64', 'share'):
+ pcdir = join_path(pre, directory, 'pkgconfig')
if os.path.isdir(pcdir):
- pkg_config_dirs.append(pcdir)
-
- env.prepend_path('PKG_CONFIG_PATH', pkg_config_dirs)
+ #pkg_config_dirs.append(pcdir)
+ env.prepend_path('PKG_CONFIG_PATH',pcdir)
if pkg.spec.architecture.target.module_name:
load_module(pkg.spec.architecture.target.module_name)
@@ -369,8 +364,9 @@ def get_rpaths(pkg):
if os.path.isdir(d.prefix.lib))
rpaths.extend(d.prefix.lib64 for d in pkg.spec.dependencies.values()
if os.path.isdir(d.prefix.lib64))
- for mod in pkg.spec.compiler.modules:
- rpaths.append(get_path_for_module(mod))
+ # Second module is our compiler mod name. We use that to get rpaths from
+ # module show output.
+ rpaths.append(get_path_from_module(pkg.compiler.modules[1]))
return rpaths
diff --git a/lib/spack/spack/compilers/craype.py b/lib/spack/spack/compilers/craype.py
index e8ae284f5b..4ba8b110ec 100644
--- a/lib/spack/spack/compilers/craype.py
+++ b/lib/spack/spack/compilers/craype.py
@@ -47,10 +47,11 @@ class Craype(Compiler):
PrgEnv = 'PrgEnv-cray'
PrgEnv_compiler = 'craype'
-# @property
-# def cxx11_flag(self):
-# return "-hstd=c++11"
-
+ link_paths = { 'cc' : 'cc',
+ 'cxx' : 'c++',
+ 'f77' : 'f77',
+ 'fc' : 'fc'}
+
@classmethod
def default_version(cls, comp):
return get_compiler_version(comp, r'([Vv]ersion).*(\d+(\.\d+)+)')
diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py
index 1f5c07779e..7ea8ea6928 100644
--- a/lib/spack/spack/concretize.py
+++ b/lib/spack/spack/concretize.py
@@ -315,10 +315,10 @@ class DefaultConcretizer(object):
raise UnavailableCompilerVersionError(other_compiler)
# copy concrete version into other_compiler
- index = len(matches)-1
+ index = 0
while not _proper_compiler_style(matches[index], spec.architecture):
- index -= 1
- if index == 0:
+ index += 1
+ if index == len(matches) - 1:
raise NoValidVersionError(spec)
spec.compiler = matches[index].copy()
assert(spec.compiler.concrete)