summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2019-10-21 20:20:05 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2019-10-21 11:20:05 -0700
commit3d77ecd92e0ccc950daf30468ec2ef591668d8eb (patch)
tree7bcc6da6dcf9bca186a5fe9e18471adc524416f1
parent498f448ef353eed906a100752b2c1598423a7276 (diff)
downloadspack-3d77ecd92e0ccc950daf30468ec2ef591668d8eb.tar.gz
spack-3d77ecd92e0ccc950daf30468ec2ef591668d8eb.tar.bz2
spack-3d77ecd92e0ccc950daf30468ec2ef591668d8eb.tar.xz
spack-3d77ecd92e0ccc950daf30468ec2ef591668d8eb.zip
Bootstrap environment modules optimizing for generic architectures (#13105)
fixes #13073 Since #3206 was merged bootstrapping environment-modules was using the architecture of the current host or the best match supported by the default compiler. The former case is an issue since shell integration was looking for a spec targeted at the host microarchitecture. 1. Bootstrap an env modules targeted at generic architectures 2. Look for generic targets in shell integration scripts 3. Add a new entry in Travis to test shell integration
-rw-r--r--.travis.yml5
-rw-r--r--lib/spack/spack/cmd/bootstrap.py8
-rw-r--r--lib/spack/spack/main.py6
-rwxr-xr-xshare/spack/qa/run-bootstrap-tests37
4 files changed, 53 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml
index 33c0346eaf..1f5b82c811 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,6 +22,11 @@ jobs:
os: linux
language: python
env: TEST_SUITE=flake8
+# Shell integration with module files
+ - python: '3.7'
+ os: linux
+ language: python
+ env: [ TEST_SUITE=bootstrap ]
- stage: 'unit tests + documentation'
python: '2.6'
dist: trusty
diff --git a/lib/spack/spack/cmd/bootstrap.py b/lib/spack/spack/cmd/bootstrap.py
index 71db75c788..96cb8ccaa9 100644
--- a/lib/spack/spack/cmd/bootstrap.py
+++ b/lib/spack/spack/cmd/bootstrap.py
@@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import llnl.util.cpu
import llnl.util.tty as tty
import spack.repo
@@ -56,7 +57,12 @@ def bootstrap(parser, args, **kwargs):
# Define requirement dictionary defining general specs which need
# to be satisfied, and the specs to install when the general spec
# isn't satisfied.
- requirement_dict = {'environment-modules': 'environment-modules~X'}
+ requirement_dict = {
+ # Install environment-modules with generic optimizations
+ 'environment-modules': 'environment-modules~X target={0}'.format(
+ llnl.util.cpu.host().family
+ )
+ }
for requirement in requirement_dict:
installed_specs = spack.store.db.query(requirement)
diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py
index 89b4d3dc85..ff2ff74da3 100644
--- a/lib/spack/spack/main.py
+++ b/lib/spack/spack/main.py
@@ -20,6 +20,7 @@ import traceback
import warnings
from six import StringIO
+import llnl.util.cpu
import llnl.util.tty as tty
import llnl.util.tty.color as color
from llnl.util.tty.log import log_output
@@ -621,8 +622,9 @@ def print_setup_info(*info):
# print environment module system if available. This can be expensive
# on clusters, so skip it if not needed.
if 'modules' in info:
- specs = spack.store.db.query(
- 'environment-modules arch=%s' % spack.architecture.sys_type())
+ generic_arch = llnl.util.cpu.host().family
+ module_spec = 'environment-modules target={0}'.format(generic_arch)
+ specs = spack.store.db.query(module_spec)
if specs:
shell_set('_sp_module_prefix', specs[-1].prefix)
else:
diff --git a/share/spack/qa/run-bootstrap-tests b/share/spack/qa/run-bootstrap-tests
new file mode 100755
index 0000000000..346122c529
--- /dev/null
+++ b/share/spack/qa/run-bootstrap-tests
@@ -0,0 +1,37 @@
+#!/bin/bash -e
+#
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+#
+# Description:
+# Checks that Spack shell integration with modules works correctly.
+#
+# Usage:
+# run-bootstrap-tests
+#
+. "$(dirname $0)/setup.sh"
+check_dependencies ${coverage} git hg svn
+
+# Fetch the sources in a mirror, and add it to Spack
+mkdir -p ~/.mirror
+bin/spack mirror add travis ~/.mirror
+bin/spack mirror create -D -d ~/.mirror environment-modules~X
+
+
+# Move to root directory of Spack
+# Allows script to be run from anywhere
+cd "$SPACK_ROOT"
+
+# Print compiler information
+spack config get compilers
+
+# Run some build smoke tests, potentially with code coverage
+${coverage_run} bin/spack bootstrap
+
+# Check module integration
+. "share/spack/setup-env.sh"
+module av || exit 1
+spack load tcl || exit 1