drkostas / data-science-methods Goto Github PK
View Code? Open in Web Editor NEWA playground repo for the DSE-512 course
License: MIT License
A playground repo for the DSE-512 course
License: MIT License
Let’s write a data-parallel convolutional net to train on the MNIST dataset. Our goal
is to see how data-parallel training affects two things: our model’s accuracy, and its
runtime. Due to some limitations on Isaac, we are going to train this model using a
single node, but we will increase the number of processes per node to see how things
scale. Use the number of processes p ∈ {1, 2, 4, 8} and train the model for 30 epochs
each time. We want to keep track of two things:
a. Our training accuracy at every epoch
b. The total time it takes the model to train
Note: I recommend saving your training accuracy at every epoch as a numpy
array. You should have a numpy array for each run where p number of processes
were used. In the next step, we will plot these accuracy curves for each of the runs
to compare how our model accuracy changes as we vary the number of processors
(and the effective batch size as a result).
Steps:
.pbs
script and run it on ISAAC
(0 points) Setup
We will be downloading containers, which will exhaust your home directory disk
quota. So first, create a new cache directory for singularity, and export the following environment
variable in your shell session.
export SINGULARITY_CACHEDIR=/lustre/haven/proj/UTK0150/$USER/singularity_cache
mkdir $SINGULARITY_CACHEDIR
Now, within this terminal any singularity commands will use the given directory to store the large image files
we will download, and you should not run out of disk space.
(25 points) Run kmeans_vectorized.py in the container
Now, use the skills you developed in the first few problems to run your kmeans_vectorized.py script from previous assignments. Verify that the output matches what we saw in Assignment 01.
(25 points) Ephemeral containers
We will launch a shell in an “ephemeral container” that is downloaded on demand and deleted when we are done. This is useful when trying out an image whenyou are unsure whether you will use it long-term or not. First, from an ISAAC login node, run the
following commands and note the output:
grep PRETTY_NAME /etc/os-release
ls /
Next, Run the following command do drop into an ephemeral singularity container. This may take a few
minutes.
singularity shell docker://dceoy/pydata:dnn-cpu
Re-run the first to commands from inside this shell and note the differences. You are inside a container which
has applied an overlay to the true filesystem. Press Ctrl-d to exit
(25 points) Bind mounting directories
By default, singularity containers mount /home/$USER
, /tmp
, and $PWD
, meaning you can see them inside your container. Let’s also mount your user home directory and print its contents from within the container. If you named your user directory something other than your username, you will need to make that edit to this command.
singularity exec --bind /lustre/haven/proj/UTK0150/$USER:/myproj pydatacpu.sif ls -l /myproj
After training the model for 30 epochs for each of the p number of ranks in the problem
one, let’s compare both our models’ accuracy and their total runtime for each run.
Create two plots:
a. A line plot showing the epoch accuracy for each of the runs
b. A second line plot that shows the total runtime by the number of processes used
What is the effect of training time as we increase the number of processes available?
How does this line up with your expectations of the scalability laws that we discussed?
Which scalability law is most applicable in this case? How is our model accuracy
affected by the increase in the number of processes running? Present your figures and
answers to these questions in either a short document or a Jupyter notebook in your
repository.
(25 points) Pulling containers
Containers can also be persisted to disk by “pulling”. Run the following command to pull the docker image into a singularity image file, and verify that you can shell into it.
singularity build pydatacpu.sif docker://dceoy/pydata:dnn-cpu
More exercises (0 points)
There you have it. A singularity container that has pandas, numpy, and other machine learning packages already installed, without having to manage a conda environment. Note that mpi4py is missing, and if you’d like to install it, you would need to extend this container. However, it is difficult to do so, since you must build new containers on another computer that you have root access on, like an Ubuntu virtual machine. That is not part of this assignment, but is the next step in understanding and
using Singularity, so if you are looking for more to learn, try modifying this container on a local machine (using the singularity bootstrap command and editing a Singularity file), then copying it back onto ISAAC to verify that it ran.
For this assignment, you will extend the code we created in class, located at /lustre/haven/proj/UTK0150/jhinkl13/kmeans
.
The submission you return to us should be a brief report formatted in HTML, DOCX, or PDF.
For the report that you submit, you do not need to overly format it; you can simply list your responses
to each of the problems below.
Please do the following using number of clusters -k 4, using the TCGA dataset:
compute_distances()
,expectation_step()
, maximization_step()
, called at the appropriate places inside the kmeans()
kmeans.py
and report the time spent in each of thekmeans_vectorized.py
. Recall that kmeans_vectorized.py
attempted to speed up thecompute_distances()
portion. Use Amdahl’s Law to compute the theoretical maximum speedupcompute_distances()
. What percentage of that speedupkmeans.py
. You may use Snake- Vis
or Viztracer
along with cprofiler, as Todd demonstrated in Lecture 15. Do the same forkmeans_vectorized.py
. You may include these as screenshots in your report; please rescale the figuresexpectation_step()
and maximization_step()
(note that you may needYour assignment will not be graded unless you submit it here on Canvas; no exceptions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.