Editing CommunityData:Hyak Ikt (Deprecreated)
From CommunityData
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
To use Hyak, you must first have a UW NetID, access to Hyak, and a two factor authentication token. Details on getting set up with all three are available at [[CommunityData:Hyak setup]]. | To use Hyak, you must first have a UW NetID, access to Hyak, and a two factor authentication token. Details on getting set up with all three are available at [[CommunityData:Hyak setup]]. | ||
Line 7: | Line 5: | ||
* [http://students.washington.edu/hpcc/using-hyak/information-for-beginner-users/slides-from-training-sessions/ Slides from the UW HPC Club] | * [http://students.washington.edu/hpcc/using-hyak/information-for-beginner-users/slides-from-training-sessions/ Slides from the UW HPC Club] | ||
* [http://wiki.hyak.uw.edu Hyak User Documentation] | * [http://wiki.hyak.uw.edu Hyak User Documentation] | ||
== Setting up SSH == | == Setting up SSH == | ||
When you connect to SSH, it will ask you for a key from your token. Typing this in every time you start a connection be a pain. One approach is to create an .ssh config file that will create a "tunnel" the first time you connect and send all subsequent connections to Hyak over that tunnel. Some details [ | When you connect to SSH, it will ask you for a key from your token. Typing this in every time you start a connection be a pain. One approach is to create an .ssh config file that will create a "tunnel" the first time you connect and send all subsequent connections to Hyak over that tunnel. Some details [https://sig.washington.edu/itsigs/Logging_In#SSH_Config_File in the Hyak documentation]. | ||
I've added the following config to the file <code>~/.ssh/config</code> on my laptop (you will want to change the username): | I've added the following config to the file <code>~/.ssh/config</code> on my laptop (you will want to change the username): | ||
Host ikt | Host hyak ikt.uw.edu | ||
User makohill | User makohill | ||
HostName | HostName ikt2.hyak.uw.edu | ||
ControlPath ~/.ssh/master-%r@%h:%p | ControlPath ~/.ssh/master-%r@%h:%p | ||
ControlMaster auto | ControlMaster auto | ||
Line 40: | Line 36: | ||
It will prompt you for your UWNetID's password and your PRN which is the little number that comes from your token. | It will prompt you for your UWNetID's password and your PRN which is the little number that comes from your token. | ||
== Setting | == Setting Up Hyak == | ||
When setting up Hyak, you must first add | When setting up Hyak, you must first add this to your BASHRC file. Generally, you can simply edit the following file on Hyak: <code>~/.bashrc</code> | ||
## hyak | ## hyak specific options | ||
alias rgrep='grep -r' | |||
alias big_machine='qsub -W group_list=hyak-mako -l walltime=500:00:00,mem=200gb -I' | |||
alias any_machine='qsub -W group_list=hyak-mako -l walltime=500:00:00,mem=100gb -I' | |||
PYTHON_PATH="/com/local/lib/python3.5:$PYTHON_PATH" | |||
LD_LIBRARY_PATH="/com/local/lib:/com/local/lib64/R/lib:${LD_LIBRARY_PATH}" | |||
PKG_CONFIG_PATH=/com/local/lib/pkgconfig:/usr/share/pkgconfig | |||
MC_CORES=16 | |||
PATH="/com/local/bin:$PATH" | |||
module load parallel_sql | module load parallel_sql | ||
module load contrib/gcc_5.1.0-openmpi_1.10.1 | |||
umask 007 | umask 007 | ||
The final line is particularly important. If you do not do this, the files you create on Hyak will be able to be read or written by others in the group! | The final line is particularly important. If you do not do this, the files you create on Hyak will be able to be read or written by others in the group! | ||
Line 78: | Line 64: | ||
These lines will mean that if I have "checked out" an interactive machine, I can ssh from my computer to Hyak and then directly through an addition hop to the machine (like ssh n0652). Those ForwardX11 lines means if I graph things on this window, they will open on my local display. | These lines will mean that if I have "checked out" an interactive machine, I can ssh from my computer to Hyak and then directly through an addition hop to the machine (like ssh n0652). Those ForwardX11 lines means if I graph things on this window, they will open on my local display. | ||
== | == 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''' '''username'''@hyak.washington.edu | |||
You can also add the following line to the Hyak section on your local .ssh/config file on your laptop: | |||
LocalForward '''$PORT''' localhost:'''$PORT''' | |||
If you | 3. We're going to need to connect to one of the compute servers ''twice''. As a result, we'll use a program called <code>tmux</code>. Tmux is very similar (but a little easier to learn) than a program called <code>screen</code>. If you know screen, just use that. Otherwise, run tmux like: | ||
tmux | |||
You can tell you're in tmux because of the green line at the bottom of the screen. | |||
. | 4. "Check out" a compute node | ||
any_machine | |||
5. | |||
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''' | |||
== Set up a password for Jupyter Notebook on Hyak == | == Set up a password for Jupyter Notebook on Hyak == | ||
Line 98: | Line 119: | ||
== Running Jobs on Hyak == | == Running Jobs on Hyak == | ||
When you first log in to Hyak, you will be on a "login node". These are nodes that have access to the Internet, and can be used to update code, move files around, etc. They should not be used for computationally intensive tasks. To actually run jobs, there are a few different options, described in detail [https://sig.washington.edu/itsigs/Hyak_Job_Scheduler in the itSigs documentation]. Following are basic instructions for some common use cases. | When you first log in to Hyak, you will be on a "login node". These are nodes that have access to the Internet, and can be used to update code, move files around, etc. They should not be used for computationally intensive tasks. To actually run jobs, there are a few different options, described in detail [https://sig.washington.edu/itsigs/Hyak_Job_Scheduler in the itSigs documentation]. Following are basic instructions for some common use cases. | ||
Line 123: | Line 131: | ||
The basic workflow is: | The basic workflow is: | ||
1. Prepare the code, and test it with a single file (either on your computer, or on an interactive node). | 1. Prepare the code, and test it with a single file (either on your computer, or on an interactive node). | ||
2. Write a job_script file. This tells the node what job to run. There is an example on the Parallel SQL wiki page (linked above), and an example in the wikiresearch/hyak_example directory. | 2. Write a job_script file. This tells the node what job to run. There is an example on the Parallel SQL wiki page (linked above), and an example in the wikiresearch/hyak_example directory. | ||
3. Create a task_list file. This is a list of commands that should be run, with one line per file that the command should operate on. An example file might look something like: | 3. Create a task_list file. This is a list of commands that should be run, with one line per file that the command should operate on. An example file might look something like: | ||
Line 152: | Line 151: | ||
$ for job in $(seq 1 N); do qsub job_script; done | $ for job in $(seq 1 N); do qsub job_script; done | ||
# N is the number of nodes | # N is the number of nodes | ||
=== R Markdown === | === R Markdown === | ||
Line 178: | Line 158: | ||
$ Rscript -e "rmarkdown::render('analysis.Rmd')" | $ Rscript -e "rmarkdown::render('analysis.Rmd')" | ||
=== Killing jobs on compute nodes === | |||
Torque documentation suggests that you should do this with <tt>qdel</tt>. That might work, but apparently our system runs moab on top of torque and the recommended (by Hyak admins) way to kill a job is to use the <tt>mjobctl</tt> command. | |||
For example, you might run <tt>nodestate</tt> from a login node to figure out the ID number for your job (let's say it's 12345), then run <tt>mjobctl -c 12345</tt> to send a SIGTERM signal or <tt>mjobctl -F 12345</tt> to send a SIGKILL signal that will bring job 12345 to an end. | |||
Note that only four user accounts at a time can have the bits necessary to kill other people's jobs, so while you can do this on your own jobs, you'll need to bother the IRC channel to find help cancelling other's jobs (we think that Jeremy, Nate, Aaron, and Mako currently have the bits). Also, check out the [http://docs.adaptivecomputing.com/maui/commands/mjobctl.php documentation for mjobctl] for more info. | |||
== Working on Hyak from a local emacs client == | |||
Some of us (like Nate) rely heavily on the Emacs text editor. [http://ess.r-project.org/| 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 | |||
$ any_machine | |||
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. | |||
ess-remote |