-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature : customization of modules from configuration files #744
feature : customization of modules from configuration files #744
Conversation
modules : added skeleton to permit modifications based on specs
pass | ||
# TODO : the code down below is quite similar to build_environment.setup_package and needs to be | ||
# TODO : factored out to a single place | ||
for item in dependencies(self.spec, 'All'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tgamblin Adding these three lines:
for item in self.spec.traverse(order='post', depth=True, cover='nodes', root=False):
tty.msg(item)
tty.msg('')
immediately above here gives to me the following output for gcc@5.3.0
during spack module refresh
:
==> (1, binutils@2.26%gcc@4.8+gold~krellpatch~libiberty=production)
==> (1, gmp@6.1.0%gcc@4.8=production)
==> (2, gmp@6.1.0%gcc@4.8=production)
==> (1, isl@0.14%gcc@4.8=production^gmp@6.1.0%gcc@4.8=production)
==> (2, gmp@6.1.0%gcc@4.8=production)
==> (3, gmp@6.1.0%gcc@4.8=production)
==> (2, mpfr@3.1.4%gcc@4.8=production^gmp@6.1.0%gcc@4.8=production)
==> (1, mpc@1.0.3%gcc@4.8=production^gmp@6.1.0%gcc@4.8=production^mpfr@3.1.4%gcc@4.8=production)
==> (2, gmp@6.1.0%gcc@4.8=production)
==> (1, mpfr@3.1.4%gcc@4.8=production^gmp@6.1.0%gcc@4.8=production)
The point that I want you to note is that we are visiting gmp@6.1.0%gcc@4.8=production
multiple times. The behavior won't change if you remove depth=True
and is not consistent with what happens at build time (where the nodes are visited only once).
I really don't get if we miss a call to some method before entering here (to collapse nodes that refers to the same spec) or if it is the way this is supposed to work.
@tgamblin @citibeth @adamjstewart @glennpj @nrichart (or anybody else that might be interested in this), I think I am ready to collect a first round of comments / questions on this PR. Fire at will 😄 |
'}}') | ||
|
||
prerequisite_format = 'prereq {module_file}\n' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tgamblin Do you know if you can do something similar to autoload_format
and prerequisite_format
with dotkit?
This looks very useful. We currently use SoftEnv at Argonne, but are planning to switch to some form of modules within the next year. Not sure which are currently supported by Spack or the pros and cons of each, but that would obviously influence our decision. Questions:
|
This work sound really interesting for our case. |
Currently
The features above are meant for user level configuration files while the one coming with The customization covers some particular needs. For instance, at my site we don't want to have
Another case is IntelMPI, where the fabrics in use are set at run-time using environment variables. You can add these using something like:
that will modify only modules matching
Not really, this PR is just meant to address module files creation. I wonder in fact if there are cases where you need per-site custom information during the installation phase (I can't think of any right now). The point with Intel compiler is a good one, but then I think that compilers are a bit different from normal packages in the sense that you don't depend on a compiler, and so far the mechanism used to inject customization in a package relies on traversing its dependencies. |
@alalazo This looks awesome at a high level. The flexibility of working with subsets of packages and dependencies will give spack features that other systems do not have, that I know of anyway. @adamjstewart If you are looking to use an environment module system then I recommend Lmod. It can do everything that TCL modules can do plus more. It works with TCL module files through a converter so it works right now in spack. |
…/custom_modulefile_from_config
@alalazo I pulled the PR and tried a
The modules that set any module loading are non-functional with Lmod.
Looking a the module file itself, there are no line breaks for the autoload statements. The following is all on one line:
|
I wonder if considering module naming should be part of this. I am referring to the actual names of the modules and not the layout. As mentioned in PR #498 the hash in the name is not human parseable. Since an environment module system is ultimately the interface end users have to the installed software the names need to be "friendly". If doing autoloading and prereqs then those names need to be listed in dependent module files. |
@glennpj I still have to work the details of that, but as far as I can tell module 'layout' and module 'naming' should be the same thing. Currently the core part in constructing a module name is the function return "%s-%s-%s-%s-%s" % (
self.spec.name, self.spec.version,
self.spec.compiler.name,
self.spec.compiler.version,
self.spec.dag_hash()) The idea I have in mind is to specify the various components from modules:
tcl:
naming: '{name}/{version}-{compiler-name}-{compiler-version}' The things I still have to think about are basically how to handle file name collisions and how to deal with variants (e.g. you may want to have the concrete For collisions I believe that writing the full spec in a comment within the module file, and ask the user for permission to overwrite an existing module file will solve the problem. For variants I guess I'll need to give a try to some options and see which one seems to be the best. Does that make sense to you? Regarding making changes to the naming scheme part of this PR, I would rather finalize what is already in place and submit another PR once #744 has been merged. What do you think @tgamblin ? |
@glennpj Thanks for the bug report, I forgot the newlines when refactoring the multi-line strings 😄 I'll fix them asap |
@glennpj Should be fixed now. |
@tgamblin The two changes are in. Now I miss docs : would you prefer to have them in a separate PR? |
@alalazo: same PR is ok with me! |
…/custom_modulefile_from_config
@alalazo Would it be possible to add the ability to have Thanks. |
@tgamblin What I am referring to is not covered by autoloading. Being able to add explicit load directives in the It would also be useful when using extension activation. For example, py-numpy depends on openblas so will autoload the openblas module. However, if py-numpy is activated then the py-numpy module does not need to be loaded, just the python module does. However, the openblas module would not be autoloaded when the python module is loaded. This would definitely be a new PR to handle activation but being able to add those in I am more interested in the external, non-spack built, module case but it could certainly be another PR. |
This one actually sounds like a bug -- the numpy binaries should have For the non-activated case, the dep management here should handle loading anything that needs a Either way, though, I see lots of clear use cases for the external, non-spack-built case. So I think that should go in eventually. I can't implement it at the moment though so up to @alalazo whether he wants to put it in here or leave it for another PR. |
On Tue, May 10, 2016 at 11:34 PM, Todd Gamblin notifications@github.com
I believe fixing the bug involves figuring out the right incantations with -- Elizabeth |
This reverts commit 71e49e2.
…/custom_modulefile_from_config Conflicts: lib/spack/spack/config.py
@@ -5,4 +5,14 @@ | |||
# although users can override these settings in their ~/.spack/modules.yaml. | |||
# ------------------------------------------------------------------------- | |||
modules: | |||
prefix_inspections: { | |||
bin: ['PATH'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the comma at the end of the line here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see -- the whole thing is in braces. I don't think you have to do that if the dict is spread over multiple lines.
@alalazo Another PR is fine by me. I think this PR is awesome by the way! Thanks. |
Merged! Thanks to @alalazo for doing all this work! |
Modifications :
run_env
(previously it was only extendee)autoload
and/orprereq
intcl
module filesautoload
and/orprereq
indotkit
module filestcl
modulesExample : filter modifications out of module files
Modifications to certain environment variables in module files are generated by default. Suppose you would like to avoid having
CPATH
andLIBRARY_PATH
modified by yourdotkit
modules. Then a usermodules.yaml
like:will generate
dotkit
module files that will not contain modifications to eitherCPATH
orLIBRARY_PATH
andtcl
module files that instead will contain those modifications.Example : autoload direct dependencies in
tcl
module filesThe following lines in
modules.yaml
:will produce
tcl
module files that will automatically load their direct dependencies. Adding prerequisites could be done in a similar way :Example : customize module file entries
It's possible to customize the entries written in module files. For instance with:
what will happen is :
setenv BAR bar
linesetenv BAR baz
('::' overrides previous rules, to be consistent with what happens for different configuration sections)zlib
will havesetenv FOO foo
zlib%gcc@4.8
will havesetenv FOOBAR foobar
Example : don't generate modules for things that are built with the system compiler
The following configuration file :
will skip module file generation for anything that satisfies
%gcc@4.4.7
, with the exception ofgcc
andllvm
.Example : customize the naming scheme and insert conflicts
A configuration file like:
will create module files that will conflict with
intel/14.0.1
and with the base directory of the same module (i.e. you cannot have two versions of the same things loaded at the same time). The conflict directive currently accepts as items :naming_scheme