-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrobs_computing_tips.tex
More file actions
51 lines (36 loc) · 1.56 KB
/
robs_computing_tips.tex
File metadata and controls
51 lines (36 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
\section{Rob's Computing Tipz}
In this section, I'm just a ghostwriter for Rob Knop.
\subsection{emacs}
To get a GUI window in NERSC/Perlmutter that connects to your system clipboard:
\begin{minted}[
bgcolor=lightgray,
frame=leftline,
framesep=-3mm]
{bash}
ssh -X <username>@saul.nersc.gov
emacs &
\end{minted}
\subsection{\texttt{pdb} with \texttt{multiprocessing}}
\begin{itemize}
\item \texttt{pip install remote-pdb}
\item Make sure system has \texttt{socat} and \texttt{rlwrap}
\item Add the breakpoint where you want it in the code:
\end{itemize}
\begin{minted}[
bgcolor=lightgray,
frame=leftline,
framesep=-3mm]
{python}
import remote_pdb;
remote_pdb.RemotePdb('127.0.0.1', 4444).set_trace()
\end{minted}
Run the code. Wait for the logs to tell you that you've reached the breakpoint. If you have multiple processes that hit this at the same time, they will yell at you about all trying to open the same port. You can play games like trying to open different ports in each process, or you can try to set it up so that there's only one subprocess running. In another shell, when you see in the logs you've reached the breakpoint:
\begin{minted}[
bgcolor=lightgray,
frame=leftline,
framesep=-3mm]
{bash}
rlwrap -H ./socat.history socat - tcp:127.0.0.1:4444
\end{minted}
Note that this will create a file \texttt{socat.history} in your local directory. Make sure not to accidentally git add that, as it's gratuitous.
On a cluster, make sure you are on the same node in your two terminals.