This file provides a complete, step-by-step walk-through for how to parse a list of Wikia wikis with wikiq. The same principles can be followed for other tasks.
Things you should know before you start
[edit]- Computing paradigms: HPC versus MapReduce/Hadoop
Connecting to Hyak
[edit]Details information on setting up Hyak is covered CommunityData:Hyak. Make sure you have:
- Set up SSH
- Connected to Hyak
- Set up your user's Hyak environment with the CDSC aliases and tools
Interactive Jobs
[edit]Getting familiar with the SLURM scheduler on Klone:
- Check out UW-IT's Hyak documentation
- For reference, the system that UW uses is called Slurm and you can find lots of other information on it online.
- Some useful commands are:
ouralloc— current CDSC utilization across our partitionsourjobs— all running jobs by group membersmyjobs— your currently running jobshyakalloc— general information on allocations in Hyak
Running interactive jobs is relatively straight forward:
- Run screen or tmux to maintain connections over time (CDSC tmux cheatsheet)
- Check out a node using one of the CDSC aliases (all default to a 48-hour reservation; see CommunityData:Hyak#Basic Commands for the complete list and details):
any_machine— 2 cores / 16G, just to get off the login nodetest_machine— 8 cores / 64G, room to debug somethingbig_machine— 64 cores / 500G, for real workmem_machine— 32 cores / 490G on the memory-dense cpu-g2-mem2x partitionckpt_machine— 64 cores / 500G on the free-but-preemptible checkpoint queuefull_machine— 128 cores / 994G, the entire CDSC cpu-g2 pool (checkourallocand give a heads up on#communitydata-itfirst!)
Solving common node woes
[edit]It looks like there are no nodes available?
[edit]Our allocation is a shared pool, so if one person has checked out something big, the rest of the group can be squeezed until they exit.
- Run
ourallocto see current utilization. If cpu-g2 is full but cpu-g2-mem2x has room (or vice versa),any_machineandtest_machinewill automatically pick the partition with space. - Try a smaller checkout. If you don't need the full
big_machine,test_machineor a custom size (with--cores/--memorypassed tocheckout_machine) may fit. - Try a shorter lease. The aliases default to 48 hours; if your job is short, pass
--time=4:00:00(or similar) tocheckout_machineso the scheduler has more slots to work with. - Consider
ckpt_machine. The checkpoint queue is free and typically has thousands of idle cores available, at the cost of being preemptible. - Check
ourjobsto see who is using what, and ask on Matrix (#communitydata-it) if someone can free up a node.
My job is running out of memory
[edit]The default sizes for the aliases are shown in the list above. If you need more memory per core than the ~8G/core available on cpu-g2, use mem_machine (roughly 15G/core on cpu-g2-mem2x). For a custom size, pass --memory to checkout_machine.
My job is running out of time and I'd like to add more
[edit][Forthcoming]
Running a job across many cores using GNU R's parallelization features
[edit]A full cpu-g2 node on Klone has 128 cores; cpu-g2-mem2x has 32. Running your program on all the cores can speed things up a lot. We make heavy use of R for building datasets and for fitting models. Like most programming languages, R uses only one cpu by default. However, for typical computation-heavy data science tasks it is pretty easy to make R use all the cores.
For fitting models, the R installed should use all cores automatically. This is thanks to OpenBlas, which is a numerical library that implements and parallelizes linear algebra routines like matrix factorization, matrix inversion, and other operations that bottleneck model fitting.
However, for building datasets, you need to do a little extra work. One common strategy is to break up the data into independent chunks (for example, when building wikia datasets there is one input file for each wiki) and then use mcapply from library(parallel) to build variables from each chunk. Here is an example:
library(parallel)
options(mc.cores=detectCores()) ## tell R to use all the cores
mcaffinity(1:detectCores()) ## required and explained below
library(data.table) ## for rbindlist, which concatenates a list of data.tables into a single data.table
## imagine defining a list of wikis to analyze
## and a function to build variables for each wiki
source("wikilist_and_buildvars")
dataset <- rbindlist(mclapply(wikilist,buildvars))
mcaffinity(rep(1,detectCores())) ## return processor affinities to the status preferred by OpenBlas
A working example can be found in the Message Walls git repository.
mcaffinity(1:detectCores()) is required for the R library(parallel) to use multiple cores. The reason is technical and has to do with OpenBlas. Essentially, OpenBlas changes settings that govern how R assigns processes to cores. OpenBlas wants all processes assigned to the same core, so that the other cores do not interfere with it's fancy multicore linear algebra. However, when building datasets, the linear algebra is not typically the bottleneck. The bottleneck is instead operations like sorting and merging that OpenBlas does not parallelize.
The important thing to know is that if you want to use mclapply, you need to do mcaffinity(1:detectCores()). If you want to then fit models you should do mcaffinity(rep(1,detectCores()) so that OpenBlas can do its magic.
Running jobs across many cores with GNU parallel
[edit]Generate a task list:
$ find ./input/ -mindepth 1 | xargs -I {} echo "python3 /com/local/bin/wikiq {} -o ./output" > task_list
Run:
$ parallel < task_list
Connect to your node with ssh to check on it:
$ ssh n0648 $ htop
Batch Jobs
[edit]This section previously walked through the PBS/Torque + Parallel SQL batch workflow on the retired mox system. Klone runs SLURM instead, and neither qsub, parallel_sql, nor showq is available. A refreshed walkthrough covering sbatch and SLURM job arrays is TODO. In the meantime, see CommunityData:Hyak_example_job_script and the SLURM documentation for how to submit batch jobs.
|
