Skip to content

Commit 82cad94

Browse files
authored
add terminal docs (#65)
1 parent 0642509 commit 82cad94

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

docs/access/vscode.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ There are two executables, one for using on systems with x86 or ARM CPUs respect
3333
tar -xf vscode_cli_alpine_x64_cli.tar.gz
3434
```
3535

36+
!!! note
37+
See the guide on how to manage [architecture-specific binaries][ref-guides-terminal-arch] if you plan to use VScode on both x86 and ARM clusters.
38+
3639
Alternatively, download the CLI tool from the [VS Code site](https://code.visualstudio.com/Download) -- take care to select either x86 or Arm64 version that matches the target system.
3740

3841
After downloading, copy the `code` executable to a location in your PATH, so that it is available for future sessions.

docs/guides/terminal.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
[](){#ref-guides-terminal}
2+
# Terminal usage on Alps
3+
4+
This documentation is a collection of guides, hints, and tips for setting up your terminal environment on Alps.
5+
6+
[](){#ref-guides-terminal-shells}
7+
## Shells
8+
9+
Every user has a shell that will be used when they log in, with [bash](https://www.gnu.org/software/bash/) as the default shell for new users at CSCS.
10+
11+
At CSCS the vast majority of users stick with the default `bash`: at the time of writing, of over 1000 users on Daint, over 99% were using bash.
12+
13+
!!! example "Which shell am I using?"
14+
15+
Run the following command after logging in:
16+
17+
```terminal
18+
$ getent passwd | grep $USER
19+
bcumming:*:22008:1000:Benjamin Cumming, CSCS:/users/bcumming:/usr/local/bin/bash
20+
```
21+
22+
The last entry in the output points to the shell of the user, in this case `/usr/local/bin/bash`.
23+
24+
!!! tip
25+
If you would like to change your shell, for example to [zsh](https://www.zsh.org), you have to open a [service desk](https://jira.cscs.ch/plugins/servlet/desk) ticket to request the change. You can't make the change yourself.
26+
27+
28+
!!! warning
29+
Because `bash` is used by all CSCS staff and the overwhelming majority of users, it is the best tested, and safest default.
30+
31+
We strongly recommend against using cshell - tools like uenv are not tested against it.
32+
33+
[](){#ref-guides-terminal-arch}
34+
## Managing x86 and ARM
35+
36+
Alps has nodes with different CPU architectures, for example [Santis][ref-cluster-santis] has ARM (Grace `aarch64`) processors, and [Eiger][ref-cluster-eiger] uses x86 (AMD Rome `x86_64`) processors.
37+
Binary applications are generally not portable, for example if you compile or install a tool compiled for `x86_64` on Eiger, you will get an error when you run it on an `aarch64` node.
38+
39+
??? warning "cannot execute binary file: Exec format error"
40+
You will see this error message if you try to execute an executable built for a different architecture.
41+
42+
In this case, the `rg` executable built for `aarch64` (Grace-Hopper nodes) is run on an `x86_64` node on [Eiger][ref-cluster-eiger]:
43+
```
44+
$ ~/.local/aarch64/bin/rg
45+
-bash: ./rg: cannot execute binary file: Exec format error
46+
```
47+
48+
A common pattern for installing local software, for example some useful command line utilities like [ripgrep](https://github.com/BurntSushi/ripgrep), is to install them in `$HOME/.local/bin`.
49+
This approach won't work if the same home directory is mounted on two different clusters with different architectures: the version of ripgrep in our example would crash with `Exec format error` on one of the clusters.
50+
51+
Care needs to be taken to store executables, configuration and data for different architecures in separate locations, and automatically configure the login environment to use the correct location when you log into different systems.
52+
53+
The following example:
54+
* sets architecture-specific `bin` path for installing programs
55+
* sets architecture-specific paths for installing application data and configuration
56+
* selects the correct path by running `uname -m` when you log in to a cluster
57+
58+
```bash title=".bashrc"
59+
# Set the "base" directory in which all architecture specific will be installed.
60+
# The $(uname -m) command will generate either x86_64 or aarch64 to match the
61+
# node type, when run during login.
62+
xdgbase=$HOME/.local/$(uname -m)
63+
64+
# The XDG variables define where applications look for configurations
65+
export XDG_DATA_HOME=$xdgbase/share
66+
export XDG_CONFIG_HOME=$xdgbase/config
67+
export XDG_STATE_HOME=$xdgbase/state
68+
69+
# set PATH to look for in architecture specific path:
70+
# - on x86: $HOME/.local/x86_64/bin
71+
# - on ARM: $HOME/.local/aarch64/bin
72+
export ARCHPATH=$xdgbase/bin
73+
export PATH=$ARCHPATH:$PATH
74+
```
75+
76+
!!! note "XDG what?"
77+
The [XDG base directory specification](https://specifications.freedesktop.org/basedir-spec/latest/) is used by most applications to determine where to look for configurations, and where to store data and temporary files.
78+

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ nav:
9797
- guides/index.md
9898
- 'Internet Access on Alps': guides/internet-access.md
9999
- 'Storage': guides/storage.md
100+
- 'Using the terminal': guides/terminal.md
100101
- 'Gordon Bell 2025': guides/gb2025.md
101102
- 'Policies':
102103
- policies/index.md

0 commit comments

Comments
 (0)