| 1 |
# -------------------------------------------------------- |
| 2 |
# Demonstration of some new features coming in Modules v4+ |
| 3 |
# -------------------------------------------------------- |
| 4 |
|
| 5 |
|
| 6 |
# config sub-command: get and set Modules configuration |
| 7 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 8 |
module config |
| 9 |
module config color |
| 10 |
|
| 11 |
module av |
| 12 |
|
| 13 |
# ^ color mode is disabled ^ |
| 14 |
|
| 15 |
module config color auto |
| 16 |
module config color |
| 17 |
|
| 18 |
module av |
| 19 |
# ^ color mode is now enabled ^ |
| 20 |
|
| 21 |
# automated module handling mode: solving dependencies |
| 22 |
# between modules consistently and automatically |
| 23 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 24 |
|
| 25 |
module show appA |
| 26 |
module show toolchain/b libY libX |
| 27 |
|
| 28 |
# loading appA with backward-compatible config will |
| 29 |
# ask for requirements to be loaded manually |
| 30 |
|
| 31 |
module load appA |
| 32 |
|
| 33 |
# enabling auto_handling will trigger automated mechanisms |
| 34 |
# to satisfy the dependencies expressed |
| 35 |
|
| 36 |
module config auto_handling 1 |
| 37 |
module load appA |
| 38 |
|
| 39 |
# ^ requirements have been loaded automatically ^ |
| 40 |
|
| 41 |
module unload appA |
| 42 |
|
| 43 |
# ^ automatically loaded requirements have been unloaded automatically ^ |
| 44 |
|
| 45 |
module load appA |
| 46 |
module unload toolchain |
| 47 |
|
| 48 |
# ^ unloading a dependency automatically unloads dependent modules ^ |
| 49 |
|
| 50 |
module list |
| 51 |
module load appA |
| 52 |
module switch libX/1.0 |
| 53 |
|
| 54 |
# ^ Replacing a dependency by another reloads dependent modules ^ |
| 55 |
|
| 56 |
# module insensitive case match |
| 57 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 58 |
|
| 59 |
module av |
| 60 |
|
| 61 |
module config icase |
| 62 |
module av appb |
| 63 |
# ^ match is case-sensitive by default ^ |
| 64 |
|
| 65 |
# enable insensitive case match for search |
| 66 |
module config icase search |
| 67 |
module av appb |
| 68 |
|
| 69 |
module show appB |
| 70 |
module load appB |
| 71 |
# ^ requirement is not found as it is expressed in a case insensitive manner ^ |
| 72 |
|
| 73 |
# icase match can even be enabled for all context |
| 74 |
|
| 75 |
module config icase always |
| 76 |
module show appb |
| 77 |
module load appb |
| 78 |
|
| 79 |
# extended default: abbreviated specification of module versions |
| 80 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 81 |
|
| 82 |
module av appC |
| 83 |
|
| 84 |
module load -v appC/1 |
| 85 |
# ^ by default, exact version should be specified to get module ^ |
| 86 |
|
| 87 |
module config extended_default 1 |
| 88 |
module load -v appC/1 |
| 89 |
# ^ with extended default enabled, module version can be abbreviated ^ |
| 90 |
|
| 91 |
module purge |
| 92 |
module load -v appC/2 |
| 93 |
# ^ among possibilities, default version is selected if part of them ^ |
| 94 |
|
| 95 |
module purge |
| 96 |
module load -v appC/2.2 |
| 97 |
# ^ if no default version among possibilities, latest version is selected ^ |
| 98 |
|
| 99 |
# extended default may also be used within modulefiles |
| 100 |
module purge |
| 101 |
module show appC/3 |
| 102 |
module load appC/3 |
| 103 |
|
| 104 |
# advanced module version specifiers: smooth module version |
| 105 |
# specification leveraging Spack's syntax |
| 106 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 107 |
|
| 108 |
module av appC |
| 109 |
module config advanced_version_spec 1 |
| 110 |
|
| 111 |
# specify a single version |
| 112 |
module av appC@1 |
| 113 |
|
| 114 |
# get versions higher than or equal to |
| 115 |
module av [email protected]: |
| 116 |
|
| 117 |
# get versions in between |
| 118 |
module av [email protected]:2.4 |
| 119 |
|
| 120 |
# get versions less than or equal to |
| 121 |
module av appC@:2.0 |
| 122 |
|
| 123 |
# get versions among list |
| 124 |
module av [email protected],3.6 |
| 125 |
|
| 126 |
# advanced version specifiers apply to all commands when enabled |
| 127 |
|
| 128 |
module purge |
| 129 |
module load -v appC@2: |
| 130 |
|
| 131 |
# ^ on a selection context, default version is retained if part of results ^ |
| 132 |
|
| 133 |
module purge |
| 134 |
module load -v [email protected]:2.4 |
| 135 |
|
| 136 |
# ^ if no default among results, highest version is selected ^ |
| 137 |
|
| 138 |
module purge |
| 139 |
|
| 140 |
# advanced version specifiers also apply within modulefile |
| 141 |
# could be used to specify smooth dependencies between modules |
| 142 |
|
| 143 |
module show appD@:1 |
| 144 |
module load appD@:1 |
| 145 |
|
| 146 |
module purge |
| 147 |
module show appD@2,3 |
| 148 |
module load appD@2,3 |
| 149 |
|
| 150 |
# ------------------------- |
| 151 |
# Thanks for your attention |
| 152 |
# ------------------------- |
| 153 |
|