Skip to content

Features/frontend default build#2292

Merged
tgamblin merged 1 commit intospack:developfrom
scheibelp:features/frontend-default-build
Dec 8, 2016
Merged

Features/frontend default build#2292
tgamblin merged 1 commit intospack:developfrom
scheibelp:features/frontend-default-build

Conversation

@scheibelp
Copy link
Copy Markdown
Member

@scheibelp scheibelp commented Nov 10, 2016

A few notes:

-whether a dependency is a build dep is determined by checking whether one can reach the root by traversing link deps
-link dependencies of build deps should be built with the frontend compiler
-if a parent links to a dependency of a build dep however, that may not always be the case (I think this is mostly handled)

Also this appears to significantly boost concretization time as-is.

@scheibelp scheibelp added the WIP label Nov 10, 2016
@pramodk
Copy link
Copy Markdown
Contributor

pramodk commented Nov 10, 2016

Quickly trying example discussed in #1980 :

spack spec parmetis ^mpich
Input spec
--------------------------------
parmetis
    ^mpich

Normalized
--------------------------------
parmetis
    ^[email protected]:
    ^metis@5:
    ^mpich

Concretized
--------------------------------
[email protected]%[email protected]~debug~gdb+shared arch=bgq-cnk-powerpc
    ^[email protected]%[email protected]~doc+ncurses+openssl~ownlibs~qt arch=bgq-rhel6-power7
        ^[email protected]%[email protected] arch=bgq-rhel6-power7
        ^[email protected]%[email protected] arch=bgq-rhel6-power7
            ^[email protected]%[email protected] arch=bgq-rhel6-power7
                ^[email protected]%[email protected] arch=bgq-rhel6-power7
        ^[email protected]%[email protected] arch=bgq-rhel6-power7
        ^[email protected]%[email protected] arch=bgq-rhel6-power7
            ^[email protected]%[email protected]~python arch=bgq-rhel6-power7
                ^[email protected]%[email protected] arch=bgq-rhel6-power7
            ^lz4@131%[email protected] arch=bgq-rhel6-power7
            ^[email protected]%[email protected] arch=bgq-rhel6-power7
            ^[email protected]%[email protected] arch=bgq-rhel6-power7
            ^[email protected]%[email protected] arch=bgq-rhel6-power7
                ^[email protected]%[email protected] arch=bgq-rhel6-power7
                    ^[email protected]%[email protected]+sigsegv arch=bgq-rhel6-power7
                        ^[email protected]%[email protected] arch=bgq-rhel6-power7
        ^[email protected]%[email protected] arch=bgq-rhel6-power7
    ^[email protected]%[email protected]~debug~gdb~idx64~real64+shared arch=bgq-cnk-powerpc
    ^[email protected]%[email protected]+hydra+pmi+romio~verbs arch=bgq-cnk-powerpc

So this looks good! thank you @scheibelp!

@scheibelp
Copy link
Copy Markdown
Member Author

Thanks for checking that!

It looks like in this case this chose to compile everything with [email protected]

I may be able to tweak this so things that arent build deps do their own separate resolution. In the meantime, specifying xl for the top-level dep should get the result you are looking for.

@scheibelp
Copy link
Copy Markdown
Member Author

I just noticed that I'm not detecting whether a package is a build dep correctly 100% of the time. Once I fix that I expect this to work

@scheibelp
Copy link
Copy Markdown
Member Author

scheibelp commented Nov 11, 2016

Looking into this, I appear to have confused myself and stumbled upon a bug (namely I was explicitly mentioning cmake in a spec and it showed up as a link deptype). I'll report the issue shortly. In the meantime I expect this to work as intended. I think it slows down concretization by 20-30%.

EDIT: I when I ran the tests for this branch compared to develop it didnt take longer - I guess that was in my head

@pramodk
Copy link
Copy Markdown
Contributor

pramodk commented Nov 11, 2016

Looks like there is a bug now :

./bin/spack spec parmetis
Input spec
--------------------------------
parmetis

Normalized
--------------------------------
parmetis
    ^[email protected]:
    ^metis@5:
    ^mpi

Concretized
--------------------------------
==> Error: Multiple compilers satisfy spec [email protected]

This is when I add xl as preferred compiler in ~/.spack/bgq/packages.yaml as:

packages:
    all:
        compiler: [xl,gcc]

It's true that there are multiple compilers satisfying spec [email protected] but they are for different os (fronted-backend) :

$ cat ~/.spack/bgq/compilers.yaml
compilers:
- compiler:
    flags: {}
    modules: []
    operating_system: rhel6
    paths:
      cc: /usr/lib64/ccache/gcc
      cxx: /usr/lib64/ccache/g++
      f77: /usr/bin/gfortran
      fc: /usr/bin/gfortran
    spec: [email protected]
