Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/+dev-lock.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`eb-local dev --lock MODULE...` writes `eb-local.lock`: the stack, the EESSI version, the CPU and accelerator target and every loaded module with its version, in load order. `eb-local dev --locked` loads exactly that list from a purged shell, refuses a lock of another stack, and loads none of it on a different CPU target. Node types that share a CPU target share a lock.
16 changes: 12 additions & 4 deletions docs/orgmode/reference/cli.org
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ eb-local [OPTION]... --explain <easyconfig> [eb options]
eb-local eb [--] [eb options]
eb-local --explain eb [--] [eb options]
eb-local [OPTION]... env [--strict] [--json]
eb-local [OPTION]... dev [--strict] [--pure] [--json] [--buildenv MODULE] [--envrc] [MODULE...]
eb-local [OPTION]... dev [--strict] [--pure] [--json] [--buildenv MODULE] [--envrc] [--lock | --locked] [MODULE...]
eb-local rpath-wrappers [--for FAMILY | --unwrapped]
eb-local check [--recursive] [--quiet] [--json] FILE...
eb-local check (--module NAME/VERSION... | --dev | --prefix DIR) [--recursive] [--quiet] [--json]
Expand Down Expand Up @@ -60,15 +60,17 @@ directory you own.
eb-local env [--strict] [--json] lines that make your installed modules visible;
--strict exits when the EESSI init file is missing
(also when EB_LOCAL_ENV_STRICT=1)
eb-local dev [--strict] [--pure] [--json] [--buildenv MODULE] [--envrc] [MODULE...]
eb-local dev [--strict] [--pure] [--json] [--buildenv MODULE] [--envrc] [--lock | --locked] [MODULE...]
the same, plus MODULEs and a build environment,
so gcc, make, cmake and meson just work;
--strict exits when the EESSI init file is missing
(also when EB_LOCAL_ENV_STRICT=1);
--buildenv names the build environment to load;
--json prints the change as JSON, for env too;
--envrc writes that line to .envrc for direnv;
--pure purges loaded modules and LD_* first
--pure purges loaded modules and LD_* first;
--lock records what loads in eb-local.lock,
--locked loads exactly that again
eb-local rpath-wrappers [--for FAMILY | --unwrapped]
lines that put RPATH wrappers for the compilers
on PATH first; dev uses them when no build
Expand Down Expand Up @@ -300,7 +302,7 @@ When stdout is a terminal, it also says on stderr that the lines change nothing

With =--json=, eb-local runs the lines in a bash child and prints how that shell's environment then differs from the caller's: ={"schema_version":1,"kind":"env","set":[{"name":...,"value":...}],"unset":[...]}=, both lists sorted by name. A shell that cannot evaluate POSIX lines applies it; in nushell:

