Skip to content
Snippets Groups Projects
  1. Feb 25, 2020
  2. Feb 17, 2020
  3. Feb 14, 2020
  4. Feb 13, 2020
    • Todd Gamblin's avatar
      spack python: add -m option to run modules as scripts · a7b43f10
      Todd Gamblin authored
      It's often useful to run a module with `python -m`, e.g.:
      
          python -m pyinstrument script.py
      
      Running a python script this way was hard, though, as `spack python` did
      not have a similar `-m` option.  This PR adds a `-m` option to `spack
      python` so that we can do things like this:
      
          spack python -m pyinstrument ./test.py
      
      This makes it easy to write a script that uses a small part of Spack and
      then profile it.  Previously thee easiest way to do this was to write a
      custom Spack command, which is often overkill.
      a7b43f10
  5. Feb 07, 2020
  6. Feb 03, 2020
  7. Jan 31, 2020
    • Massimiliano Culpo's avatar
      `spack containerize` generates containers from envs (#14202) · 9635ff3d
      Massimiliano Culpo authored
      This PR adds a new command to Spack:
      ```console
      $ spack containerize -h
      usage: spack containerize [-h] [--config CONFIG]
      
      creates recipes to build images for different container runtimes
      
      optional arguments:
        -h, --help       show this help message and exit
        --config CONFIG  configuration for the container recipe that will be generated
      ```
      which takes an environment with an additional `container` section:
      ```yaml
      spack:
        specs:
        - gromacs build_type=Release 
        - mpich
        - fftw precision=float
        packages:
          all:
            target: [broadwell]
      
        container:
          # Select the format of the recipe e.g. docker,
          # singularity or anything else that is currently supported
          format: docker
          
          # Select from a valid list of images
          base:
            image: "ubuntu:18.04"
            spack: prerelease
      
          # Additional system packages that are needed at runtime
          os_packages:
          - libgomp1
      ```
      and turns it into a `Dockerfile` or a Singularity definition file, for instance:
      ```Dockerfile
      # Build stage with Spack pre-installed and ready to be used
      FROM spack/ubuntu-bionic:prerelease as builder
      
      # What we want to install and how we want to install it
      # is specified in a manifest file (spack.yaml)
      RUN mkdir /opt/spack-environment \
      &&  (echo "spack:" \
      &&   echo "  specs:" \
      &&   echo "  - gromacs build_type=Release" \
      &&   echo "  - mpich" \
      &&   echo "  - fftw precision=float" \
      &&   echo "  packages:" \
      &&   echo "    all:" \
      &&   echo "      target:" \
      &&   echo "      - broadwell" \
      &&   echo "  config:" \
      &&   echo "    install_tree: /opt/software" \
      &&   echo "  concretization: together" \
      &&   echo "  view: /opt/view") > /opt/spack-environment/spack.yaml
      
      # Install the software, remove unecessary deps and strip executables
      RUN cd /opt/spack-environment && spack install && spack autoremove -y
      RUN find -L /opt/view/* -type f -exec readlink -f '{}' \; | \
          xargs file -i | \
          grep 'charset=binary' | \
          grep 'x-executable\|x-archive\|x-sharedlib' | \
          awk -F: '{print $1}' | xargs strip -s
      
      
      # Modifications to the environment that are necessary to run
      RUN cd /opt/spack-environment && \
          spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh
      
      # Bare OS image to run the installed executables
      FROM ubuntu:18.04
      
      COPY --from=builder /opt/spack-environment /opt/spack-environment
      COPY --from=builder /opt/software /opt/software
      COPY --from=builder /opt/view /opt/view
      COPY --from=builder /etc/profile.d/z10_spack_environment.sh /etc/profile.d/z10_spack_environment.sh
      
      RUN apt-get -yqq update && apt-get -yqq upgrade                                   \
       && apt-get -yqq install libgomp1 \
       && rm -rf /var/lib/apt/lists/*
      
      ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l"]
      ```
      9635ff3d
  8. Jan 30, 2020
  9. Jan 25, 2020
  10. Jan 23, 2020
    • Todd Gamblin's avatar
      commands: add simple `spack commands --update-completion` argument (#14607) · 04a6a55c
      Todd Gamblin authored
      Instead of another script, this adds a simple argument to `spack
      commands` that updates the completion script.  Developers can now just
      run:
      
          spack commands --update-completion
      
      This should make it simpler for developers to remember to run this
      *before* the tests fail.  Also, this version tab-completes.
      04a6a55c
    • Greg Becker's avatar
      shell support: `spack load` no longer needs modules (#14062) · c9e01ff9
      Greg Becker authored
      
      Previously the `spack load` command was a wrapper around `module load`. This required some bootstrapping of modules to make `spack load` work properly.
      
      With this PR, the `spack` shell function handles the environment modifications necessary to add packages to your user environment. This removes the dependence on environment modules or lmod and removes the requirement to bootstrap spack (beyond using the setup-env scripts).
      
      Included in this PR is support for MacOS when using Apple's System Integrity Protection (SIP), which is enabled by default in modern MacOS versions. SIP clears the `LD_LIBRARY_PATH` and `DYLD_LIBRARY_PATH` variables on process startup for executables that live in `/usr` (but not '/usr/local', `/System`, `/bin`, and `/sbin` among other system locations. Spack cannot know the `LD_LIBRARY_PATH` of the calling process when executed using `/bin/sh` and `/usr/bin/python`. The `spack` shell function now manually forwards these two variables, if they are present, as `SPACK_<VAR>` and recovers those values on startup.
      
      - [x] spack load/unload no longer delegate to modules
      - [x] refactor user_environment modification calculations
      - [x] update documentation for spack load/unload
      
      Co-authored-by: default avatarTodd Gamblin <tgamblin@llnl.gov>
      c9e01ff9
    • Adam J. Stewart's avatar
      Use `spack commands --format=bash` to generate shell completion (#14393) · 11f2b612
      Adam J. Stewart authored
      
      This PR adds a `--format=bash` option to `spack commands` to
      auto-generate the Bash programmable tab completion script. It can be
      extended to work for other shells.
      
      Progress:
      
      - [x] Fix bug in superclass initialization in `ArgparseWriter`
      - [x] Refactor `ArgparseWriter` (see below)
      - [x] Ensure that output of old `--format` options remains the same
      - [x] Add `ArgparseCompletionWriter` and `BashCompletionWriter`
      - [x] Add `--aliases` option to add command aliases
      - [x] Standardize positional argument names
      - [x] Tests for `spack commands --format=bash` coverage
      - [x] Tests to make sure `spack-completion.bash` stays up-to-date
      - [x] Tests for `spack-completion.bash` coverage
      - [x] Speed up `spack-completion.bash` by caching subroutine calls
      
      This PR also necessitates a significant refactoring of
      `ArgparseWriter`. Previously, `ArgparseWriter` was mostly a single
      `_write` method which handled everything from extracting the information
      we care about from the parser to formatting the output. Now, `_write`
      only handles recursion, while the information extraction is split into a
      separate `parse` method, and the formatting is handled by `format`. This
      allows subclasses to completely redefine how the format will appear
      without overriding all of `_write`.
      
      Co-Authored-by: default avatarTodd Gamblin <tgamblin@llnl.gov>
      11f2b612
  11. Jan 14, 2020
    • Tom Scogland's avatar
      stop word splitting from leaking out of setup-env (#14472) · df8ee438
      Tom Scogland authored
      The pathadd function was using setopt to configure zsh for word
      splitting, which leaks out of the function and breaks default
      functionality in a number of external zsh plugins and packages.  This
      switches to emulate -L, just as the spack function uses, to keep the
      setting local to the function.
      df8ee438
  12. Jan 10, 2020
  13. Jan 07, 2020
  14. Jan 02, 2020
    • Todd Gamblin's avatar
      tests: improved `spack test` command line options · 4beb9fc5
      Todd Gamblin authored
      Previously, `spack test` automatically passed all of its arguments to
      `pytest -k` if no options were provided, and to `pytest` if they were.
      `spack test -l` also provided a list of test filenames, but they didn't
      really let you completely narrow down which tests you wanted to run.
      
      Instead of trying to do our own weird thing, this passes `spack test`
      args directly to `pytest`, and omits the implicit `-k`.  This means we
      can now run, e.g.:
      
      ```console
      $ spack test spec_syntax.py::TestSpecSyntax::test_ambiguous
      ```
      
      This wasn't possible before, because we'd pass the fully qualified name
      to `pytest -k` and get an error.
      
      Because `pytest` doesn't have the greatest ability to list tests, I've
      tweaked the `-l`/`--list`, `-L`/`--list-long`, and `-N`/`--list-names`
      options to `spack test` so that they help you understand the names
      better.  you can combine these options with `-k` or other arguments to do
      pretty powerful searches.
      
      This one makes it easy to get a list of names so you can run tests in
      different orders (something I find useful for debugging `pytest` issues):
      
      ```console
      $ spack test --list-names -k "spec and concretize"
      cmd/env.py::test_concretize_user_specs_together
      concretize.py::TestConcretize::test_conflicts_in_spec
      concretize.py::TestConcretize::test_find_spec_children
      concretize.py::TestConcretize::test_find_spec_none
      concretize.py::TestConcretize::test_find_spec_parents
      concretize.py::TestConcretize::test_find_spec_self
      concretize.py::TestConcretize::test_find_spec_sibling
      concretize.py::TestConcretize::test_no_matching_compiler_specs
      concretize.py::TestConcretize::test_simultaneous_concretization_of_specs
      spec_dag.py::TestSpecDag::test_concretize_deptypes
      spec_dag.py::TestSpecDag::test_copy_concretized
      ```
      
      You can combine any list option with keywords:
      
      ```console
      $ spack test --list -k microarchitecture
      llnl/util/cpu.py  modules/lmod.py
      ```
      
      ```console
      $ spack test --list-long -k microarchitecture
      llnl/util/cpu.py::
          test_generic_microarchitecture
      
      modules/lmod.py::TestLmod::
          test_only_generic_microarchitectures_in_root
      ```
      
      Or just list specific files:
      
      ```console
      $ spack test --list-long cmd/test.py
      cmd/test.py::
          test_list                       test_list_names_with_pytest_arg
          test_list_long                  test_list_with_keywords
          test_list_long_with_pytest_arg  test_list_with_pytest_arg
          test_list_names
      ```
      
      Hopefully this stuff will help with debugging test issues.
      
      - [x] make `spack test` send args directly to `pytest` instead of trying
        to do fancy things.
      - [x] rework `--list`, `--list-long`, and add `--list-names` to make
        searching for tests easier.
      - [x] make it possible to mix Spack's list args with `pytest` args
        (they're just fancy parsing around `pytest --collect-only`)
      - [x] add docs
      - [x] add tests
      - [x] update spack completion
      4beb9fc5
  15. Dec 31, 2019
  16. Dec 28, 2019
  17. Dec 25, 2019
    • Massimiliano Culpo's avatar
      Migrate build tests from Travis to Github Actions (#13967) · 2aa8132a
      Massimiliano Culpo authored
      This PR moves build smoke tests from TravisCI and migrates them to Github Actions. The result is that build tests are performed in parallel with unit tests and they don't hog additional resources on Travis. The workflow will not run if a PR only changes packages in the built-in repository, but will always run on pushes to develop or master.
      
      * Removed build tests from Travis and passed them to Github Actions
      * Store ~/.ccache in Github Actions cache
      * Add filters on paths and make sure this workflow don't run
      * Use paths-ignore and exclude only files in the built-in repo
      * Added a badge to README.md
      2aa8132a
  18. Dec 24, 2019
    • Massimiliano Culpo's avatar
      Travis exits at the first failing test, pin codecov at v4.5.4 (#14179) · 8616a264
      Massimiliano Culpo authored
      Before this commit we used to run the entire unit test suite
      in the presence of a failure. Since we currently rely a lot
      on the state of the filesystem etc. the end report was most
      of the time showing spurious failures that were a consequence
      of the first failing test.
      
      This PR makes unit tests exit at the first failing test
      
      Also, pin codecov at v4.5.4 (last one supporting Python 2.6)
      8616a264
  19. Dec 16, 2019
  20. Dec 13, 2019
  21. Nov 26, 2019
    • Axel Huebl's avatar
      Package Index: Build in Dockerhub (#13810) · 7a81c37b
      Axel Huebl authored
      * Package Index: Build in Dockerhub
      
      Prepare to build the package index service, packages.spack.io,
      on Dockerhub.
      
      Local build (in spack root dir):
      ```
      docker build -t spack/packages.spack.io:latest -f share/spack/docker/package-index/Dockerfile .
      ```
      
      Local test:
      ```
      docker run -p 8080:80 spack/packages.spack.io:latest
      ```
      
      * Travis-CI: Remove Docker
      
      Remove leftover docker stages from Travis-CI.
      
      * Simplify Split Call
      7a81c37b
  22. Nov 22, 2019
  23. Oct 25, 2019
  24. Oct 21, 2019
    • Massimiliano Culpo's avatar
      Bootstrap environment modules optimizing for generic architectures (#13105) · 3d77ecd9
      Massimiliano Culpo authored
      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
      3d77ecd9
  25. Oct 15, 2019
    • Massimiliano Culpo's avatar
      lmod: module files are written in a root folder named by target family (#13121) · d33b0ffc
      Massimiliano Culpo authored
      fixes #13005
      
      This commit fixes an issue with the name of the root directory for
      module file hierarchies. Since #3206 the root folder was named after
      the microarchitecture used for the spec, which is too specific and
      not backward compatible for lmod hierarchies. Here we compute the
      root folder name using the target family instead of the target name
      itself and we add target information in the 'whatis' portion of the
      module file.
      d33b0ffc
  26. Oct 03, 2019
    • Massimiliano Culpo's avatar
      Remove support for generating dotkit files (#11986) · 76b9c561
      Massimiliano Culpo authored
      Dotkit is being used only at a few sites and has been deprecated on new
      machines. This commit removes all the code that provide support for the
      generation of dotkit module files.
      
      A new validator named "deprecatedProperties" has been added to the
      jsonschema validators. It permits to prompt a warning message or exit
      with an error if a property that has been marked as deprecated is
      encountered.
      
      * Removed references to dotkit in the docs
      * Removed references to dotkit in setup-env-test.sh
      * Added a unit test for the 'deprecatedProperties' schema validator
      76b9c561
  27. Oct 02, 2019
    • Massimiliano Culpo's avatar
      Add all compatible system types directory to module paths · 1b18ec90
      Massimiliano Culpo authored
      fixes #12915
      closes #12916
      
      Since Spack has support for specific targets it might happen that
      software is built for targets that are not exactly the host because
      it was either an explicit user request or the compiler being used is
      too old to support the host.
      
      Modules for different targets are written into different directories
      and by default Spack was adding to MODULEPATH only the directory
      corresponding to the current host. This PR modifies this behavior to
      add all the directories that are **compatible** with the current host.
      1b18ec90
  28. Sep 20, 2019
  29. Sep 14, 2019
  30. Sep 12, 2019
  31. Sep 10, 2019
  32. Sep 09, 2019
Loading