File: lmod.org

package info (click to toggle)
lmod 6.6-0.2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 16,716 kB
  • ctags: 1,336
  • sloc: sh: 3,714; python: 967; makefile: 718; tcl: 695; perl: 495; csh: 85; ansic: 35
file content (163 lines) | stat: -rw-r--r-- 4,386 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
Notes on what a Lmod talk would look like if given to the Lua Dev
Room.

* What are Env. Modules?

At its most basic, All any of the Env. Modules Tools to set (and
unset!) environment variables.  Especially adding (and removing)
directories from path like variables (PATH, LD_LIBRARY_PATH, etc)

In a broader sense, it is a very convenient way for centers to provide
access to software.  A Chemist doing Molecular Dymanics needs one set
of software, while a Biologist working on Genomics needs a completely
different set of software.  As a software developer, I find it very
useful to easily switch between different compilers or compiler
versions.


How does it work?
Show a simple module load


* What is Lmod?

A lua based environment module tool.  It is a modern replacement for
the original, activity developed since 2009.  

* why write in Lmod in lua?

My history in scripting languages beside the shell is
Perl->Python->Lua

I thought I'd prototype it in Lua then Tmod would pick it up and add
to it. => Wrong,  Lots of benefits for me and the tool.


* Why go to the trouble of coming up with a new version of Env. Modules?

The original tool didn't handle the software hierarchy well.

When you want to use boost, you need it for your compiler (and
version).  When you switch compilers (or versions), you want the boost
library to match  -> Lmod does this switching for you automatically.

* Why talk about Lmod to this audience?  

Why is Lua a good choice as the implementation language?

(maybe talk about why I think Lua is cool?)

** Modulefile are loaded and unloaded and "help"ed?

   help("This package does ...")
   setenv("FOO","BAR")
   prepend("PATH","/apps/foo/1.2/bin")


   During a module load, the help function does nothing,  The setenv
   set a variable, the prepend_path does...

   A module unload unsets the variable, and removes the directory from
   PATH.

   "module help foo" prints the help message and the other commands
   are no-ops.

   How does Lmod implement this:

   function setenv()
      mcp:setenv()
   end

   MasterControl:setenv()
     ...
   end

   MasterControl:unsetenv()
     ...
   end

** Using pcall to avoid Lmod Error call trees when the error is in a modulefile


** Sandbox
   All modulefile are evaluated in a sandbox. Something that is not
   available in python. 


** Hooks

   Sites can modified the behavior of Lmod by "hooks"

   A site can register a load hook.  For example every time a module
   is loaded, a message can be sent via syslog to allow for module
   usage tracking.

** What modules you have loaded need to be remembered between calls -> env .var.

   A lua table is a great way to remember a state.  
   serialize table (DAG) into a string.  Convert to base64, break it
   up into 256 byte blocks and store in the environment, do the
   reverse when starting Lmod.

** Debugging: How to debug something on a computer on a site which I don't have access to.

   I haven't had much luck in finding a Lua debugger.  So I had to
   come to debug things:

       local dbg = require("Dbg"):dbg()


       function setenv(...)
         dbg.start{"setenv(...)"}

         local abc = "This is a string"
         dbg.print{"abc: ",abc,"\n"}

         dbg.fini("setenv")
       end

       module -D load foo 2> load.log


       setenv(...) {
         abc: This is a string
       } setenv

   This has been a great thing because this provides a very very
   useful way to debug Lmod on a site I'll never have access to.


** module --config

   Report how Lmod has been configured

   When doing the above debug logging always report the configuration.

** Shell Factory

   Using the Design patterns lingo: 
   
   master.shell = BaseShell.build(shell)

   master.shell:expand(varTbl)

* Comment on what it like to put software for the world to use

   Remote Debugging
   Test suite
   Being the Benevolent Dictator, Having to say no sometimes?
   The advantages of releasing software.  More eyes to find bugs

   Features, A deeper understanding of what the code is doing because
   I have to explain things.

   Documentation, Documentation, Documentation. and keeping it up to
   date.

   Comment on what is like stepping into other peoples shoes.
   -> every site on the planet uses Env. Modules differently
   -> Tmod has no policies, Lmod has some.
   -> No way to keep them all happy.