Extend packages.yaml to allow custom attributes#16526
Extend packages.yaml to allow custom attributes#16526alalazo wants to merge 59 commits intospack:developfrom
Conversation
9a2eb15 to
5cfc5b7
Compare
|
With the current state of things I can detect: packages:
gcc:
paths:
[email protected] languages=c,c++,fortran: /usr
[email protected] languages=c,c++,fortran: /usr
[email protected] languages=c,c++,fortran: /usr
[email protected] languages=c: /usr
[email protected] languages=c,c++,fortran: /usr
[email protected] languages=c,c++,fortran: /usr
buildable: false
version: []
target: []
compiler: []
modules: {}
providers: {}As we were discussing, having only the prefix as an information in packages:
gcc:
externals:
- spec: '[email protected] languages=c,c++,fortran'
prefix: /usr
compilers:
c: /usr/bin/gcc-4.8
c++: /usr/bin/g++-4.8
fortran: /usr/bin/gfortran-4.8
# Here we should put other relevant information, for instance
# on host and target for cross-compilation
- spec: '[email protected] languages=c,c++,fortran'
prefix: /usr
compilers:
c: /usr/bin/x86_64-linux-gnu-gcc-9
c++: /usr/bin/x86_64-linux-gnu-g++-9
fortran: /usr/bin/x86_64-linux-gnu-gfortran-9
buildable: false
version: []
target: []
compiler: []
modules: {}
providers: {}with a few mandatory fields for every package (e.g. |
15afff1 to
0c1aa6e
Compare
|
Regarding #16526 (comment)
This looks excellent to me. It looks like this doesn't generate customized yaml yet - let me know if you want to discuss how to do that. |
|
Question: is there any reason not to make the paths to executables string-valued variants? They can still be accessible as direct attributes on the spec, but this would allow us to store better provenance (e.g., in lockfiles) and to track configuration. There are other attributes from |
Generally specs should only differ in hash if there is a difference in the behavior (i.e. the bits which make up the files in the package). If the paths were variants then changing the paths would alter the hash (I consider this theoretically problematic, but it also has pragmatic side effects e.g. relocation). |
I'd rather make them a property of the spec instance. A package providing a compiler might be installed by Spack or not and it doesn't have a meaning to let the user specify via a variant the path to the compiler that is still to be installed. Think for instance: $ spack install gcc cc=/usr/fooHaving variants that are attached only to external specs and are not declared in the package doesn't seem appealing too (i.e. I don't see as an option to have these variants only in cc = spec['c'].cchas a consistent meaning on spec objects and returns the path to the current C compiler etc. |
|
@tgamblin It occurs to me that maybe you were thinking at variants like $ spack spec mpfr
Input spec
--------------------------------
mpfr
Concretized
--------------------------------
[email protected]%[email protected] patches=8f15fd27ab65341a60d724d594897d32f4597ddf642d0dc121995e2150181b0c arch=linux-ubuntu18.04-broadwell
^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
^[email protected]%[email protected]+sigsegv patches=3877ab548f88597ab2327a2230ee048d2d07ace1062efe81fc92e91b7f39cd00,fc9b61654a3ba1a8d6cd78ce087e7c96366c290bc8d2c299f09828d793b853c8 arch=linux-ubuntu18.04-broadwell
^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
^[email protected]%[email protected]+cpanm+shared+threads arch=linux-ubuntu18.04-broadwell
^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
^[email protected]%[email protected]~symlinks+termlib arch=linux-ubuntu18.04-broadwell
^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwellthat are not under the "direct" control of users. Even in that case I would prefer using properties for the reasons outlined by @scheibelp and for the fact that while the |
Technically it does change the behavior. A package with a I guess the question is what does external configuration "mean". If you look at it as "I am telling Spack how to map this package to a Spack package" then it makes sense that the executable names might just be config options. If I look at the hash as a real reproducibility test, then I start worrying about compiler names. Maybe it's best to do the former (at least for now) since you give up some reproducibility with externals anyway. At the moment we do not have a use case where my concern matters, but let me bounce this one off you because it'll matter in the future. Right now we can get away with this because we only carer about the compiler names (and other configuration like them) at build time. They are only used within the package build, and we would usually rebuild if something changed. I would like to get to a place eventually where we can swap in a spack-built package for an external and say "this is compatible" -- things will continue to work. So if I have a user who built something on, say, Lassen, and they want to reproduce their stack on Summit without rebuilding much, they could take the spec from Lassen and rebuild only external packages (or swap in new externals) to do that. For that, you'd need to know things like compiler paths. Example: consider the UPC package, or MPI packages, which hard-code compiler paths in scripts. We currently patch them at build time, but if I were dealing with binaries and not builds, I would need to know these paths to relocate them. Or I would need to at least know that they differ, so that I know that one binary won't work with another. Consider Anyway, I think I've convinced myself here that this use case is far off, and I don't really see anything precluding it in the design proposed here, so we can go (mostly) with what is proposed above. But does this at least make sense to you? The paths are relevant for compatibility -- just not if we always rebuild before deploying (the current model). |
I guess I'll just point out that you're kind of proving my point here. The hash represents the build configuration, so you do want it in the spec. It changes the functionality of the package. |
|
One last question. What is - spec: '[email protected] languages=c,c++,fortran'
prefix: /usr
compilers:
c: /usr/bin/x86_64-linux-gnu-gcc-9
c++: /usr/bin/x86_64-linux-gnu-g++-9
fortran: /usr/bin/x86_64-linux-gnu-gfortran-9Is it a special keyword just for compiler pacakges? Or can configuration passed through Oh, and i think |
495112a to
9775f3d
Compare
Fair enough, but If it comes down to a difference that could be resolved with symlinks, I'm inclined to say they are compatible (but that's a separate argument). When it comes to comparisons between Spack packages, it's also easier on us to make some assumptions about how if a certain set of inputs remains the same, you get the same package:
given a fixed set of the above variables, it's unlikely to produce layout differences, so I imagine that these sorts of compatibility concerns come up mainly for comparisons between Spack and non-Spack packages. However:
That may actually come down to details other than querying the spec: some details of how the package was built (which factor into the hash) may not be determinable for an external package, but it still may be possible to determine that a Spack package and external are compatible. |
It's an extra attribute that gets written and is mandated by the GCC package. The commit message of 9775f3d should explain the rationale of the new methods that are introduced to support this. Currently, I'm working on modifying |
This makes sense to me. My point is more that for things like compiler paths I would avoid using variants. Even using variants for |
A few things:
We make exceptions for things like |
|
@tgamblin I agree on 2. and 3. I have a comment on 1. though:
I agree on what the hash (and here we are talking of the |
|
Still work in progress, but with 897433f I generate the following: packages:
gcc:
externals:
- spec: [email protected] languages=c,c++,fortran
prefix: /usr
compilers:
c: /usr/bin/gcc-5
cxx: /usr/bin/g++-5
fortran: /usr/bin/gfortran-5
- spec: [email protected] languages=c,c++,fortran
prefix: /usr
compilers:
cxx: /usr/bin/x86_64-linux-gnu-g++-7
c: /usr/bin/x86_64-linux-gnu-gcc-7
fortran: /usr/bin/x86_64-linux-gnu-gfortran-7
- spec: [email protected] languages=c
prefix: /usr
compilers:
c: /usr/bin/x86_64-linux-gnu-gcc-6
...For |
|
@alalazo: This is getting a little off track since we're not changing it right now 😁 but:
how though? Where would you represent this information if you wanted it in the hash? |
|
@scheibelp @tgamblin Incidentally, once we have all the packages that are used in CI covered in terms of detection we can eliminate a few configuration files from the git repository and just rely on: $ spack external find pkg1 pkg2 ... |
c8f51e7 to
93a0433
Compare
The documentation now instructs users to assert conditions, but in reality will catch any exception that might occur in that method to prevent an error in a single package to stop detection for everything else.
The process to make a package detectable has been simplified by removing the need to decorate the package class. Now a package class is assumed to be detectable if it defines the executables attribute.
If a packages.yaml in the old format is found, Spack will convert it in memory. This makes any configuration in the old format usable by Spack. If something is added to a configuration file in the old format via cli, Spack will error and point the user to the command that is needed to update it. The message points out that any update will not be forward-compatible.
Since the conversion from an old format to a new one happens in memory automatically (to ensure backward compatibility), the commands used to update or revert files on disk are interactive by default.
The function was returning the opposite of what its name suggested. Avoid using `pop` retrieve a key instead.
- Multiple scopes updated at a time - Environment are not written implicitly
The current code is now based on the assumption that all the module objects that might be needed are already imported at the top level.
bfbbac2 to
55c4377
Compare
fixes #3181 (either that or this issue was already fixed by #15158)
Modifications:
packages.yamlhas been updated. Old configuration files are not allowed anymore and Spack will error out in their presence. The new schema permits to store arbitrary attributes for each external detected.packages.yaml. All specs that are detected must be created withSpec.from_detection.packages.yamldisplayed in the docs have been updated