| 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]{Using Personal Modules and Inherit() w/ the Software Hierarchy} |
| 32 |
\author{Robert McLay} |
| 33 |
\date{March 7, 2023} |
| 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 How to correctly use personal modules so that Lmod will find |
| 44 |
and use them. |
| 45 |
\item How to setup a personal library/application in the software |
| 46 |
hierarchy |
| 47 |
\item Why this is a PITA! |
| 48 |
\end{itemize} |
| 49 |
\end{frame} |
| 50 |
|
| 51 |
% page 3 |
| 52 |
\begin{frame}{Creating Personal modules} |
| 53 |
\begin{itemize} |
| 54 |
\item What is the big deal? |
| 55 |
\item Easy: Create a directory (say \$HOME/my\_modules) |
| 56 |
\item Create a directory (\$HOME/my\_modules/acme) |
| 57 |
\item Create a create modulefile: \$HOME/my\_modules/acme/3.2.lua) |
| 58 |
\item \$ \texttt{module use \$HOME/my\_modules} |
| 59 |
\item \$ \texttt{module load acme/3.2} |
| 60 |
\item Easy right!? |
| 61 |
\end{itemize} |
| 62 |
\end{frame} |
| 63 |
|
| 64 |
% page 4 |
| 65 |
\begin{frame}{Testing a personal copy of a system module} |
| 66 |
\begin{itemize} |
| 67 |
\item Suppose that acme/3.2 is already on your system |
| 68 |
\item And acme/3.2 is a marked default |
| 69 |
\item The command \texttt{module load acme/3.2} |
| 70 |
\item Will load the system one and not yours |
| 71 |
\item Even though \$HOME/my\_modules is listed first in \$MODULEPATH |
| 72 |
\item Why? |
| 73 |
\end{itemize} |
| 74 |
\end{frame} |
| 75 |
|
| 76 |
% page 5 |
| 77 |
\begin{frame}[fragile] |
| 78 |
\frametitle{Why?} |
| 79 |
\begin{itemize} |
| 80 |
\item While Lmod does look in \$MODULEPATH order |
| 81 |
\item So the first module found is usually picked. |
| 82 |
\item {\color{red}\emph{However}}, marked defaults ALWAYS win in |
| 83 |
N/V module layouts (Best found) |
| 84 |
\item Note not in N/V/V layouts. (First found) |
| 85 |
\item A marked default is where there is either: |
| 86 |
\begin{enumerate} |
| 87 |
\item A default symlink |
| 88 |
\item .modulerc.lua |
| 89 |
\item .modulerc |
| 90 |
\item .version |
| 91 |
\end{enumerate} |
| 92 |
\item I recently updated the documentation |
| 93 |
https://lmod.readthedocs.io/en/latest/060\_locating.html |
| 94 |
to explain this |
| 95 |
\end{itemize} |
| 96 |
\end{frame} |
| 97 |
|
| 98 |
% page 6 |
| 99 |
\begin{frame}[fragile] |
| 100 |
\frametitle{Getting Around a System Marked Defaults} |
| 101 |
\begin{itemize} |
| 102 |
\item Make your own marked default. |
| 103 |
\item Easiest way is to make a default symlink |
| 104 |
\end{itemize} |
| 105 |
{\tiny |
| 106 |
\begin{semiverbatim} |
| 107 |
\$ cd \$HOME/my\_modules/acme |
| 108 |
\$ ln -s 3.2.lua default |
| 109 |
\end{semiverbatim} |
| 110 |
} |
| 111 |
\end{frame} |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
% page 7 |
| 116 |
\begin{frame}[fragile] |
| 117 |
\frametitle{Checking with module avail} |
| 118 |
{\tiny |
| 119 |
\begin{semiverbatim} |
| 120 |
---------- /home/user/my\_modules ----------- |
| 121 |
acme/3.2 (D) |
| 122 |
|
| 123 |
---------- /opt/apps/modulefiles ------------ |
| 124 |
StdEnv acme/3.2 |
| 125 |
|
| 126 |
\end{semiverbatim} |
| 127 |
} |
| 128 |
\begin{itemize} |
| 129 |
\item Make sure that the (D) is next to your acme module |
| 130 |
\item And not the system one. |
| 131 |
\end{itemize} |
| 132 |
\end{frame} |
| 133 |
|
| 134 |
|
| 135 |
% page 8 |
| 136 |
\begin{frame}{Bigger issue: Testing a compiler dependent \texttt{boost/1.85.0}} |
| 137 |
\begin{itemize} |
| 138 |
\item And you want it part of the software hierarchy |
| 139 |
\item How can you do this \texttt{without} modifying the system |
| 140 |
modulefiles? |
| 141 |
\item In particular you only want the correct version of boost |
| 142 |
available when you load the correct compiler. |
| 143 |
\end{itemize} |
| 144 |
\end{frame} |
| 145 |
|
| 146 |
% page 9 |
| 147 |
\begin{frame}{The short answer: inherit()} |
| 148 |
\begin{itemize} |
| 149 |
\item You can use the inherit() function to simplify this a little |
| 150 |
\item This is discussed in detail in https://lmod.readthedocs.io/en/latest/340\_inherit.html |
| 151 |
\end{itemize} |
| 152 |
\end{frame} |
| 153 |
|
| 154 |
% page 10 |
| 155 |
\begin{frame}{Overview} |
| 156 |
\begin{itemize} |
| 157 |
\item We want to test/use boost install from our own account. |
| 158 |
\item And have it load when the ``right'' compiler is loaded |
| 159 |
\item This assumes that your site is using the software hierarchy |
| 160 |
\item How can we get the system compiler to load our directory |
| 161 |
into \$MODULEPATH? |
| 162 |
\item Suppose we want to test a boost version with the intel 19.1 |
| 163 |
and gcc 12.2 compilers |
| 164 |
\end{itemize} |
| 165 |
\end{frame} |
| 166 |
|
| 167 |
% page 11 |
| 168 |
\begin{frame}{Building and Installing boost in your account} |
| 169 |
\begin{itemize} |
| 170 |
\item Build boost 1.85.0 with gcc 12.2 $\Rightarrow$ \textasciitilde/pkg/gcc-12/boost/1.85.0 |
| 171 |
\item Build boost 1.85.0 with intel 19.1 $\Rightarrow$ \textasciitilde/pkg/intel-19/boost/1.85.0 |
| 172 |
\end{itemize} |
| 173 |
\end{frame} |
| 174 |
|
| 175 |
% page 12 |
| 176 |
\begin{frame}{Choice 1: Copy Each compiler modulefiles into your account} |
| 177 |
\begin{itemize} |
| 178 |
\item Easy to do |
| 179 |
\item Add your hierarchical directory into \$MODULEPATH |
| 180 |
\item Problem: you are now responsible to keep your copy |
| 181 |
up-to-date |
| 182 |
\item As the sys-admin might change them w/o you knowning |
| 183 |
\end{itemize} |
| 184 |
\end{frame} |
| 185 |
|
| 186 |
% page 13 |
| 187 |
\begin{frame}{Choice 2: Use inherit()} |
| 188 |
\begin{itemize} |
| 189 |
\item Create your own compiler module and inherit from the system |
| 190 |
one. |
| 191 |
\item The inherit() function take NO arguments |
| 192 |
\item Lmod looks for the exact same name in \$MODULEPATH |
| 193 |
\item This way it includes the system one with your changes. |
| 194 |
\end{itemize} |
| 195 |
\end{frame} |
| 196 |
|
| 197 |
% page 14 |
| 198 |
\begin{frame}{Inherit() part 2} |
| 199 |
\begin{itemize} |
| 200 |
\item Create gcc/12.2 and intel/19.1 in your own directory |
| 201 |
structure |
| 202 |
\item Then create two boost modulefiles for each compiler |
| 203 |
\end{itemize} |
| 204 |
\end{frame} |
| 205 |
|
| 206 |
% page 15 |
| 207 |
\begin{frame}[fragile] |
| 208 |
\frametitle{Steps for gcc/12.2} |
| 209 |
{\tiny |
| 210 |
\begin{semiverbatim} |
| 211 |
\$ mkdir -p ~/my\_modules/\{Core,Compiler,MPI\} |
| 212 |
|
| 213 |
You also set the following environment variable: |
| 214 |
|
| 215 |
\$ export MY\_MODULEPATH\_ROOT=\$HOME/my\_modules |
| 216 |
|
| 217 |
When this is set up you will do: |
| 218 |
|
| 219 |
$ module use ~/my\_modules/Core |
| 220 |
\end{semiverbatim} |
| 221 |
} |
| 222 |
\end{frame} |
| 223 |
|
| 224 |
% page 16 |
| 225 |
\begin{frame}[fragile] |
| 226 |
\frametitle{gcc/12.2.lua} |
| 227 |
{\tiny |
| 228 |
\begin{semiverbatim} |
| 229 |
Then in the file ~/my_modules/Core/gcc/12.2.lua you have:: |
| 230 |
|
| 231 |
inherit() |
| 232 |
local compiler = "gcc" |
| 233 |
local MP\_ROOT = os.getenv("MY\_MODULEPATH\_ROOT") |
| 234 |
local version = "12" |
| 235 |
|
| 236 |
prepend_path("MODULEPATH", pathJoin(MP\_ROOT, "Compiler",compiler,version)) |
| 237 |
\end{semiverbatim} |
| 238 |
} |
| 239 |
\begin{itemize} |
| 240 |
\item Note that I'm assuming that I'll have the same libraries |
| 241 |
\item for all versions of gcc 12.* |
| 242 |
\end{itemize} |
| 243 |
\end{frame} |
| 244 |
|
| 245 |
% page 17 |
| 246 |
\begin{frame}[fragile] |
| 247 |
\frametitle{intel/19.1.lua} |
| 248 |
{\tiny |
| 249 |
\begin{semiverbatim} |
| 250 |
Suppose you also have the system intel/19.1 module. Then you would |
| 251 |
need at ~/my\_modules/Core/intel/19.1.lua you have:: |
| 252 |
|
| 253 |
inherit() |
| 254 |
local compiler = "intel" |
| 255 |
local MP\_ROOT = os.getenv("MY\_MODULEPATH\_ROOT") |
| 256 |
local version = "19" |
| 257 |
|
| 258 |
prepend_path("MODULEPATH", pathJoin(MP\_ROOT, "Compiler",compiler,version)) |
| 259 |
\end{semiverbatim} |
| 260 |
} |
| 261 |
\begin{itemize} |
| 262 |
\item Note that I'm assuming that I'll have the same libraries |
| 263 |
\item for all versions of intel 19.* |
| 264 |
\end{itemize} |
| 265 |
\end{frame} |
| 266 |
|
| 267 |
% page 18 |
| 268 |
\begin{frame}[fragile] |
| 269 |
\frametitle{Protect against system marked defaults} |
| 270 |
{\tiny |
| 271 |
\begin{semiverbatim} |
| 272 |
\$ cd ~/my\_modules/Core/intel; ln -s 19.1.lua default |
| 273 |
\$ cd ~/my\_modules/Core/gcc; ln -s 12.2.lua default |
| 274 |
\end{semiverbatim} |
| 275 |
} |
| 276 |
\end{frame} |
| 277 |
|
| 278 |
% page 19 |
| 279 |
\begin{frame}{Now support two versions of boost} |
| 280 |
\begin{itemize} |
| 281 |
\item gcc boost: |
| 282 |
\item \textasciitilde{}/my\_modules/Compiler/gcc/12/boost/1.85.0.lua |
| 283 |
\item intel boost |
| 284 |
\item \textasciitilde{}/my\_modules/Compiler/intel/19/boost/1.85.0.lua |
| 285 |
\end{itemize} |
| 286 |
\end{frame} |
| 287 |
|
| 288 |
% page 20 |
| 289 |
\begin{frame}{What about mpi libraries and applications} |
| 290 |
\begin{itemize} |
| 291 |
\item Similar to what was shown above |
| 292 |
\item See https://lmod.readthedocs.io/en/latest/340\_inherit.html |
| 293 |
for more details |
| 294 |
\end{itemize} |
| 295 |
\end{frame} |
| 296 |
|
| 297 |
% page 21 |
| 298 |
\begin{frame}{Conclusions} |
| 299 |
\begin{itemize} |
| 300 |
\item It is some work but it is possible to include personal libs/apps |
| 301 |
\item See the documentation |
| 302 |
\item Or see rt/user\_inherit for a full example |
| 303 |
\end{itemize} |
| 304 |
\end{frame} |
| 305 |
|
| 306 |
% page 22 |
| 307 |
\begin{frame}{Future Topics} |
| 308 |
\begin{itemize} |
| 309 |
\item Matthew will talk about how benchpro interacts with Lmod |
| 310 |
\item Next Meeting will be April 4th at 9:30 Central (14:30 UTC) |
| 311 |
(back to Summer time!) |
| 312 |
\end{itemize} |
| 313 |
\end{frame} |
| 314 |
|
| 315 |
\end{document} |