- compiler:
    flags: {}
    modules: []
    operating_system: cnk
    paths:
      cc: /usr/lib64/ccache/gcc
      cxx: /usr/lib64/ccache/g++
      f77: /usr/bin/gfortran
      fc: /usr/bin/gfortran
    spec: [email protected]
- compiler:
    flags: {}
    modules: []
    operating_system: rhel6
    paths:
      cc: /opt/ibmcmp/vacpp/bg/12.1/bin/xlc_r
      cxx: /opt/ibmcmp/vacpp/bg/12.1/bin/xlc++
      f77: /opt/ibmcmp/xlf/bg/14.1/bin/xlf_r
      fc: /opt/ibmcmp/xlf/bg/14.1/bin/xlf2008
    spec: [email protected]
- compiler:
    flags: {}
    modules: []
    operating_system: cnk
    paths:
      cc: /opt/ibmcmp/vacpp/bg/12.1/bin/xlc_r
      cxx: /opt/ibmcmp/vacpp/bg/12.1/bin/xlc++
      f77: /opt/ibmcmp/xlf/bg/14.1/bin/xlf_r
      fc: /opt/ibmcmp/xlf/bg/14.1/bin/xlf2008
    spec: [email protected]

Note that this doesn't happen with gcc even though there are multiple specs.

@scheibelp
Copy link
Copy Markdown
Member Author

Thanks for checking this I will try to look at this tonight.

@scheibelp
Copy link
Copy Markdown
Member Author

@pramodk I'm having some trouble replicating this and also theorizing what is causing the problem. Would you be able to include what is printed by rerunning that command (I added some print statements to output more info)?

One possibility: do you have a compilers.yaml in the spack installation directory (in addition to ~/.spack)? The printout should reveal this plus some extra information.

Thanks!
Peter

@pramodk
Copy link
Copy Markdown
Contributor

pramodk commented Nov 11, 2016

@scheibelp : I should mention few additional details :

  • On our system I am seeing Issues with cYAML on BG/Q #2027. Hence I was previously use some additional local changes that I have in my branch.

  • I am starting from beginning with below steps :

    • Use latest develop branch
    • Use following three PR's to make spack working on bg-q
    git fetch upstream pull/2292/head:bgq_frontend
    git fetch upstream pull/1980/head:bgq_os
    git fetch upstream pull/2189/head:yaml_json
    
    merge all above three PRs with develop. Resolve conflict with `lib/spack/spack/spec.py` (from yaml related PR).
    • here is the branch the branch that I created using above steps.

Now trying spack :

○ → rm -rf ~/.spack

○ → spack compiler find
spack arch==> Added 2 new compilers to /somepath/home/kumbhar/.spack/bgq/compilers.yaml
    [email protected]  [email protected]

 ○ → spack arch
bgq-cnk-ppc64

 ○ → spack spec parmetis
Input spec
--------------------------------
parmetis

Normalized
--------------------------------
parmetis
    ^[email protected]:
    ^metis@5:
    ^mpi

Concretized
--------------------------------
Traceback (most recent call last):
  File "/somepath//spack/bin/spack", line 195, in <module>
    main()
  File "/somepath//spack/bin/spack", line 172, in main
    return_val = command(parser, args)
  File "/somepath//spack/lib/spack/spack/cmd/spec.py", line 78, in spec
    spec.concretize()
  File "/somepath//spack/lib/spack/spack/spec.py", line 1354, in concretize
    self._concretize_helper())
  File "/somepath//spack/lib/spack/spack/spec.py", line 1175, in _concretize_helper
    changed |= dep.spec._concretize_helper(presets, visited)
  File "/somepath//spack/lib/spack/spack/spec.py", line 1185, in _concretize_helper
    (spack.concretizer.concretize_architecture(self),
  File "/somepath//spack/lib/spack/spack/concretize.py", line 309, in concretize_architecture
    self._concretize_operating_system(spec),
  File "/somepath//spack/lib/spack/spack/concretize.py", line 249, in _concretize_operating_system
    if spec.build_dep():
  File "/somepath//spack/lib/spack/spack/spec.py", line 608, in __getattr__
    raise AttributeError()
AttributeError

I don't have any other changes in spack install directory. Am I missing anything here? Or should test somewhat differently?

@pramodk
Copy link
Copy Markdown
Contributor

pramodk commented Nov 11, 2016

Oops....wait a minute, there is something I have in my config:

$ rm -rf ~/.spack
$ ./bin/spack config get compilers
compilers:
- compiler:
    modules: []
    operating_system: CNK
    paths:
      cc: /usr/bin/bgxlc_r
      cxx: /usr/bin/bgxlc++
      f77: /usr/bin/bgxlf_r
      fc: /usr/bin/bgxlf2008
    spec: [email protected]

So certainly CNK is something that I have locally. Let me fix that!

Edit : Ok so there was an old entry in etc/spack/defaults/bgq/ which I removed. With this I still see below:

$ git clean -fd 

# I have manually updated compilers.yaml to point to correct cnk compilers

$ ./bin/spack config get compilers
compilers:
- compiler:
    environment: {}
    extra_rpaths: []
    flags: {}
    modules: []
    operating_system: rhel6
    paths:
      cc: /usr/lib64/ccache/gcc
      cxx: /usr/lib64/ccache/g++
      f77: /usr/bin/gfortran
      fc: /usr/bin/gfortran
    spec: [email protected]
- compiler:
    modules: []
    operating_system: cnk
    paths:
      cc: /bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc64-bgq-linux-gcc
      cxx: /bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc64-bgq-linux-g++
      f77: /bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc64-bgq-linux-gfortran
      fc: /bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc64-bgq-linux-gfortran
    spec: [email protected]


$ ./bin/spack config get config

config:
  build_stage:
  - $tempdir
  - /nfs/tmp2/$user
  - $spack/var/spack/stage
  checksum: true
  dirty: false
  install_tree: $spack/opt/spack
  misc_cache: ~/.spack/cache
  module_roots:
    dotkit: $spack/share/spack/dotkit
    lmod: $spack/share/spack/lmod
    tcl: $spack/share/spack/modules
  source_cache: $spack/var/spack/cache
  verify_ssl: true


$ ./bin/spack spec parmetis

Input spec
--------------------------------
parmetis

Normalized
--------------------------------
parmetis
    ^[email protected]:
    ^metis@5:
    ^mpi

Concretized
--------------------------------
Traceback (most recent call last):
  File "./bin/spack", line 195, in <module>
    main()
  File "./bin/spack", line 172, in main
    return_val = command(parser, args)
  File "/some-path/spack-bgq/lib/spack/spack/cmd/spec.py", line 78, in spec
    spec.concretize()
  File "/some-path/spack-bgq/lib/spack/spack/spec.py", line 1354, in concretize
    self._concretize_helper())
  File "/some-path/spack-bgq/lib/spack/spack/spec.py", line 1175, in _concretize_helper
    changed |= dep.spec._concretize_helper(presets, visited)
  File "/some-path/spack-bgq/lib/spack/spack/spec.py", line 1185, in _concretize_helper
    (spack.concretizer.concretize_architecture(self),
  File "/some-path/spack-bgq/lib/spack/spack/concretize.py", line 309, in concretize_architecture
    self._concretize_operating_system(spec),
  File "/some-path/spack-bgq/lib/spack/spack/concretize.py", line 249, in _concretize_operating_system
    if spec.build_dep():
  File "/some-path/spack-bgq/lib/spack/spack/spec.py", line 608, in __getattr__
    raise AttributeError()
AttributeError

@scheibelp
Copy link
Copy Markdown
Member Author

  File "/somepath//spack/lib/spack/spack/concretize.py", line 249, in _concretize_operating_system
    if spec.build_dep():
  File "/somepath//spack/lib/spack/spack/spec.py", line 608, in __getattr__
    raise AttributeError()

build_dep is a function I added for this PR. When I check spec.py in the branch you linked (https://github.com/pramodk/spack/tree/bgq_develop) I don't see this function. Perhaps this was omitted during your merge?

Based on the above it seems like the issue could in fact have been caused by duplicate compiler definition. I'll revert the debugging commit for now and I can bring it back if the problem returns.

Thanks!

@pramodk
Copy link
Copy Markdown
Contributor

pramodk commented Nov 11, 2016

@scheibelp : I was too quick to merge different PR's and I made mistake! Sorry!
Everything looks fine with this PR. XL and GCC concretisation preferences are working fine!

# with compiler: [xl, gcc]

$ ./bin/spack spec parmetis ^mpich
Input spec
--------------------------------
parmetis
    ^mpich

Normalized
--------------------------------
parmetis
    ^[email protected]:
    ^metis@5:
    ^mpich

Concretized
--------------------------------
[email protected]%[email protected]~debug~gdb+shared arch=bgq-cnk-ppc64
    ^[email protected]%[email protected]~doc+ncurses+openssl~ownlibs~qt arch=bgq-rhel6-power7
        ^[email protected]%[email protected] arch=bgq-rhel6-power7
        ^[email protected]%[email protected] arch=bgq-rhel6-power7
            ^[email protected]%[email protected] arch=bgq-rhel6-power7
                ^[email protected]%[email protected] arch=bgq-rhel6-power7
        ^[email protected]%[email protected] arch=bgq-rhel6-power7
        ^[email protected]%[email protected] arch=bgq-rhel6-power7
            ^[email protected]%[email protected]~python arch=bgq-rhel6-power7
                ^[email protected]%[email protected] arch=bgq-rhel6-power7
            ^lz4@131%[email protected] arch=bgq-rhel6-power7
            ^[email protected]%[email protected] arch=bgq-rhel6-power7
            ^[email protected]%[email protected] arch=bgq-rhel6-power7
            ^[email protected]%[email protected] arch=bgq-rhel6-power7
                ^[email protected]%[email protected] arch=bgq-rhel6-power7
                    ^[email protected]%[email protected]+sigsegv arch=bgq-rhel6-power7
                        ^[email protected]%[email protected] arch=bgq-rhel6-power7
        ^[email protected]%[email protected] arch=bgq-rhel6-power7
    ^[email protected]%[email protected]~debug~gdb~idx64~real64+shared arch=bgq-cnk-ppc64
    ^[email protected]%[email protected]+hydra+pmi+romio~verbs arch=bgq-cnk-ppc64

@scheibelp
Copy link
Copy Markdown
Member Author

scheibelp commented Nov 11, 2016

Great! Thanks again for checking this! I'll work on doing clean up and add tests for this.

EDIT: hopefully by 7pm PST

@xjrc
Copy link
Copy Markdown
Member

xjrc commented Nov 12, 2016

Just as a heads up, it looks like this PR and #2261 are going to have some non-trivial conflicts in spack/spec/concretize.py. If #2261 ends up getting merged first, I'll follow up here to help out with resolving the conflicts.

@scheibelp
Copy link
Copy Markdown
Member Author

scheibelp commented Nov 12, 2016

@xjrc Thanks for that!

A cursory glance tells me it shouldn't be too bad: the more complex logic was in concretize_compiler and it doesnt appear that it will be affected. I'll just have to translate my logic to pick out the frontend os/target for build deps in concretize_compiler (EDIT) concretize_architecture (and I think I can see how that would look).

In any case I should be able to get this up to date within a few hours of #2261 merging.

@scheibelp scheibelp force-pushed the features/frontend-default-build branch from a9c620c to 2c9122f Compare November 12, 2016 09:57
@scheibelp
Copy link
Copy Markdown
Member Author

I think this is in a good spot now so I'll remove the WIP tag. I can update and resolve conflicts when #2261 is merged

@scheibelp scheibelp removed the WIP label Nov 12, 2016
@scheibelp scheibelp force-pushed the features/frontend-default-build branch from 2c9122f to 1dd4ea5 Compare December 1, 2016 01:22
@tgamblin
Copy link
Copy Markdown
Member

tgamblin commented Dec 5, 2016

@scheibelp: #2261 is merged now. Can you rebase this one?

@becker33 See this PR for the 0.10 release.

@scheibelp
Copy link
Copy Markdown
Member Author

@becker33 IIRC you mentioned taking a crack at merging this yourself. Did you start on that? If not I can do that by tomorrow.

@becker33
Copy link
Copy Markdown
Member

becker33 commented Dec 6, 2016

@scheibelp I think it may be easier for you to do it, since you know your code better than I will. I've started to familiarize myself with, but I'm not there yet..

@scheibelp
Copy link
Copy Markdown
Member Author

Makes sense! I'll do the rebase

@scheibelp scheibelp force-pushed the features/frontend-default-build branch 2 times, most recently from 386be4c to 1763b5a Compare December 7, 2016 04:03
@scheibelp
Copy link
Copy Markdown
Member Author

Rebase complete

I'll note from the commit message:

This also treats run dependencies the same as build dependencies, so they are also built against the frontend by default and get compiler information from build/run deps.

I can alter that if desired

@scheibelp scheibelp force-pushed the features/frontend-default-build branch 3 times, most recently from fc311d1 to 43f18d5 Compare December 7, 2016 05:13
@becker33
Copy link
Copy Markdown
Member

becker33 commented Dec 7, 2016

I believe we want run dependencies to default similarly to link dependencies.

@scheibelp
Copy link
Copy Markdown
Member Author

OK I'll update to that behavior (it will be ready this afternoon)

Packages built targeting a backend may depend on packages like cmake
which can be built against the frontend. With this commit, any build
dependency or child of a build dependency will target the frontend by
default. In compiler concretization when packages copy compilers from
nearby packages, build dependencies use compiler information from
other build dependencies, and link dependencies avoid using compiler
information from build dependencies.
@scheibelp scheibelp force-pushed the features/frontend-default-build branch from 43f18d5 to c154909 Compare December 7, 2016 20:44
@scheibelp
Copy link
Copy Markdown
Member Author

Behavior is now updated to only prefer frontend for build deps (or dependencies of build deps that are not link/run dependencies for the root). Commit message also updated.

@tgamblin tgamblin merged commit 30daf95 into spack:develop Dec 8, 2016
@tgamblin
Copy link
Copy Markdown
Member

tgamblin commented Dec 8, 2016

@scheibelp: Thanks!


def __str__(self):
return self.name
return self.name + self.version
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scheibelp: I just realized post-merging that this might affect the Cray folks. @robertdfrench @mpbelhorn @mamelara @KineticTheory: is this going to confuse your spack instances? I believe we should have a number on the CNL OS, but previously we weren't appending a version to it.

@mpbelhorn
Copy link
Copy Markdown
Contributor

@tgamblin Yes, this would probably confuse our Spack instances if we updated Spack in-place. But that's OK, because we don't update Spack in-place.


For anyone who has concerns about this sort of potential problem, the following is how we avoid it.

When we sync with upstream, we rebuild the entire software stack that we provide in a new location. Previously, this was an entirely different Spack instance in a new location, however the newly configurable install_tree should allow us to update Spack in-place, but 'abandon' previously installed packages in their own install_tree.

Leaving the older installed packages in-place on disk, but ignored by Spack allows us to avoid discontinuities regarding provided software and no worry about name clashes/changes. Our Spack deploys are hidden from users. We point them to installed packages through customized modulefiles in a public place and only update them to point to the new stack once everything is built anew.

@scheibelp
Copy link
Copy Markdown
Member Author

I just realized post-merging that this might affect the Cray folks.

This change can be reverted with no effect. I made it because while looking into something I noticed the compilers for CNL weren't found in the tests (the tests do not actually set the CNL as the backend anymore). I reverted this change at: #2526

@tgamblin
Copy link
Copy Markdown
Member

tgamblin commented Dec 8, 2016

@mpbelhorn @mamelara: Thanks -- that's helpful.

Question: is it worth versioning the CNL OS? Do you have CNL upgrades on Titan/other machines that would change the binary compatibility of the OS, and can we get the version in a deterministic way? Currently the CNL OS is hard-coded at version 10 for the Cray machines.

@tgamblin tgamblin added the cray label Dec 8, 2016
kserradell pushed a commit to kserradell/spack that referenced this pull request Dec 9, 2016
Packages built targeting a backend may depend on packages like cmake
which can be built against the frontend. With this commit, any build
dependency or child of a build dependency will target the frontend by
default. In compiler concretization when packages copy compilers from
nearby packages, build dependencies use compiler information from
other build dependencies, and link dependencies avoid using compiler
information from build dependencies.
@mpbelhorn
Copy link
Copy Markdown
Contributor

I'm aware that the version can change, but it doesn't change often in the lifetime of our machines. I'm not the one to ask - I don't even know what version of CNL is on our machines or exactly where to find it.

Titan for example runs a modified SuSE11.3, "Cray Linux Environment" CLE 5.2 on the login/batch nodes. CLE is clearly versioned and releases ship with an associated (non-SuSE-based?) "Compute Node Linux" CNL for the compute nodes but I don't know what the 'official' CNL version is.

I prefer to consider CLE simply SuSE11.

scheibelp added a commit to scheibelp/spack that referenced this pull request Dec 10, 2016
The primary goal of spack#2292 was to use the frontend compiler to make
build dependencies like cmake on HPC platforms. It turns out that
while this works in some cases, it did not handle cases where a
package was a link dependency of the root and of a build dependency
(and could produce incorrect concretizations which would not build).
tgamblin pushed a commit that referenced this pull request Dec 20, 2016
The primary goal of #2292 was to use the frontend compiler to make
build dependencies like cmake on HPC platforms. It turns out that
while this works in some cases, it did not handle cases where a
package was a link dependency of the root and of a build dependency
(and could produce incorrect concretizations which would not build).
trmwzm pushed a commit to trmwzm/spack that referenced this pull request Dec 20, 2016
The primary goal of spack#2292 was to use the frontend compiler to make
build dependencies like cmake on HPC platforms. It turns out that
while this works in some cases, it did not handle cases where a
package was a link dependency of the root and of a build dependency
(and could produce incorrect concretizations which would not build).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants