Skip to content
Snippets Groups Projects
Commit 7ccf56a0 authored by Matt Belhorn's avatar Matt Belhorn Committed by Todd Gamblin
Browse files

Removes cyclic dependency on spack.config. (#2121)

Merge #2030 added a cyclic dependency between the Cray platform needing
to read a `targets.yaml` config file and `config.py` needing to get the
platform names.

This commit removes the cyclic dependency in favor of the more general
config scheme. It also removes the now functionless `targets.yaml`
config file. This breaks 'frontend' targets on the Cray platform but
all architecture targets, including the frontend, that are provided by
CrayPE are added to the Platform anyway so users can be explicit about
the architecture targeted by the Cray compiler wrappers:

```
spack spec libelf arch=cray-CNL-frontend
```

becomes

```
spack spec libelf arch=cray-CNL-mc8         # on an XK7 or
spack spec libelf arch=cray-CNL-sandybridge # on an older XC30, etc..
```

The only way the 'frontend' target can be defined after this commit is
through target environment variables.
parent a7143771
No related branches found
No related tags found
No related merge requests found
......@@ -179,7 +179,6 @@
'mirrors': spack.schema.mirrors.schema,
'repos': spack.schema.repos.schema,
'packages': spack.schema.packages.schema,
'targets': spack.schema.targets.schema,
'modules': spack.schema.modules.schema,
}
......
import os
import re
import spack.config
import llnl.util.tty as tty
from spack import build_env_path
from spack.util.executable import which
from spack.architecture import Platform, Target, NoPlatformError
from spack.operating_systems.linux_distro import LinuxDistro
......@@ -46,13 +46,10 @@ def __init__(self):
self.add_target(name, Target(name, 'craype-%s' % target))
# Get aliased targets from config or best guess from environment:
conf = spack.config.get_config('targets')
for name in ('front_end', 'back_end'):
_target = getattr(self, name, None)
if _target is None:
_target = os.environ.get('SPACK_' + name.upper())
if _target is None:
_target = conf.get(name)
if _target is None and name == 'back_end':
_target = self._default_target_from_env()
if _target is not None:
......@@ -82,7 +79,7 @@ def setup_platform_environment(cls, pkg, env):
similar to linux/standard linker behavior
"""
env.set('CRAYPE_LINK_TYPE', 'dynamic')
cray_wrapper_names = join_path(spack.build_env_path, 'cray')
cray_wrapper_names = join_path(build_env_path, 'cray')
if os.path.isdir(cray_wrapper_names):
env.prepend_path('PATH', cray_wrapper_names)
env.prepend_path('SPACK_ENV_PATH', cray_wrapper_names)
......
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
"""Schema for target configuration files."""
schema = {
'$schema': 'http://json-schema.org/schema#',
'title': 'Spack target configuration file schema',
'type': 'object',
'additionalProperties': False,
'patternProperties': {
r'targets:?': {
'type': 'object',
'default': {},
'additionalProperties': False,
'patternProperties': {
r'\w[\w-]*': { # target name
'type': 'string',
},
},
},
},
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment