fixed errors caused by crayport on linux and added a darwin architecture
This commit is contained in:
parent
d2c2c46541
commit
9848ad32fd
@ -96,11 +96,13 @@ def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
def __str__(self):
|
||||
if self.module_name:
|
||||
return self.name + ' module: ' + self.module_name
|
||||
return self.name
|
||||
|
||||
@key_ordering
|
||||
class Architecture(object):
|
||||
""" Abstract class that each type of Architecture will subclass.
|
||||
""" Abstract class that each type of Architecture will subclass.
|
||||
Will return a instance of it once it
|
||||
is returned
|
||||
"""
|
||||
@ -150,7 +152,7 @@ def __repr__(self):
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
def _cmp_key(self):
|
||||
return (self.name, (_cmp_key(t) for t in self.targets.values()))
|
||||
|
||||
|
@ -4,27 +4,30 @@
|
||||
|
||||
class Cray(Architecture):
|
||||
priority = 20
|
||||
front_end = 'sandybridge'
|
||||
front_end = 'sandybridge'
|
||||
back_end = 'ivybridge'
|
||||
default = os.environ['CRAY_CPU_TARGET']
|
||||
#default = 'ivybridge'
|
||||
|
||||
default = 'ivybridge'
|
||||
|
||||
def __init__(self):
|
||||
''' Since cori doesn't have ivybridge as a front end it's better
|
||||
if we use CRAY_CPU_TARGET as the default. This will ensure
|
||||
that if we're on a XC-40 or XC-30 then we can detect the target
|
||||
'''
|
||||
super(Cray, self).__init__('cray')
|
||||
|
||||
|
||||
# Handle the default here so we can check for a key error
|
||||
if 'CRAY_CPU_TARGET' in os.environ:
|
||||
default = os.environ['CRAY_CPU_TARGET']
|
||||
|
||||
# Back End compiler needs the proper target module loaded.
|
||||
self.add_target(self.front_end, Target(self.front_end,'craype-' + self.front_end))
|
||||
self.add_target(self.back_end, Target(self.front_end,'craype-'+ self.back_end))
|
||||
self.add_target(self.default, Target(self.default,'craype-' + self.default))
|
||||
# Could switch to use modules and fe targets for front end
|
||||
# Currently using compilers by path for front end.
|
||||
self.add_target(self.back_end, Target('craype-' + self.back_end))
|
||||
|
||||
self.add_target(self.front_end, Target(self.front_end))
|
||||
|
||||
|
||||
@classmethod
|
||||
def detect(self):
|
||||
return os.path.exists('/opt/cray/craype')
|
||||
|
||||
|
||||
|
18
lib/spack/spack/architectures/darwin.py
Normal file
18
lib/spack/spack/architectures/darwin.py
Normal file
@ -0,0 +1,18 @@
|
||||
import subprocess
|
||||
from spack.architecture import Architecture, Target
|
||||
|
||||
class Darwin(Architecture):
|
||||
priority = 89
|
||||
front_end = 'x86_64'
|
||||
back_end = 'x86_64'
|
||||
default = 'x86_64'
|
||||
|
||||
def __init__(self):
|
||||
super(Darwin, self).__init__('darwin')
|
||||
self.add_target(self.default, Target(self.default))
|
||||
|
||||
@classmethod
|
||||
def detect(self):
|
||||
arch = subprocess.Popen(['uname', '-a'], stdout = subprocess.PIPE)
|
||||
arch, _ = arch.communicate()
|
||||
return 'darwin' in arch.strip().lower()
|
@ -2,7 +2,7 @@
|
||||
from spack.architecture import Architecture, Target
|
||||
|
||||
class Linux(Architecture):
|
||||
priority = 60
|
||||
priority = 90
|
||||
front_end = 'x86_64'
|
||||
back_end = 'x86_64'
|
||||
default = 'x86_64'
|
||||
@ -13,6 +13,6 @@ def __init__(self):
|
||||
|
||||
@classmethod
|
||||
def detect(self):
|
||||
arch = subprocess.Popen(['uname', '-i'], stdout = subprocess.PIPE)
|
||||
arch = subprocess.Popen(['uname', '-a'], stdout = subprocess.PIPE)
|
||||
arch, _ = arch.communicate()
|
||||
return 'linux' in arch.strip().lower()
|
||||
|
@ -31,7 +31,7 @@
|
||||
import spack
|
||||
|
||||
"""Names of tests to be included in Spack's test suite"""
|
||||
"""test_names = ['architecture',
|
||||
test_names = ['architecture',
|
||||
'versions',
|
||||
'url_parse',
|
||||
'url_substitution',
|
||||
@ -58,8 +58,7 @@
|
||||
'optional_deps',
|
||||
'make_executable',
|
||||
'configure_guess']
|
||||
"""
|
||||
test_names = ['architecture']
|
||||
|
||||
|
||||
def list_tests():
|
||||
"""Return names of all tests that can be run for Spack."""
|
||||
|
@ -2,18 +2,34 @@
|
||||
the functions are looking for the correct architecture name
|
||||
"""
|
||||
import unittest
|
||||
import os
|
||||
import platform
|
||||
import spack
|
||||
from spack.architecture import *
|
||||
from spack.architectures.cray import Cray
|
||||
from spack.architectures.linux import Linux
|
||||
from spack.architectures.bgq import Bgq
|
||||
|
||||
class ArchitectureTest(unittest.TestCase):
|
||||
|
||||
def test_Architecture_class(self):
|
||||
a = Architecture('Cray-XC40')
|
||||
a.add_arch_strategy()
|
||||
self.assertEquals(a.get_arch_dict(), {'Cray-XC40': 'MODULES'})
|
||||
def test_Architecture_class_and_compiler_strategies(self):
|
||||
a = Cray()
|
||||
t = a.target('default')
|
||||
self.assertEquals(t.compiler_strategy, 'MODULES')
|
||||
b = Linux()
|
||||
s = b.target('default')
|
||||
self.assertEquals(s.compiler_strategy, 'PATH')
|
||||
|
||||
def test_get_sys_type_from_config_file(self):
|
||||
output_arch_class = get_sys_type_from_config_file()
|
||||
my_arch_class = Architecture('Linux x86_64','Cray-xc40')
|
||||
def test_sys_type(self):
|
||||
output_arch_class = sys_type()
|
||||
my_arch_class = None
|
||||
if os.path.exists('/opt/cray/craype'):
|
||||
my_arch_class = Cray()
|
||||
elif os.path.exists('/bgsys'):
|
||||
my_arch_class = Bgq()
|
||||
elif 'Linux' in platform.system():
|
||||
my_arch_class = Linux()
|
||||
# elif 'Darwin' in platform.system():
|
||||
# my_arch_class = Darwin()
|
||||
|
||||
self.assertEqual(output_arch_class, my_arch_class)
|
||||
self.assertEqual(str(output_arch_class), str(my_arch_class))
|
||||
|
Loading…
Reference in New Issue
Block a user