Conversation
1. Put autoload=True in package, and anything that depends on us will autoload our module 2. Put depends_on(xyz, autoload=...) and it will override xyz.autoload
alalazo
left a comment
There was a problem hiding this comment.
I remain of the opinion expressed in #1662: I don't like information on which modules should be auto-loaded be part of the directives. This comes out of concerns for modularity: packages currently don't have any kind of knowledge that modules exist, while after this PR we will have a keyword in a directive which refers to an option of a particular post-install hook.
I see that we may want more flexibility than what is currently available for auto-loading modules. Nonetheless I think we may achieve that:
- generalizing the syntax for auto-loading modules
- shipping a modified
modules.yamlthat enables by default auto-loading for selected modules
For instance, if we want that packages load any dependency that depends on python and python itself I suggest we extend the current syntax to something like:
modules:
tcl:
all:
autoload:
- '^python'
- 'python'Does this seem a viable alternative? Or are there cases that wouldn't be covered by such an approach?
In a perfect world, all Spack-built packages would have full RPATHs, and modules would barely be useful. The world is not perfect, and only compiled binaries consistently get the RPATH treatment. Python, R, Java, Lua, etc. all use the equivalent of LD_LIBRARY_PATH; meaning that to use package With that in mind, consider: Getting Complete Info for Env Var AssemblySpack packages already indicate what environment variables must be set in order for dependents to use them at runtime. This is specified, in the package, in Let's think clearly about the problem of assembling the environment required to use a package at runtime. Currently, that problem is only partially addressed. Yes, some information along those lines is accepted in the second argument of The Would you like the autoload keyword to be named something else??? I have no problem with renaming it... Issues of ModularityModules are one particular way to assemble the environment required to run package This PR does not make core Spack know about or favor modules or any other way of assembling a runtime environment. Modularity is preserved. What this PR does do is provide information --- in addition to information already provided through Motivation of this PR: Why Now?From a practical standpoint... After losing two battles on the issue, I have concluded that users don't like being asked to edit My proposed solution to this issue is to provide Now suppose that my big numerical simulation is split into 12 Spack packages (quite common in fact), and I've created a single overall Bundle package (call it Conclusion: This PR is necessary to achieve the goals outlined in #3133. That is why I implemented it this weekend, instead of putting it off for later. I believe this will also play into our ongoing disucssion on Spack Environments.
I appreciate your offer to extend I must also point out that the ability to use that information when generating modules (our only real-life way of assembling env vars) rests entirely on your significant contributions to module functionality. Without that existing machinery, this PR could not exist. |
|
Doesn't the I agree with @alalazo that we should be shipping autoload modules by default. I did started to work on this with some other changes, I will fix it up.... |
Great observation. However, I've concluded the two are different, due to RPATH. Consider the canonical case where A->B where A is a binary executable using B, a shared library. In this case A When considering dependencies (i.e. edges of the DAG), note that edges where Also, whether an edge needs |
This conflicts with the proposed meaning of the "run" deptype in #3768 - not to say this makes it incorrect but I'm wondering if you could weigh in there. In #3768 the proposed meaning of the run deptype is when a dependency effects environment variables other than those related to libraries. |
I opened #3768 because I realized we didn't really know what these deptypes mean. Either this PR or #3768 needs to change based on this conflict. |
|
Closing as inactive for a while and maybe not relevant anymore. The best way to have an entire set of specs ready to be used is using "Spack environments". Feel free to reopen if you disagree. |
@adamjstewart @tgamblin
This addresses issues brought up in conversation between @citibeth and @alalazo on module autoloading in #1662...
It introduces the concept of autoloading at the
Packageanddepends_on()level.If you put autoload=True in package, and anything that depends on that package will autoload its module. The canonical example here is
PythonPackage. Anything depending on aPythonPackagesubclass will be autoloaded. For example,py-numpywill be autoloaded by anything that depends on it. However, ifpy-numpydepends on (say)openblas, thenopenblaswill not be autoloaded.You can override the package-level autoloading in the
depends_on()declarations.py-netcdfdepends onnetcdf. But by default,netcdfwill NOT be autoloaded frompy-netcdfbecausenetcdfdoes not subclassPythonProject(andautoload=Truewas not set innetcdf/package.py). However, Python extensions (such as the one generated inpy-netcdf) do not have RPATHs, and therefore will not be able to properly linknetcdfwithout something inLD_LIBRARY_PATH. Therefore, we use the following inpy-netcdf/package.py:I believe that this feature will provide the tools to eventually make module autoloading "just work," based on particulars of the packages. I expect there will be some adjustment, as we find exceptions to the default autoloading rules (such as
PythonPackage.autoload=True).The way to specify autoloading described in this PR does not affect the way autoloading is currently specified in
modules.yaml. If there is demand, I could also add a switch tomodules.yamlthat would turn this feature off entirely.