|
1 | 1 | # Linaro Forge tools
|
2 | 2 |
|
3 |
| -[Linaro Forge](https://www.linaroforge.com/downloadForge) is a suite of profiling |
4 |
| -and debugging tools. It includes Linaro DDT debugger and Linaro MAP profiler. These |
5 |
| -tools allow source-level debugging and profiling of Fortran, C, C++ and Python codes. |
6 |
| -They can be used for debugging and profiling serial, multi-threaded (OpenMP), |
7 |
| -multi-process (MPI) and accelerated (Cuda, OpenACC) programs running on research and |
8 |
| -production systems, including CSCS Alps system. They can be executed either as a |
9 |
| -graphical user interface or from the command-line. |
10 |
| - |
11 |
| -## Quickstart guide |
12 |
| - |
13 |
| -The name of the uenv image is `linaro-forge`, and the available versions on a |
14 |
| -cluster can be determined using the `uenv image find` command, for example: |
15 |
| -``` |
16 |
| -> uenv image find linaro-forge |
17 |
| -uenv/version:tag uarch date id size |
18 |
| -linaro-forge/23.1.2:latest gh200 2024-04-10 ea67dbb33801c7c3 342MB |
19 |
| -``` |
20 |
| - |
21 |
| -The linaro tools are configured to be mounted in the `/user-tools` path so that |
22 |
| -they can be used alongside application and development uenv mounted at |
23 |
| -`user-environment`. |
24 |
| - |
25 |
| -=== "sidecar" |
26 |
| - |
27 |
| - When using alongside another uenv, start a uenv session with both uenv with `linaro-forge` after the main uenv, to mount the images at the respective `/user-environment` and `/user-tools` locations: |
28 |
| - |
29 |
| - ```bash |
30 |
| - uenv start --view=prgenv-gnu:default,forge prgenv-gnu/24.2,linaro-forge/23.1.2 |
31 |
| - |
32 |
| - # test that everything has been mounted correctly |
33 |
| - # (will give warnings if there are problems) |
34 |
| - uenv status |
35 |
| - |
36 |
| - # check that ddt is in the path |
37 |
| - ddt --version |
38 |
| - ``` |
39 |
| - |
40 |
| -=== "standalone" |
41 |
| - |
42 |
| - When using the uenv with no other environment mounted, you will need to explicitly set the `/user-tools` mount point: |
43 |
| - |
44 |
| - ```bash |
45 |
| - uenv start linaro-forge/23.1.2:/user-tools |
46 |
| - |
47 |
| - source /user-tools/activate |
48 |
| - |
49 |
| - # check that ddt is in the path |
50 |
| - ddt --version |
51 |
| - ``` |
52 |
| - |
53 |
| - The `/user-tools/activate` script will make the forge executables available in your environment. |
54 |
| - |
55 |
| -## User guide |
56 |
| - |
57 |
| -In order to debug your code on Alps, you need to: |
58 |
| - |
59 |
| -1. pull the linaro-forge uenv on the target Alps vCluster |
60 |
| -- install the Linaro Forge client on your local system (desktop/laptop) |
61 |
| -- build an executable with debug flags |
62 |
| -- launch a job with the debugger on Alps |
63 |
| -- start debugging/profiling |
64 |
| - |
65 |
| -### Pull the Linaro Forge uenv on the Alps cluster |
66 |
| - |
67 |
| -The first step is to download the latest version of linaro-forge that is |
68 |
| -available on the cluster. First, SSH into the target system, then use the |
69 |
| -`uenv image find` command to list the available versions on the system: |
70 |
| - |
71 |
| -``` |
72 |
| -> uenv image find linaro-forge |
73 |
| -uenv/version:tag uarch date id size |
74 |
| -linaro-forge/23.1.2:latest gh200 2024-04-10 ea67dbb33801c7c3 342MB |
75 |
| -``` |
76 |
| - |
77 |
| -In this example, there is a single version available. Next we pull the image so |
78 |
| -that it is available locally. |
79 |
| - |
80 |
| -``` |
81 |
| -> uenv image pull linaro-forge/23.1.2:latest |
82 |
| -``` |
83 |
| - |
84 |
| -It will take a few seconds to download the image. Once complete, check that it |
85 |
| -was downloaded using the `uenv image ls` command: |
86 |
| - |
87 |
| -``` |
88 |
| -> uenv image ls linaro-forge |
89 |
| -uenv/version:tag uarch date id size |
90 |
| -linaro-forge/23.1.2:latest gh200 2024-04-05 ea67dbb33801c7c3 342MB |
91 |
| -``` |
92 |
| - |
93 |
| -### Install and configure the client on your local machine |
94 |
| - |
95 |
| -We recommend installing the [desktop client](https://www.linaroforge.com/downloadForge) |
96 |
| -on your local workstation/laptop. |
97 |
| -It can be downloaded for a selection of operating systems. |
98 |
| - |
99 |
| -The client can be configured to connect with the debug jobs running on Alps, offering a |
100 |
| -better user experience compared to running with X11 forwarding. |
101 |
| - |
102 |
| -Once installed, the client needs to be configured to connect to the vCluster on |
103 |
| -which you are working. First, start the client on your laptop: |
104 |
| - |
105 |
| -=== "Linux" |
106 |
| - |
107 |
| - The path will change if you have installed a different version, or if it has been installed in a non-standard installation location. |
108 |
| - |
109 |
| - ```bash |
110 |
| - $HOME/linaro/forge/23.0.1/bin/ddt |
111 |
| - ``` |
112 |
| - |
113 |
| -=== "MacOS" |
114 |
| - |
115 |
| - The path will change if you have installed a different version, or if it has been installed in a non-standard installation location. |
116 |
| - |
117 |
| - ```bash |
118 |
| - open /Applications/Linaro\ Forge\ Client\ 23.0.1.app/ |
119 |
| - ``` |
120 |
| - |
121 |
| -Next, configure a connection to the target system. |
122 |
| -Open the *Remote Launch* menu and click on *configure* then *Add*. |
123 |
| -Examples of the settings are below. |
124 |
| - |
125 |
| -=== "Eiger" |
126 |
| - |
127 |
| - | Field | Value | |
128 |
| - | ----------- | --------------------------------------- | |
129 |
| - | Connection | `eiger` | |
130 |
| - |
131 |
| - | Remote Installation Directory | `uenv run linaro-forge/23.1.2:/user-tools -- /user-tools/env/forge/` | |
132 |
| - | Private Key | `$HOME/.ssh/cscs-key` | |
133 |
| - |
134 |
| -=== "Todi" |
135 |
| - |
136 |
| - | Field | Value | |
137 |
| - | ----------- | --------------------------------------- | |
138 |
| - | Connection | `todi` | |
139 |
| - |
140 |
| - | Remote Installation Directory | `uenv run linaro-forge/23.1.2:/user-tools -- /user-tools/env/forge/` | |
141 |
| - |
142 |
| -=== "Santis" |
143 |
| - |
144 |
| - | Field | Value | |
145 |
| - | ----------- | --------------------------------------- | |
146 |
| - | Connection | `santis` | |
147 |
| - |
148 |
| - | Remote Installation Directory | `uenv run linaro-forge/23.1.2:/user-tools -- /user-tools/env/forge/` | |
149 |
| - | Private Key | `$HOME/.ssh/cscs-key` | |
150 |
| - |
151 |
| - |
152 |
| -Some notes on the examples above: |
153 |
| - |
154 |
| -* SSH Forwarding via `ela.cscs.ch` is used to access the cluster. |
155 |
| -* replace the username `bsmith` with your CSCS user name that you would normally use to open an SSH connection to CSCS. |
156 |
| -* `Remote Installation Path` is pointing to the install directotory of ddt inside the image |
157 |
| -* private keys should be the ones generated for CSCS MFA, and this field does not need to be set if you have added the key to your SSH agent. |
158 |
| - |
159 |
| -Once configured, test and save the configuration: |
160 |
| - |
161 |
| -1. check whether the configuration is correct, click `Test Remote Launch`. |
162 |
| -2. Click on `ok` and `close` to save the configuration. |
163 |
| -3. 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. |
164 |
| - |
165 |
| -### Setup the user environment and build the executable |
166 |
| - |
167 |
| -Once the uenv is loaded and activated, the program to debug must be compiled |
168 |
| -with the `-g` (for cpu) and `-G` (for gpu) debugging flags. For example, we can |
169 |
| -build a cuda test with a user environment: |
170 |
| - |
171 |
| -```bash |
172 |
| -uenv start --view=default prgenv-gnu:24.2 |
173 |
| - |
174 |
| -nvcc -c -arch=sm_90 -g -G test_gpu.cu |
175 |
| -mpicxx -g test_cpu.cpp test_gpu.o -o myexe |
176 |
| -``` |
177 |
| - |
178 |
| -### Launch Linaro Forge |
179 |
| - |
180 |
| -#### Linaro DDT |
181 |
| - |
182 |
| -To use the DDT client with uenv, it must be launched in `Manual Launch` mode |
183 |
| -(assuming that it is connected to Alps via `Remote Launch`): |
184 |
| - |
185 |
| -=== "on local machine" |
186 |
| - |
187 |
| - Start DDT, and connect to the target cluster using the drop down menu for Remote Launch. |
188 |
| - |
189 |
| - Click on Manual launch, set the number of processes to listen to, |
190 |
| - then wait for the slurm job to start (see the "on Alps" tab). |
191 |
| - |
192 |
| - <img src="https://raw.githubusercontent.com/jgphpc/cornerstone-octree/ddt/scripts/img/ddt/0.png" width="600" /> |
193 |
| - |
194 |
| -=== "on Alps" |
195 |
| - |
196 |
| - log into the system and launch with the srun command: |
197 |
| - |
198 |
| - ```bash |
199 |
| - # start a session with both the PE used to build your application |
200 |
| - # and the linaro-forge uenv mounted |
201 |
| - uenv start --view=prgenv-gnu:default,forge prgenv-gnu/24.2,linaro-forge/23.1.2 |
202 |
| - |
203 |
| - srun -N1 -n4 -t15 -pdebug \ |
204 |
| - ./cuda_visible_devices.sh ddt-client ./myexe |
205 |
| - ``` |
206 |
| - |
207 |
| -##### Start debugging |
208 |
| - |
209 |
| -By default, DDT will pause execution on the call to MPI_Init: |
210 |
| -<img src="https://raw.githubusercontent.com/jgphpc/cornerstone-octree/ddt/scripts/img/ddt/1.png" width="600" /> |
211 |
| - |
212 |
| -There are more than 1 mechanism for controlling program execution: |
213 |
| - |
214 |
| -=== "Breakpoint" |
215 |
| - |
216 |
| - Breakpoint(s) can be set by clicking in the margin to the left of the line number: |
217 |
| - |
218 |
| - <img src="https://raw.githubusercontent.com/jgphpc/cornerstone-octree/ddt/scripts/img/ddt/3.png" width="600" /> |
219 |
| - |
220 |
| -=== "Stop at" |
221 |
| - |
222 |
| - Execution can be paused in every CUDA kernel launch by activating the default: |
223 |
| - |
224 |
| - <img src="https://raw.githubusercontent.com/jgphpc/cornerstone-octree/ddt/scripts/img/ddt/4.png" width="400" /> |
225 |
| - |
226 |
| - |
227 |
| -This screenshot shows a debugging session on 128 gpus:  |
228 |
| - |
229 |
| -More information regarding how to use Linaro DDT be found in the Forge [User Guide](https://docs.linaroforge.com/latest/html/forge/index.html). |
230 |
| - |
231 |
| -#### Linaro MAP |
232 |
| - |
233 |
| -Linaro MAP can be used to profile an application either by the GUI or by the CLI. In the first case the user can set the profiling configuration using the GUI and then see the results. In the latter, the user can use the MAP executable to launch the application they want to profile which will generate a report file that can then be opened from the GUI. |
234 |
| - |
235 |
| -##### Profile application |
236 |
| - |
237 |
| -We'll focus here on the profiling using the CLI but the same configuration applies in the other case as well. |
238 |
| - |
239 |
| -To debug an MPI application on Alps the following script is necessary: |
240 |
| - |
241 |
| -```bash |
242 |
| -map -n <num_of_procs> --mpi=slurm --mpiargs="<slurm_arguments>" --profile <executable> <executable_arguments> |
243 |
| -``` |
244 |
| - |
245 |
| -This will generate a profile report in a binary file with suffix `.map`. |
246 |
| - |
247 |
| -To open this file we can open the Linaro Forge Client on our local machine, navigate to the `linaro MAP` tab, connect to the corresponding `Remote` and then select `LOAD PROFILE DATA FILE` to locate the file. |
248 |
| - |
249 |
| -After loading the report file we'll be in the home of Linaro MAP. |
250 |
| - |
251 |
| -<img src="https://raw.githubusercontent.com/iomaganaris/alps-uenv/refs/heads/linaro_map_docs_archive/docs/images/map-home.png" width="800" /> |
252 |
| - |
253 |
| -More information regarding how to use Linaro MAP can be found in the Forge [User Guide](https://docs.linaroforge.com/latest/html/forge/index.html). |
254 |
| - |
255 |
| -Linaro MAP also allows the generation of a high level Performance Report in HTML format that shows key metrics of the profiled application. To see this we can click in the toolbar `Reports > View HTML Performance Report in browser`. This will look like the following: |
256 |
| - |
257 |
| -<img src="https://raw.githubusercontent.com/iomaganaris/alps-uenv/refs/heads/linaro_map_docs_archive/docs/images/perf-report.png" width="800" /> |
258 |
| - |
259 |
| -## Troubleshooting |
260 |
| - |
261 |
| -Notes on using specific systems: |
262 |
| - |
263 |
| -=== "santis,todi" |
264 |
| - |
265 |
| - !!! warning |
266 |
| - |
267 |
| - Some clusters are not connected directly to the internet, hence some environment variables need to be set so that the tool can connect to the license server. |
268 |
| - |
269 |
| - ```bash |
270 |
| - export https_proxy=proxy.cscs.ch:8080 |
271 |
| - export http_proxy=proxy.cscs.ch:8080 |
272 |
| - export no_proxy=".local, .cscs.ch, localhost, 148.187.0.0/16, 10.0.0.0/8, 172.16.0.0/12" |
273 |
| - ``` |
274 |
| - |
275 |
| - ???- note "default value of `http_proxy`" |
276 |
| - |
277 |
| - By default the `https_proxy` and `http_proxy` variables are set to `http://proxy.cscs.ch:8080`, as the transport is required for some other services to work. You will have to set them for a debugging session. |
278 |
| - |
279 |
| - |
| 3 | +Documentation has been moved to the [CSCS Documentation](https://eth-cscs.github.io/cscs-docs/software/devtools/) |
0 commit comments