Jupyter Notebook on Hyak
1. Choose a number you are going to use as a port. We should each use a different port and the number should be between 1000 and 65000. It doesn't matter what it is but it needs to be unique. Pick something unique. In the following instructions, replace $PORT with your number below.
2. Connect to Hyak and forward the the port from you local machine to the new one:
ssh -L localhost:$PORT:localhost:$PORT firstname.lastname@example.org
You can also add the following line to the Hyak section on your local .ssh/config file on your laptop:
LocalForward $PORT localhost:$PORT
3. We're going to need to connect to one of the compute servers twice. As a result, we'll use a program called
tmux. Tmux is very similar (but a little easier to learn) than a program called
screen. If you know screen, just use that. Otherwise, run tmux like:
You can tell you're in tmux because of the green line at the bottom of the screen.
4. "Check out" a compute node
Keep track of which machine you are on. It should be something like n0650 and it should be displayed on the prompt. We'll refer to it as $HOST below.
6. Start jupyter on the compute node:
jupyter-notebook --no-browser --port=$PORT
You'll see that jupyter just keeps running in the background. This can be useful because when there are errors, they will sometimes be displayed in this terminal. Generally, you can just ignore this though.
6. Create a new window in tmux/screen
At this point, you have jupyter running on the compute node on $PORT. You also will have forwarded the port from your laptop to the login node. We're really only missing one thing which is the tunnel from the login node to the compute node within hyak. To do this, we'll create a new window inside tmux with the keystroke Ctrl-b c.
If you're not familiar with it, you'll want to read the CommunityData:tmux which includes a quick cheatsheet. To switch back to the original window running jupyter, you should type: Ctrl-b 0. If you switch though, be sure to switch back to the new window with Ctrl-b 1.
Because you originally ran tmux on the login node, the new window/terminal will be opened within tmux on the login node.
7. Open a tunnel from the login node to the compute node.
ssh -L localhost:$PORT:localhost:$PORT $HOST
8. In your local browser, localhost:$PORT
Working on Hyak from a local emacs client
Some of us (like Nate) rely heavily on the Emacs text editor. Emacs speaks statistics is a powerful emacs mode for programming in R and doing data analysis. There are a few options for using Emacs on hyak. If you open emacs on an interactive node with X-forwarding enabled then you will get a nice graphical emacs window and plots you make will be displayed on your screen. But if you disconnect from Hyak you will lose your R session. This makes running emacs the normal way on an interactive node unsuitable for fitting models. Another disadvantage is that your will be working with an x-forwarded emacs and so will not look as nice or be as responsive as your local emacs.
Alternatively, you might run emacs in console mode in tmux. Then Hyak will keep running your R process even when you log out. The downsides here is that you can't view plots on your display (you could save them as a pdf, and then open the pdf on your local machine) and that some emacs key chords will collide with tmux key bindings and configuring tmux to fix this is a pain.
A better way is to run emacs server on a compute node on hyak and then open a local emacs client that connects to that server.
Instructions For ESS
Unfortunately, this requires running emacsserver on a login node and viewing plots does not work. These problems should go away if hyak let us forward X from a compute node and tunnel it through a login node. This doesn't seem to work as ssh -X n0649 doesn't seem to forward X.
1. Open tmux on a login node and start emacsserver.
$ tmux $ emacs --daemon
2. Still in tmux, start an interactive session
3. In a new terminal (not tmux) ssh into the login node and start an emacs client (-c means in a new window).
$ emacsclient -c
4. In this emacsclient open a shell, ssh to the compute node, and start an R process.
M-x shell $ ssh n0649
5. With focus on the R process buffer in emacs, connect ESS to the R process.