Editing CommunityData:Klone
From CommunityData
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: | ||
'''Klone''' is the latest version of hyak, the UW super computing system. We will soon have a larger allocation of machines on Klone than on Mox. The Klone machines have 40 cores and either 384GB or 768GB of RAM | '''Klone''' is the latest version of hyak, the UW super computing system. We will soon have a larger allocation of machines on Klone than on Mox. The Klone machines have 40 cores and either 384GB or 768GB of RAM. | ||
== | == New Container Setup == | ||
We will use multiple different singularity containers for different applications to avoid incidentally breaking existing versions of packages during upgrades. We want to containers that include "soft dependencies" that R or Python libraries might want. | |||
We haven't built the containers yet, but let's start keeping track of dependencies that we'll need. | |||
=== R === | |||
* Node.js | |||
* graphviz | |||
=== Python === | |||
* spark | |||
== Setup == | |||
The recommended way to manage software for your research projects on Klone is to use [https://sylabs.io/docs/ Singularity containers]. You can build a singularity container using the linux distribution manager of your choice (i.e., debian, ubuntu, centos). The instructions on this page document how to build the <code>cdsc_base.sif</code> singularity package which provides python, R, julia, and pyspark based on Debian 11 (Bullseye). | |||
Copies of the definition file and a working container are located at <code>/gscratch/comdata/containers/cdsc_base/</code>. | |||
=== Initial .Bashrc === | === Initial .Bashrc === | ||
Before we get started using our | Before we get started using our singularity package on klone, we need to start with a <code>.bashrc</code>. | ||
<syntaxhighlight language='bash'> | <syntaxhighlight language='bash'> | ||
# .bashrc | # .bashrc | ||
# Stuff that's in there already that you need for working with the cluster. | |||
# Add the following two lines | |||
# | |||
umask 007 | umask 007 | ||
export | module load singularity | ||
export SINGULARITY_BIND="/gscratch:/gscratch,/mmfs1:/mmfs1,/xcatpost:/xcatpost,/gpfs:/gpfs,/sw:/sw" | |||
alias big_machine="srun -A comdata -p compute-bigmem --time=6:00:00 -c 40 --pty bash -l" | |||
alias huge_machine="srun -A comdata -p compute-hugemem --time=6:00:00 -c 40 --pty bash -l" | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== | == Installing singularity on your local computer == | ||
You might find it more convenient to develop your singularity container on your local machine. You'll want singularity version 3.4.2. which is the version installed on klone. Follow [https://sylabs.io/guides/3.5/admin-guide/installation.html these instructions] for installing singularity on your local linux machine. | |||
== Creating a singularity container == | |||
Our goal is to write a singularity definition file that will install the software that we want to work with. The definition file contains instructions for building a more reproducible environment. For example, the file <code>cdsc_base.def</code> contains instructions for installing an environment based on debian 11 (bullseye). Once we have the definition file, we just have to run: | |||
Our goal is to write a | |||
<syntaxhighlight language='bash'> | <syntaxhighlight language='bash'> | ||
singularity build --fakeroot cdsc_base.sif cdsc_base.def | |||
</syntaxhighlight> | </syntaxhighlight> | ||
On a klone compute node to create the | On a klone compute node to create the singularity container <code>cdsc_base.sif</code>. This can take quite awhile to run as it downloads and installs a lot of software! | ||
You can start a shell in the container using: | You can start a shell in the container using: | ||
<syntaxhighlight language='bash'> | <syntaxhighlight language='bash'> | ||
singularity shell cdsc_base.sif | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 127: | Line 55: | ||
<syntaxhighlight language='bash'> | <syntaxhighlight language='bash'> | ||
singularity exec cdsc_base.sif echo "my command" | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 135: | Line 63: | ||
<syntaxhighlight language='bash'> | <syntaxhighlight language='bash'> | ||
singularity build --sandbox cdsc_base_sandbox cdsc_base.sif | |||
</syntaxhighlight> | </syntaxhighlight> | ||
You might run into trouble with exceeding space in your temporary file path. If you do, run | You might run into trouble with exceeding space in your temporary file path. If you do, run | ||
<syntaxhighlight language='bash'> | <syntaxhighlight language='bash'> | ||
sudo export | sudo export SINGULARITY_TMPDIR=/my/large/tmp | ||
sudo export | sudo export SINGULARITY_CACHEDIR=/my/large/apt_cache | ||
sudo export | sudo export SINGULARITY_LOCALCACHEDIR=/my/large/apt_cache | ||
</syntaxhighlight> | </syntaxhighlight> | ||
before running the build. | before running the build. | ||
Line 160: | Line 88: | ||
== Spark == | == Spark == | ||
To set up a spark cluster using | To set up a spark cluster using singularity the first step to "run" the container on each node in the cluster: | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
# on the first node | # on the first node | ||
singularity instance start --fakeroot cdsc_base.sif spark-boss | |||
export SPARK_BOSS=$(hostname) | export SPARK_BOSS=$(hostname) | ||
# on the first worker node (typically same as boss node) | # on the first worker node (typically same as boss node) | ||
singularity instance start --fakeroot cdsc_base.sif spark-worker-1 | |||
# second worker node | # second worker node | ||
singularity instance start --fakeroot cdsc_base.sif spark-worker-2 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 175: | Line 103: | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
singularity exec instance://spark-boss /opt/spark/sbin/start_master.sh | |||
singularity exec instance://spark-worker-1 /opt/spark/sbin/start-worker.sh $SPARK_BOSS:7077 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 186: | Line 114: | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
# replace n3078 with the master hostname | # replace n3078 with the master hostname | ||
singularity exec instance://spark-boss /opt/spark/bin/spark --master spark://n3078.hyak.local:7077 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Nate's working on wrapping the above nonsense in friendlier scripts. | Nate's working on wrapping the above nonsense in friendlier scripts. | ||
== cdsc_base.def == | |||
<syntaxhighlight language='bash'> | |||
Bootstrap: library | |||
from: debian:bullseye | |||
%post | |||
echo "deb http://mirror.keystealth.org/debian bullseye main contrib" > "/etc/apt/sources.list" | |||
apt update && apt upgrade -y | |||
apt install -y gnupg curl | |||
curl -O https://downloads.apache.org/spark/KEYS | |||
curl -O https://downloads.apache.org/spark/spark-3.1.1/spark-3.1.1-bin-hadoop3.2.tgz.asc | |||
curl -O https://mirror.jframeworks.com/apache/spark/spark-3.1.1/spark-3.1.1-bin-hadoop3.2.tgz | |||
gpg --import KEYS | |||
ls | |||
gpg --verify spark-3.1.1-bin-hadoop3.2.tgz.asc spark-3.1.1-bin-hadoop3.2.tgz | |||
rm KEYS | |||
export JAVA_HOME=/usr/lib/jvm/default-java | |||
tar xvf spark-3.1.1-bin-hadoop3.2.tgz | |||
mv spark-3.1.1-bin-hadoop3.2/ /opt/spark | |||
curl -O https://mirror.jframeworks.com/apache/hadoop/common/hadoop-3.3.0/hadoop-3.3.0.tar.gz | |||
curl -O https://downloads.apache.org/hadoop/common/hadoop-3.3.0/hadoop-3.3.0.tar.gz.asc | |||
curl -O https://downloads.apache.org/hadoop/common/KEYS | |||
gpg --import KEYS | |||
ls | |||
gpg --verify hadoop-3.3.0.tar.gz.asc hadoop-3.3.0.tar.gz | |||
tar xvf hadoop-3.3.0.tar.gz | |||
mv hadoop-3.3.0/ /opt/hadoop | |||
export HADOOP_HOME=/opt/hadoop | |||
apt install -y libopenblas-base | |||
apt install -y r-base r-recommended emacs vim python3-sklearn jupyter moreutils julia default-jdk git curl meld xauth python3-venv python3-pip apt-utils ncdu | |||
apt clean | |||
mkdir mmfs1 | |||
mkdir gscratch | |||
mkdir xcatpost | |||
mkdir gpfs | |||
mkdir sw | |||
rm hadoop-3.3.0.tar.gz hadoop-3.3.0.tar.gz.asc KEYS spark-3.1.1-bin-hadoop3.2.tgz spark-3.1.1-bin-hadoop3.2.tgz.asc | |||
%environment | |||
export JAVA_HOME=/usr/lib/jvm/default-java | |||
export HADOOP_HOME=/opt/hadoop | |||
export LC_ALL=C | |||
export SPARK_HOME=/opt/spark | |||
export PATH=$PATH:$SPARK_HOME/bin:$SPARK_HOME/sbin | |||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HADOOP_HOME/lib/native | |||
</syntaxhighlight> |