Merge pull request #1 from robertdfrench/olcf/unified_cray_platform
PEP8 Goodness
This commit is contained in:
commit
07f2dd5498
2 changed files with 18 additions and 16 deletions
|
@ -7,6 +7,7 @@
|
||||||
from spack.util.multiproc import parmap
|
from spack.util.multiproc import parmap
|
||||||
import spack.compilers
|
import spack.compilers
|
||||||
|
|
||||||
|
|
||||||
class Cnl(OperatingSystem):
|
class Cnl(OperatingSystem):
|
||||||
""" Compute Node Linux (CNL) is the operating system used for the Cray XC
|
""" 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.
|
series super computers. It is a very stripped down version of GNU/Linux.
|
||||||
|
@ -24,14 +25,14 @@ def __str__(self):
|
||||||
|
|
||||||
def find_compilers(self, *paths):
|
def find_compilers(self, *paths):
|
||||||
types = spack.compilers.all_compiler_types()
|
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
|
# ensure all the version calls we made are cached in the parent
|
||||||
# process, as well. This speeds up Spack a lot.
|
# 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
|
return clist
|
||||||
|
|
||||||
|
|
||||||
def find_compiler(self, cmp_cls, *paths):
|
def find_compiler(self, cmp_cls, *paths):
|
||||||
compilers = []
|
compilers = []
|
||||||
if cmp_cls.PrgEnv:
|
if cmp_cls.PrgEnv:
|
||||||
|
@ -48,11 +49,14 @@ def find_compiler(self, cmp_cls, *paths):
|
||||||
module_paths = ':' + ':'.join(p for p in paths)
|
module_paths = ':' + ':'.join(p for p in paths)
|
||||||
os.environ['MODULEPATH'] = module_paths
|
os.environ['MODULEPATH'] = module_paths
|
||||||
|
|
||||||
output = modulecmd('avail', cmp_cls.PrgEnv_compiler, output=str, error=str)
|
output = modulecmd(
|
||||||
matches = re.findall(r'(%s)/([\d\.]+[\d])' % cmp_cls.PrgEnv_compiler, output)
|
'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:
|
for name, version in matches:
|
||||||
v = version
|
v = version
|
||||||
comp = cmp_cls(spack.spec.CompilerSpec(name + '@' + v), self,
|
comp = cmp_cls(
|
||||||
|
spack.spec.CompilerSpec(name + '@' + v), self,
|
||||||
['cc', 'CC', 'ftn'], [cmp_cls.PrgEnv, name + '/' + v])
|
['cc', 'CC', 'ftn'], [cmp_cls.PrgEnv, name + '/' + v])
|
||||||
|
|
||||||
compilers.append(comp)
|
compilers.append(comp)
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import platform as py_platform
|
|
||||||
#from subprocess import check_output
|
|
||||||
import spack.config
|
import spack.config
|
||||||
from spack.util.executable import which
|
|
||||||
from spack.architecture import Platform, Target, NoPlatformError
|
from spack.architecture import Platform, Target, NoPlatformError
|
||||||
from spack.operating_systems.linux_distro import LinuxDistro
|
from spack.operating_systems.linux_distro import LinuxDistro
|
||||||
from spack.operating_systems.cnl import Cnl
|
from spack.operating_systems.cnl import Cnl
|
||||||
|
@ -57,7 +54,8 @@ def __init__(self):
|
||||||
|
|
||||||
if self.back_end is not None:
|
if self.back_end is not None:
|
||||||
self.default = self.back_end
|
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:
|
else:
|
||||||
raise NoPlatformError()
|
raise NoPlatformError()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue