Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
About
People
Publications
Teaching
Resources
Research Blog
Wiki Functions
Recent changes
Help
Licensing
Project page
Discussion
Edit
View history
Editing
CommunityData:Hyak Ikt (Deprecreated)
(section)
From CommunityData
Jump to:
navigation
,
search
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.
Anti-spam check. Do
not
fill this in!
== Running Jobs on Hyak == {{notice|This material is now out of date! It refers to the old version of the Hyak scheduler.}} <div style="width: 300px; float: right; border: 1px solid black; background: #DDD; padding: 0.5em;"> '''Screencast Examples (Sep, 2019):''' * Using parallel and batch jobs on ikt: [https://communitydata.cc/~mako/hyak_example_day2-20190906.ogv Video] '''Screencast Examples (Feb, 2018, pre-SLURM):''' * Interactive job (ikt): [https://communitydata.cc/~mako/hyak_example_interactive_job-20180215-part_1.ogv Part 1], [https://communitydata.cc/~mako/hyak_example_interactive_job-20180215-part_2.ogv Part 2] * Batch Job (ikt): [https://communitydata.cc/~mako/hyak_example_batch_job-20180517.ogv Video] </div> 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. === Interactive nodes === For simple tasks, e.g. running R on a dataset, testing that code is working, etc. it is easiest to run it in an interactive node. This is a compute node that you interact with through the terminal. All of your disk storage is accessible just as though you were on the login node. === Parallel SQL === For big jobs you will want to use multiple nodes. Hyak has a very cool tool that makes this very easy, called Parallel SQL. Detailed instructions are in [https://sig.washington.edu/itsigs/Hyak_parallel-sql the itsigs parallel-sql documentation]. There is also a [[CommunityData:Hyak walkthrough|full walkthrough example with instructions]]. The basic workflow is: 0. Be empowered to run parallel_sql -- the first time you use parallel_sql, you will need to: login$ module load parallel_sql login$ sudo pssu --initial [sudo] password for USERID: <Enter your UW NetID password> See more information at: [[https://wiki.cac.washington.edu/display/hyakusers/Hyak+parallel-sql]]. If you're not initialized, it'll say "Cannot read database config file '/usr/lusers/<<your username>>/.parallel/db.conf': No such file or directory' when you try. 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. 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: python analysis_script.py -i ./input/wiki_1.tsv -o ./output/wiki_1_analysis.tsv python analysis_script.py -i ./input/wiki_2.tsv -o ./output/wiki_2_analysis.tsv ... The README in the hyak_example directory has some example bash commands that you might use to generate this file. 4. Load the task_list into Parallel SQL. $ module load parallel_sql $ cat task_list | psu --load 5. Run the job_script on as many nodes as you need. When each task is finished, the node will get the next task from Parallel SQL. $ for job in $(seq 1 N); do qsub job_script; done # N is the number of nodes You can also use the -t flag, which makes jobs using multiple nodes easier to kill, but is not recommended by "the HYAK people". $ qsub job_script -t 0-N # N is the number of nodes For producing your task_list file, you might find it useful to make a python script that slurps up a list of files from a dir and then inserts those filenames into a command file to be run repeatedly: #!/usr/bin/env python3 import glob outfile = "many_Redir_Runs.txt" infileDir = "/com/raw_data/complete_wmf_dumps-20180220/enwiki-20180301/" fileList = glob.glob(infileDir + "enwiki-20180301-pages-meta-history*.7z") #get all the 7z metahistory files with open(outfile, 'w') as outFileHandle: for file in fileList: cleanFile = file.split("/")[-1] commandString = "7za x -so " + file + "| python ./01-extract_redirects.py > output/redir/" + cleanFile + ".tsv \n" outFileHandle.write(commandString) === R Markdown === [http://rmarkdown.rstudio.com/ R markdown] is a useful way of writing up your analysis as a mix of explanatory text and code. You can, for example, create fancy Tufte-style [https://rstudio.github.io/tufte/ handouts] with code and explanatory text in the [https://raw.githubusercontent.com/rstudio/tufte/master/inst/rmarkdown/templates/tufte_html/skeleton/skeleton.Rmd same file]! In order to use R markdown, in a compute node, run the following command $ Rscript -e "rmarkdown::render('analysis.Rmd')" === Python Virtual Environments === Python virtual environments are a great way to manage project dependencies, and they seem to work on HYAK in the same way that they do on local machines. First install virtualenv using pip (this only needs to be done once). $ pip install virtualenv --user Initialize a new virtual environment in the current directory. Many people create a new virtual environment for each project. $ # this virtual environment will use python 3 $ virtualenv venv -p python3 To activate the virtual environment from a login node or an interactive compute node $ source <path_to_venv_parent_dir>/venv/bin/activate To load a virtual environment in parallel sql, add the following to your PBS bash script source <path_to_venv_parent_dir>/venv/bin/activate === 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.
Summary:
Please note that all contributions to CommunityData are considered to be released under the Attribution-Share Alike 3.0 Unported (see
CommunityData:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:
Cancel
Editing help
(opens in new window)
Tools
What links here
Related changes
Special pages
Page information