fixed errors caused by crayport on linux and added a darwin architecture
This commit is contained in:
parent
d2c2c46541
commit
9848ad32fd
@ -96,6 +96,8 @@ def __repr__(self):
|
|||||||
return self.__str__()
|
return self.__str__()
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
if self.module_name:
|
||||||
|
return self.name + ' module: ' + self.module_name
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
@key_ordering
|
@key_ordering
|
||||||
|
@ -6,8 +6,7 @@ class Cray(Architecture):
|
|||||||
priority = 20
|
priority = 20
|
||||||
front_end = 'sandybridge'
|
front_end = 'sandybridge'
|
||||||
back_end = 'ivybridge'
|
back_end = 'ivybridge'
|
||||||
default = os.environ['CRAY_CPU_TARGET']
|
default = 'ivybridge'
|
||||||
#default = 'ivybridge'
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
''' Since cori doesn't have ivybridge as a front end it's better
|
''' Since cori doesn't have ivybridge as a front end it's better
|
||||||
@ -16,12 +15,16 @@ def __init__(self):
|
|||||||
'''
|
'''
|
||||||
super(Cray, self).__init__('cray')
|
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.
|
# 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))
|
self.add_target(self.default, Target(self.default,'craype-' + self.default))
|
||||||
# Could switch to use modules and fe targets for front end
|
# Could switch to use modules and fe targets for front end
|
||||||
# Currently using compilers by path 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
|
@classmethod
|
||||||
|
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
|
from spack.architecture import Architecture, Target
|
||||||
|
|
||||||
class Linux(Architecture):
|
class Linux(Architecture):
|
||||||
priority = 60
|
priority = 90
|
||||||
front_end = 'x86_64'
|
front_end = 'x86_64'
|
||||||
back_end = 'x86_64'
|
back_end = 'x86_64'
|
||||||
default = 'x86_64'
|
default = 'x86_64'
|
||||||
@ -13,6 +13,6 @@ def __init__(self):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def detect(self):
|
def detect(self):
|
||||||
arch = subprocess.Popen(['uname', '-i'], stdout = subprocess.PIPE)
|
arch = subprocess.Popen(['uname', '-a'], stdout = subprocess.PIPE)
|
||||||
arch, _ = arch.communicate()
|
arch, _ = arch.communicate()
|
||||||
return 'linux' in arch.strip().lower()
|
return 'linux' in arch.strip().lower()
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
import spack
|
import spack
|
||||||
|
|
||||||
"""Names of tests to be included in Spack's test suite"""
|
"""Names of tests to be included in Spack's test suite"""
|
||||||
"""test_names = ['architecture',
|
test_names = ['architecture',
|
||||||
'versions',
|
'versions',
|
||||||
'url_parse',
|
'url_parse',
|
||||||
'url_substitution',
|
'url_substitution',
|
||||||
@ -58,8 +58,7 @@
|
|||||||
'optional_deps',
|
'optional_deps',
|
||||||
'make_executable',
|
'make_executable',
|
||||||
'configure_guess']
|
'configure_guess']
|
||||||
"""
|
|
||||||
test_names = ['architecture']
|
|
||||||
|
|
||||||
def list_tests():
|
def list_tests():
|
||||||
"""Return names of all tests that can be run for Spack."""
|
"""Return names of all tests that can be run for Spack."""
|
||||||
|
@ -2,18 +2,34 @@
|
|||||||
the functions are looking for the correct architecture name
|
the functions are looking for the correct architecture name
|
||||||
"""
|
"""
|
||||||
import unittest
|
import unittest
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
import spack
|
import spack
|
||||||
from spack.architecture import *
|
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):
|
class ArchitectureTest(unittest.TestCase):
|
||||||
|
|
||||||
def test_Architecture_class(self):
|
def test_Architecture_class_and_compiler_strategies(self):
|
||||||
a = Architecture('Cray-XC40')
|
a = Cray()
|
||||||
a.add_arch_strategy()
|
t = a.target('default')
|
||||||
self.assertEquals(a.get_arch_dict(), {'Cray-XC40': 'MODULES'})
|
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):
|
def test_sys_type(self):
|
||||||
output_arch_class = get_sys_type_from_config_file()
|
output_arch_class = sys_type()
|
||||||
my_arch_class = Architecture('Linux x86_64','Cray-xc40')
|
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