diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/operating_systems/cnl.py | 22 | ||||
-rw-r--r-- | lib/spack/spack/platforms/cray.py | 12 |
2 files changed, 18 insertions, 16 deletions
diff --git a/lib/spack/spack/operating_systems/cnl.py b/lib/spack/spack/operating_systems/cnl.py index 5ee8599e1d..dbd2775861 100644 --- a/lib/spack/spack/operating_systems/cnl.py +++ b/lib/spack/spack/operating_systems/cnl.py @@ -7,11 +7,12 @@ import spack.spec from spack.util.multiproc import parmap import spack.compilers + class Cnl(OperatingSystem): """ Compute Node Linux (CNL) is the operating system used for the Cray XC series super computers. It is a very stripped down version of GNU/Linux. Any compilers found through this operating system will be used with - modules. If updated, user must make sure that version and name are + modules. If updated, user must make sure that version and name are updated to indicate that OS has been upgraded (or downgraded) """ def __init__(self): @@ -24,14 +25,14 @@ class Cnl(OperatingSystem): def find_compilers(self, *paths): types = spack.compilers.all_compiler_types() - compiler_lists = parmap(lambda cmp_cls: self.find_compiler(cmp_cls, *paths), types) + compiler_lists = parmap( + lambda cmp_cls: self.find_compiler(cmp_cls, *paths), types) # ensure all the version calls we made are cached in the parent # process, as well. This speeds up Spack a lot. - clist = reduce(lambda x,y: x+y, compiler_lists) + clist = reduce(lambda x, y: x + y, compiler_lists) return clist - def find_compiler(self, cmp_cls, *paths): compilers = [] if cmp_cls.PrgEnv: @@ -47,13 +48,16 @@ class Cnl(OperatingSystem): if paths: module_paths = ':' + ':'.join(p for p in paths) os.environ['MODULEPATH'] = module_paths - - output = modulecmd('avail', cmp_cls.PrgEnv_compiler, output=str, error=str) - matches = re.findall(r'(%s)/([\d\.]+[\d])' % cmp_cls.PrgEnv_compiler, output) + + output = modulecmd( + 'avail', cmp_cls.PrgEnv_compiler, output=str, error=str) + matches = re.findall( + r'(%s)/([\d\.]+[\d])' % cmp_cls.PrgEnv_compiler, output) for name, version in matches: v = version - comp = cmp_cls(spack.spec.CompilerSpec(name + '@' + v), self, - ['cc', 'CC', 'ftn'], [cmp_cls.PrgEnv, name +'/' + v]) + comp = cmp_cls( + spack.spec.CompilerSpec(name + '@' + v), self, + ['cc', 'CC', 'ftn'], [cmp_cls.PrgEnv, name + '/' + v]) compilers.append(comp) diff --git a/lib/spack/spack/platforms/cray.py b/lib/spack/spack/platforms/cray.py index 279009be5f..79a53d887c 100644 --- a/lib/spack/spack/platforms/cray.py +++ b/lib/spack/spack/platforms/cray.py @@ -1,9 +1,6 @@ import os import re -import platform as py_platform -#from subprocess import check_output import spack.config -from spack.util.executable import which from spack.architecture import Platform, Target, NoPlatformError from spack.operating_systems.linux_distro import LinuxDistro from spack.operating_systems.cnl import Cnl @@ -20,7 +17,7 @@ def _target_from_init(name): with open('/etc/bash.bashrc.local', 'r') as conf: for line in conf: if re.search('^[^\#]*module[\s]*(?:add|load)', line): - matches.extend(re.findall(pattern, line)) + matches.extend(re.findall(pattern, line)) return matches[0] if matches else None @@ -29,7 +26,7 @@ class Cray(Platform): def __init__(self): ''' Create a Cray system platform. - + Target names should use craype target names but not include the 'craype-' prefix. Uses first viable target from: self @@ -50,14 +47,15 @@ class Cray(Platform): if _target is None: _target = _target_from_init(name) setattr(self, name, _target) - + if _target is not None: self.add_target(name, Target(_target, 'craype-' + _target)) self.add_target(_target, Target(_target, 'craype-' + _target)) if self.back_end is not None: self.default = self.back_end - self.add_target('default', Target(self.default, 'craype-' + self.default)) + self.add_target( + 'default', Target(self.default, 'craype-' + self.default)) else: raise NoPlatformError() |