| 1 |
\documentclass{beamer} |
| 2 |
|
| 3 |
% You can also use a 16:9 aspect ratio: |
| 4 |
%\documentclass[aspectratio=169]{beamer} |
| 5 |
\usetheme{TACC16} |
| 6 |
|
| 7 |
% It's possible to move the footer to the right: |
| 8 |
%\usetheme[rightfooter]{TACC16} |
| 9 |
|
| 10 |
%% page |
| 11 |
%\begin{frame}{} |
| 12 |
% \begin{itemize} |
| 13 |
% \item |
| 14 |
% \end{itemize} |
| 15 |
%\end{frame} |
| 16 |
% |
| 17 |
%% page |
| 18 |
%\begin{frame}[fragile] |
| 19 |
% \frametitle{} |
| 20 |
% {\tiny |
| 21 |
% \begin{semiverbatim} |
| 22 |
% \end{semiverbatim} |
| 23 |
%} |
| 24 |
% \begin{itemize} |
| 25 |
% \item |
| 26 |
% \end{itemize} |
| 27 |
% |
| 28 |
%\end{frame} |
| 29 |
|
| 30 |
\begin{document} |
| 31 |
\title[Lmod]{Lmod 8.*+ changes to TCL module support} |
| 32 |
\author{Robert McLay} |
| 33 |
\date{December 6, 2022} |
| 34 |
|
| 35 |
% page 1 |
| 36 |
\frame{\titlepage} |
| 37 |
|
| 38 |
|
| 39 |
% page 2 |
| 40 |
\begin{frame}{Outline} |
| 41 |
\center{\includegraphics[width=.9\textwidth]{[email protected]}} |
| 42 |
\begin{itemize} |
| 43 |
\item Lmod 8.0+ brought many improvements to TCL support |
| 44 |
\item Optional Integration of TCL interpreter into Lmod (saves |
| 45 |
time) |
| 46 |
\item Support for is-loaded |
| 47 |
\item Support for is-avail and why I resisted supporting this |
| 48 |
\item Special features of setenv and pushenv in TCL |
| 49 |
\item New bugs found when integrating the TCL interpreter into Lmod |
| 50 |
\end{itemize} |
| 51 |
\end{frame} |
| 52 |
|
| 53 |
% page 3 |
| 54 |
\begin{frame}{How Lmod handles TCL modulefiles} |
| 55 |
\begin{itemize} |
| 56 |
\item From last time we talk about how Lmod handles TCL |
| 57 |
modulefiles |
| 58 |
\item Use tcl2lua.tcl to read the modulefile. |
| 59 |
\item It evaluates all pure TCL code |
| 60 |
\item It outputs Lua strings for all module commands (setenv, etc) |
| 61 |
\item Lmod evalutes Lua output from tcl2lua.tcl |
| 62 |
\item Means that all TCL if stmts are evaluated by tcl2lua.tcl |
| 63 |
\end{itemize} |
| 64 |
\end{frame} |
| 65 |
|
| 66 |
% page 4 |
| 67 |
\begin{frame}{How Lmod handles TCL modulefiles (II)} |
| 68 |
\begin{itemize} |
| 69 |
\item Remember that tcl2lua.tcl is a separate code written in TCL |
| 70 |
\item It doesn't have access to the internal Lmod structures |
| 71 |
\item There is only a command-line interface between the two programs. |
| 72 |
\end{itemize} |
| 73 |
\end{frame} |
| 74 |
|
| 75 |
% page 5 |
| 76 |
\begin{frame}[fragile] |
| 77 |
\frametitle{Special Features of tcl2lua.tcl} |
| 78 |
{\tiny |
| 79 |
\begin{semiverbatim} |
| 80 |
setenv ABC def |
| 81 |
if \{ \$env\{ABC\} == "def" \} \{ |
| 82 |
# do something |
| 83 |
\} |
| 84 |
\end{semiverbatim} |
| 85 |
} |
| 86 |
\begin{itemize} |
| 87 |
\item Internally setenv and pushenv change the current environment |
| 88 |
\item Also output: \texttt{setenv("ABC","def")} |
| 89 |
\end{itemize} |
| 90 |
|
| 91 |
\end{frame} |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
% page 6 |
| 96 |
\begin{frame}[fragile] |
| 97 |
\frametitle{Support for TCL is-loaded} |
| 98 |
{\tiny |
| 99 |
\begin{semiverbatim} |
| 100 |
if \{ ! [ is-loaded foo ] \} \{ |
| 101 |
module load foo |
| 102 |
\} |
| 103 |
|
| 104 |
\end{semiverbatim} |
| 105 |
} |
| 106 |
\begin{itemize} |
| 107 |
\item To handle this a list of currently loaded modules is |
| 108 |
provides (every time!) to tcl2lua.tcl |
| 109 |
\item This way if there is an \textbf{is-loaded}, it can be evaluated. |
| 110 |
\item It is cheap for Lmod to provide this list. |
| 111 |
\end{itemize} |
| 112 |
\end{frame} |
| 113 |
|
| 114 |
% page 7 |
| 115 |
\begin{frame}[fragile] |
| 116 |
\frametitle{Support for TCL is-avail} |
| 117 |
{\tiny |
| 118 |
\begin{semiverbatim} |
| 119 |
if \{ [ is-avail foo ] \} \{ |
| 120 |
module load foo |
| 121 |
\} |
| 122 |
\end{semiverbatim} |
| 123 |
} |
| 124 |
\begin{itemize} |
| 125 |
\item This is much harder to provide. |
| 126 |
\item Lmod could provide a list of currently available modules |
| 127 |
\item But this is expensive and most times this is not needed. |
| 128 |
\item Is there another way to provide this? |
| 129 |
\end{itemize} |
| 130 |
\end{frame} |
| 131 |
|
| 132 |
|
| 133 |
% page 8 |
| 134 |
\begin{frame}{The user provided the key} |
| 135 |
\begin{itemize} |
| 136 |
\item What if the tcl module requested an avail |
| 137 |
\item Well tcl2lua.tcl could do that work on behalf of the modulefile |
| 138 |
\item It is expensive but only when is-avail requested. |
| 139 |
\end{itemize} |
| 140 |
\end{frame} |
| 141 |
|
| 142 |
% page 9 |
| 143 |
\begin{frame}{How tcl2lua.tcl implements the is-avail} |
| 144 |
\begin{itemize} |
| 145 |
\item It does: \textbf{\$LMOD\_CMD bash --no\_redirect -t avail} |
| 146 |
\item This generates a list of available module written to stderr |
| 147 |
\item This list is processed and stored in a TCL dictionary |
| 148 |
\item Then the is-avail argument is checked. |
| 149 |
\end{itemize} |
| 150 |
\end{frame} |
| 151 |
|
| 152 |
% page 10 |
| 153 |
\begin{frame}{Lmod 8+ supports integrating the tcl interpreter} |
| 154 |
\begin{itemize} |
| 155 |
\item It is optionally but can be disabled |
| 156 |
\item Configure or set LMOD\_FAST\_TCL\_INTERP=no |
| 157 |
\item Enabled it speeds tcl evaluations. |
| 158 |
\item No need to fork-exec a separate program for every TCL |
| 159 |
modulefile or TCL .version or TCL .modulerc file |
| 160 |
\end{itemize} |
| 161 |
\end{frame} |
| 162 |
|
| 163 |
% page 11 |
| 164 |
\begin{frame}{Integrating the TCL interpreter exposed bugs} |
| 165 |
\begin{itemize} |
| 166 |
\item Kenneth Hoste reported that pushenv didn't work in TCL |
| 167 |
modulefiles. |
| 168 |
\item Lmod's pushenv saves the old value in a hidden env. var. |
| 169 |
\item Now that the TCL interpreter is in the same executable |
| 170 |
\item Its environment is also in the same environment |
| 171 |
\item The TCL pushenv (like setenv) changes the local environment |
| 172 |
\item When Lmod evaluated the \texttt{pushenv()} lua command |
| 173 |
\item The old env value was over-written |
| 174 |
\end{itemize} |
| 175 |
\end{frame} |
| 176 |
|
| 177 |
% page 12 |
| 178 |
\begin{frame}{pushenv and setenv solution} |
| 179 |
\begin{itemize} |
| 180 |
\item The tcl2lua code remembers any setenv or pushenv env names |
| 181 |
and values in a TCL dictionary. |
| 182 |
\item It only remembers the first time an env. var is changed. |
| 183 |
\item It resets the env. before exiting tcl2lua.tcl |
| 184 |
\end{itemize} |
| 185 |
\end{frame} |
| 186 |
|
| 187 |
|
| 188 |
% page 13 |
| 189 |
\begin{frame}{Next Time} |
| 190 |
\begin{itemize} |
| 191 |
\item What is TCL break and why you might use it |
| 192 |
\item How TCL help messages are supported |
| 193 |
\item How TCL puts is handled. |
| 194 |
\end{itemize} |
| 195 |
\end{frame} |
| 196 |
|
| 197 |
% page 14 |
| 198 |
\begin{frame}{Future Topics} |
| 199 |
\begin{itemize} |
| 200 |
\item Next Meeting: January 3nd or 10th 9:30 US Central (15:30 UTC)? |
| 201 |
\end{itemize} |
| 202 |
\end{frame} |
| 203 |
|
| 204 |
\end{document} |