Skip to content

Commit 435db16

Browse files
authored
linaro-forge (#53)
1 parent d076d75 commit 435db16

File tree

7 files changed

+315
-0
lines changed

7 files changed

+315
-0
lines changed

Diff for: config.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,17 @@ uenvs:
6464
deploy:
6565
eiger: [zen2]
6666
develop: False
67+
linaro-forge:
68+
"23.0.3":
69+
recipes:
70+
zen2: "23.0.3"
71+
zen3: "23.0.3"
72+
a100: "23.0.3"
73+
deploy:
74+
eiger: [zen2]
75+
clariden: [a100]
76+
develop: False
77+
mount: "/user-tools"
6778
mch:
6879
# v5 was deprecated from the build config due to an out of date
6980
# version of spack (v0.19)

Diff for: docs/uenv-linaro-forge.md

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Linaro Forge (DDT) debugger
2+
3+
- https://www.linaroforge.com/downloadForge
4+
5+
Linaro Forge (formerly known as DDT) allows source-level debugging of Fortran,
6+
C, C++ and Python codes. It can be used for debugging serial, multi-threaded
7+
(OpenMP), multi-process (MPI) and accelerated (Cuda, OpenACC) programs running
8+
on research and production systems, including CSCS Alps system. It can be
9+
executed either as a graphical user interface or from the command-line.
10+
11+
## Using the debugger
12+
13+
In order to debug your code on Alps, you need to:
14+
15+
- install the Forge/DDT client on your laptop,
16+
- setup the user environment on Alps,
17+
- build an executable with debug flags on Alps,
18+
- launch a job with the debugger on Alps.
19+
20+
21+
### Install the client on your laptop
22+
23+
We recommend to download and install the [desktop client](https://www.linaroforge.com/downloadForge) on your local workstation/laptop. It will connect with the debug jobs running on Alps, offering a better user experience compared to opening ddt with X11 forwarding. The client can be downloaded for a selection of operating systems.
24+
25+
Once installed, the client needs to be configured to connect to your preferred vcluster. For this, launch the client:
26+
27+
- mac: open /Applications/Linaro\ Forge\ Client\ 23.0.1.app/
28+
- linux: $HOME/linaro/forge/23.0.1/bin/ddt
29+
30+
and setup the connection:
31+
32+
```
33+
- open the 'Remote Launch' menu and click on 'configure' then 'Add' and set the fields, for example:
34+
- Connection Name: alps
35+
36+
37+
# Note that the clariden vlcuster name can be replaced with another vcluster name
38+
39+
- Remote install dir: uenv run IMG -- DDTDIR
40+
# here we tell the client to use the ddt installed in the uenv image
41+
```
42+
43+
where you can replace `IMG` and `DDTDIR` with for example:
44+
45+
- `IMG`: full path to the uenv file and mount point, for example:
46+
- _/scratch/e1000/your-cscs-username-here/linaro-forge-23.0.3.squashfs:/user-tools_
47+
- `DDTDIR`: full path to the tool, for example:
48+
- _/user-tools/linux-sles15-zen2/gcc-11.3.0/linaro-forge-23.0.3-3z4k6ijkcxcgqymv6mapv6xaela7m2q5/_
49+
50+
and
51+
52+
```
53+
- Remote Script:
54+
55+
- Private Key: _path-to-your-home_/.ssh/cscs-key
56+
57+
- Proxy through login node: yes (check the box)
58+
```
59+
60+
Click `Test Remote Launch`. If the client can connect, you are ready to debug:
61+
click on `ok` and `close` (to save the configuration). You can now connect by going to `Remote Launch` and choose the `Alps` entry. If the client fails to connect, look at the message, check your ssh configuration and make sure you can ssh without the client.
62+
63+
### Setup the environment
64+
65+
`linaro-forge-23.0.3.squashfs` provides the latest version of Linaro Forge (23.0.3).
66+
67+
- On Alps:
68+
```bash
69+
uenv start ./linaro-forge-23.0.3.squashfs
70+
uenv modules use
71+
module load linaro-forge
72+
ddt --version
73+
# Version: 23.0.3
74+
```
75+
76+
### Build with debug flags
77+
78+
Once the uenv is loaded and activated, the program to debug must be compiled with the `-g` (for cpu) and `-G` (for gpu) debugging flags. For example, let's build a cuda code with a user environment:
79+
80+
- on Alps:
81+
```bash
82+
uenv start store.squashfs
83+
uenv modules use
84+
module load gcc cray-mpich cuda
85+
git clone -b ddt https://github.com/jgphpc/octree-miniapp \
86+
octree-miniapp.git
87+
make -C octree-miniapp.git/
88+
```
89+
90+
### Launch the code with the debugger
91+
92+
Given the unusual way of loading the uenv, the DDT client must be launched in `Manual Launch` mode (assuming that it is connected to Alps via `Remote Launch`):
93+
94+
- on the client:
95+
```
96+
- open the 'Manual Launch' menu and
97+
- set the fields, for example:
98+
- Number of processes: 12
99+
- CUDA: yes (check the box for gpu exeutables)
100+
```
101+
Listen and wait
102+
103+
You can then launch ddt with the srun command (or a Slurm jobscript):
104+
105+
- on Alps:
106+
```bash
107+
unset CUDA_VISIBLE_DEVICES
108+
srun --uenv=$UENV_SQFS,TOOL_SQFS \
109+
-l -N3 -n12 -t10 -pnvgpu \
110+
./octree-miniapp.git/cuda_visible_devices.sh \
111+
$DDT_CLIENT
112+
./octree-miniapp.git/neighbor_search.exe 120000
113+
```
114+
115+
where for example:
116+
117+
- UENV_SQFS=$PWD/store.squashfs:/user-environment
118+
- TOOL_SQFS=$PWD/linaro-forge-23.0.3.squashfs:/user-tools
119+
- DDT_CLIENT=/user-tools/linux-sles15-zen2/gcc-11.3.0/linaro-forge-23.0.3-3z4k6ijkcxcgqymv6mapv6xaela7m2q5/bin/ddt-client
120+
121+
122+
This screenshot shows a debugging session on 12 gpus:
123+
124+
![DDT](https://raw.githubusercontent.com/jgphpc/octree-miniapp/ddt/img/ddt.png)

Diff for: recipes/linaro-forge/23.0.3/compilers.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
bootstrap:
2+
spec: gcc@12
3+
gcc:
4+
specs:
5+
- gcc@12

Diff for: recipes/linaro-forge/23.0.3/config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: linaro
2+
store: /user-tools
3+
spack:
4+
repo: https://github.com/spack/spack.git
5+
commit: releases/v0.21
6+
modules: True

Diff for: recipes/linaro-forge/23.0.3/environments.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
linaro:
2+
views:
3+
default:
4+
compiler:
5+
- toolchain: gcc
6+
spec: gcc
7+
unify: true
8+
specs:
9+
- linaro-forge +accept-eula

Diff for: recipes/linaro-forge/23.0.3/modules.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
modules:
2+
# Paths to check when creating modules for all module sets
3+
prefix_inspections:
4+
bin:
5+
- PATH
6+
lib:
7+
- LD_LIBRARY_PATH
8+
lib64:
9+
- LD_LIBRARY_PATH
10+
11+
default:
12+
arch_folder: false
13+
# Where to install modules
14+
roots:
15+
tcl: /user-environment/modules
16+
tcl:
17+
all:
18+
autoload: none
19+
hash_length: 0
20+
exclude_implicits: true
21+
exclude: ['%[email protected]', 'gcc %[email protected]']
22+
projections:
23+
all: '{name}/{version}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
2+
# Spack Project Developers. See the top-level COPYRIGHT file for details.
3+
#
4+
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
5+
6+
import os
7+
import platform
8+
import subprocess
9+
10+
from spack.package import *
11+
12+
13+
class LinaroForge(Package):
14+
"""Build reliable and optimized code for the right results on multiple
15+
Server and HPC architectures, from the latest compilers and C++ standards
16+
to Intel, 64-bit Arm, AMD, OpenPOWER and Nvidia GPU hardware. Linaro Forge
17+
combines Linaro DDT, the leading debugger for time-saving high performance
18+
application debugging, Linaro MAP, the trusted performance profiler for
19+
invaluable optimization advice across native and Python HPC codes, and
20+
Linaro Performance Reports for advanced reporting capabilities."""
21+
22+
homepage = "https://www.linaroforge.com"
23+
maintainers("kenche-linaro")
24+
25+
if platform.machine() in ["aarch64", "arm64"]:
26+
version(
27+
"23.0.3", sha256="a7e23ef2a187f8e2d6a6692cafb931c9bb614abf58e45ea9c2287191c4c44f02"
28+
)
29+
version(
30+
"23.0.2", sha256="698fda8f7cc05a06909e5dcc50b9956f94135d7b12e84ffb21999a5b45c70c74"
31+
)
32+
version(
33+
"23.0.1", sha256="552e4a3f408ed4eb5f1bfbb83c94530ee8733579c56c3e98050c0ad2d43eb433"
34+
)
35+
version("23.0", sha256="7ae20bb27d539751d1776d1e09a65dcce821fc6a75f924675439f791261783fb")
36+
version(
37+
"22.1.4", sha256="4e2af481a37b4c99dba0de6fac75ac945316955fc4170d06e321530adea7ac9f"
38+
)
39+
version(
40+
"21.1.3", sha256="4a4ff7372aad5a31fc9e18b7b6c493691ab37d8d44a3158584e62d1ab82b0eeb"
41+
)
42+
elif platform.machine() == "ppc64le":
43+
version(
44+
"23.0.3", sha256="5ff9770f4bc4a2df4bac8a2544a9d6bad9fba2556420fa2e659e5c21e741caf7"
45+
)
46+
version(
47+
"23.0.2", sha256="181b157bdfc8609b49addf63023f920ebb609dbc9a126e9dc26605188b756ff0"
48+
)
49+
version(
50+
"23.0.1", sha256="08cffef2195ea96872d56e827f320eed40aaa82fd3b62d4c661a598fb2fb3a47"
51+
)
52+
version("23.0", sha256="0962c7e0da0f450cf6daffe1156e1f59e02c9f643df458ec8458527afcde5b4d")
53+
version(
54+
"22.1.3", sha256="6479c3a4ae6ce6648c37594eb0266161f06d9f89010fca9299855848661dda49"
55+
)
56+
version(
57+
"22.0.4", sha256="f4cb5bcbaa67f9209299fe4653186a2829760b8b16a2883913aa43766375b04c"
58+
)
59+
version(
60+
"21.1.3", sha256="eecbc5686d60994c5468b2d7cd37bebe5d9ac0ba37bd1f98fbfc69b071db541e"
61+
)
62+
elif platform.machine() == "x86_64":
63+
version(
64+
"23.0.3", sha256="f2a010b94838f174f057cd89d12d03a89ca946163536eab178dd1ec877cdc27f"
65+
)
66+
version(
67+
"23.0.2", sha256="565f0c073c6c8cbb06c062ca414e3f6ff8c6ca6797b03d247b030a9fbc55a5b1"
68+
)
69+
version(
70+
"23.0.1", sha256="1d681891c0c725363f0f45584c9b79e669d5c9782158453b7d24b4b865d72755"
71+
)
72+
version("23.0", sha256="f4ab12289c992dd07cb1a15dd985ef4713d1f9c0cf362ec5e9c995cca9b1cf81")
73+
version(
74+
"22.1.3", sha256="4f8a8b1df6ad712e89c82eedf4bd85b93b57b3c8d5b37d13480ff058fa8f4467"
75+
)
76+
version(
77+
"22.0.4", sha256="a2c8c1da38b9684d7c4656a98b3fc42777b03fd474cd0bf969324804f47587e5"
78+
)
79+
version(
80+
"21.1.3", sha256="03dc82f1d075deb6f08d1e3e6592dc9b630d406c08a1316d89c436b5874f3407"
81+
)
82+
83+
variant(
84+
"probe",
85+
default=False,
86+
description='Detect available PMU counters via "forge-probe" during install',
87+
)
88+
89+
variant("accept-eula", default=False, description="Accept the EULA")
90+
91+
# forge-probe executes with "/usr/bin/env python"
92+
depends_on("[email protected]:", type="build", when="+probe")
93+
94+
# Licensing
95+
license_required = False
96+
97+
def url_for_version(self, version):
98+
pre = "arm" if version < Version("23.0") else "linaro"
99+
return f"https://downloads.linaroforge.com/{version}/{pre}-forge-{version}-linux-{platform.machine()}.tar"
100+
101+
@run_before("install")
102+
def abort_without_eula_acceptance(self):
103+
install_example = "spack install linaro-forge +accept-eula"
104+
license_terms_path = os.path.join(self.stage.source_path, "license_terms")
105+
if not self.spec.variants["accept-eula"].value:
106+
raise InstallError(
107+
"\n\n\nNOTE:\nUse +accept-eula "
108+
+ "during installation "
109+
+ "to accept the license terms in:\n"
110+
+ " {0}\n".format(os.path.join(license_terms_path, "license_agreement.txt"))
111+
+ " {0}\n\n".format(os.path.join(license_terms_path, "supplementary_terms.txt"))
112+
+ "Example: '{0}'\n".format(install_example)
113+
)
114+
115+
def install(self, spec, prefix):
116+
subprocess.call(["./textinstall.sh", "--accept-license", prefix])
117+
if spec.satisfies("+probe"):
118+
probe = join_path(prefix, "bin", "forge-probe")
119+
subprocess.call([probe, "--install", "global"])
120+
121+
def setup_run_environment(self, env):
122+
# Only PATH is needed for Forge.
123+
# Adding lib to LD_LIBRARY_PATH can cause conflicts with Forge's internal libs.
124+
env.clear()
125+
env.prepend_path("PATH", join_path(self.prefix, "bin"))
126+
127+
@run_after("install")
128+
def cscs_license(self):
129+
cscs_license = join_path(self.prefix, "licences", "License")
130+
with open(cscs_license, "w") as f:
131+
# will expire end of May/2026
132+
f.write("type=2\n")
133+
f.write("serial_number=17741\n")
134+
f.write("hostname=velan.cscs.ch\n")
135+
f.write("serverport=4241\n")
136+
f.write("features=ddt,map,perf-report,cuda,metrics-pack\n")
137+
f.write("hash2=b013e17d168ebec7291c66401832d113963c0cb5\n")

0 commit comments

Comments
 (0)