#+begin_src nu
#+begin_src text
def --env --wrapped eb [...args] {
let change = (^eb-local ...$args --json | from json)
$change.set | reduce --fold {} {|var, acc| $acc | upsert $var.name $var.value } | load-env
Expand Down Expand Up @@ -333,6 +335,12 @@ eval "$(/path/to/eb-local dev MODULE...)"

The program is named by its own path, and =--config=, =--profile=, =--project= and =--buildenv= are repeated on the line. A block already in the file is replaced and every other line is kept; a file without one gets it appended. A begin line without its end line is refused. Run =direnv allow= once per change. direnv evaluates the file in bash and gives the calling shell the change, so the environment follows the directory in bash, zsh, fish, nushell and the other shells direnv has a hook for, and is taken back on leaving it. As with =--json=, only variables reach the calling shell.
| =--pure= | Before anything loads, run =module purge= and unset =LD_LIBRARY_PATH=, =LD_PRELOAD= and =LD_AUDIT=. |
| =--lock= | Run the lines in a bash child and write what loaded to =eb-local.lock= in the working directory; print nothing on stdout. |
| =--locked= | Print the lines that load exactly the modules of =eb-local.lock=, from a purged shell. Takes no MODULE. |

=dev --lock MODULE...= records what a dev environment resolved to: =stack.module=, the EESSI version, the CPU target (=EESSI_SOFTWARE_SUBDIR=), the accelerator target, and every loaded module with its version, in load order, the build environment among them. The file is one line of JSON with =kind= =dev-lock=. It is not written when the lines load no module.

=dev --locked= loads that list and nothing else: it purges first, as =--pure= does, and names every module in full, so Lmod resolves nothing. A lock written with another =stack.module= is refused. When the shell's CPU target is not the lock's, the lines say so and load none of its modules; node types with the same CPU target share their binaries, so a lock from one loads on the other. =--json= and =--envrc= work with =--locked=: =dev --envrc --locked= writes the locked line to =.envrc=.

Without =--pure=, the modules the shell already has stay loaded beside the ones =dev= names, and the loader variables stay as they are, with a warning for =LD_LIBRARY_PATH=. With it, the build environment is the stack, the named modules and the build environment only. Sticky modules survive =module purge=. A site that preloads a library for every process (XALT through =LD_PRELOAD=) loses that in this shell.

Expand Down
16 changes: 12 additions & 4 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ eb-local [OPTION]... --explain <easyconfig> [eb options]
eb-local eb [--] [eb options]
eb-local --explain eb [--] [eb options]
eb-local [OPTION]... env [--strict] [--json]
eb-local [OPTION]... dev [--strict] [--pure] [--json] [--buildenv MODULE] [--envrc] [MODULE...]
eb-local [OPTION]... dev [--strict] [--pure] [--json] [--buildenv MODULE] [--envrc] [--lock | --locked] [MODULE...]
eb-local rpath-wrappers [--for FAMILY | --unwrapped]
eb-local check [--recursive] [--quiet] [--json] FILE...
eb-local check (--module NAME/VERSION... | --dev | --prefix DIR) [--recursive] [--quiet] [--json]
Expand Down Expand Up @@ -62,15 +62,17 @@ directory you own.
eb-local env [--strict] [--json] lines that make your installed modules visible;
--strict exits when the EESSI init file is missing
(also when EB_LOCAL_ENV_STRICT=1)
eb-local dev [--strict] [--pure] [--json] [--buildenv MODULE] [--envrc] [MODULE...]
eb-local dev [--strict] [--pure] [--json] [--buildenv MODULE] [--envrc] [--lock | --locked] [MODULE...]
the same, plus MODULEs and a build environment,
so gcc, make, cmake and meson just work;
--strict exits when the EESSI init file is missing
(also when EB_LOCAL_ENV_STRICT=1);
--buildenv names the build environment to load;
--json prints the change as JSON, for env too;
--envrc writes that line to .envrc for direnv;
--pure purges loaded modules and LD_* first
--pure purges loaded modules and LD_* first;
--lock records what loads in eb-local.lock,
--locked loads exactly that again
eb-local rpath-wrappers [--for FAMILY | --unwrapped]
lines that put RPATH wrappers for the compilers
on PATH first; dev uses them when no build
Expand Down Expand Up @@ -302,7 +304,7 @@ When stdout is a terminal, it also says on stderr that the lines change nothing

With `--json`, eb-local runs the lines in a bash child and prints how that shell's environment then differs from the caller's: `{"schema_version":1,"kind":"env","set":[{"name":...,"value":...}],"unset":[...]}`, both lists sorted by name. A shell that cannot evaluate POSIX lines applies it; in nushell:

```nu
```text
def --env --wrapped eb [...args] {
let change = (^eb-local ...$args --json | from json)
$change.set | reduce --fold {} {|var, acc| $acc | upsert $var.name $var.value } | load-env
Expand Down Expand Up @@ -337,6 +339,12 @@ The program is named by its own path, and `--config`, `--profile`, `--project` a

| `--pure` | Before anything loads, run `module purge` and unset `LD_LIBRARY_PATH`, `LD_PRELOAD` and `LD_AUDIT`. |
|---|---|
| `--lock` | Run the lines in a bash child and write what loaded to `eb-local.lock` in the working directory; print nothing on stdout. |
| `--locked` | Print the lines that load exactly the modules of `eb-local.lock`, from a purged shell. Takes no MODULE. |

`dev --lock MODULE...` records what a dev environment resolved to: `stack.module`, the EESSI version, the CPU target (`EESSI_SOFTWARE_SUBDIR`), the accelerator target, and every loaded module with its version, in load order, the build environment among them. The file is one line of JSON with `kind` `dev-lock`. It is not written when the lines load no module.

`dev --locked` loads that list and nothing else: it purges first, as `--pure` does, and names every module in full, so Lmod resolves nothing. A lock written with another `stack.module` is refused. When the shell's CPU target is not the lock's, the lines say so and load none of its modules; node types with the same CPU target share their binaries, so a lock from one loads on the other. `--json` and `--envrc` work with `--locked`: `dev --envrc --locked` writes the locked line to `.envrc`.

Without `--pure`, the modules the shell already has stay loaded beside the ones `dev` names, and the loader variables stay as they are, with a warning for `LD_LIBRARY_PATH`. With it, the build environment is the stack, the named modules and the build environment only. Sticky modules survive `module purge`. A site that preloads a library for every process (XALT through `LD_PRELOAD`) loses that in this shell.

Expand Down
Loading
Loading