(upbeat music)
- Hi, my name is Mike Kiernan.
I'm a high-performance computing architect
for Microsoft Azure.
I'm gonna talk to you today about Azure Batch,
and how to run containers
for high-performance computing on Batch.
Okay, so what is Azure Batch?
Azure Batch is a Platform as a Service on Azure,
that lets you run basically anything you like at scale.
So I work in my day-to-day job
with customers running risk simulations,
Monte Carlo simulations in the media industry
for transcoding and rendering.
We work with a lot of scientists
in genomics, deep learning, cryptography,
solving mathematical problems at scale,
using it as a workhorse for data science problems,
and also things like compiled MATLABs.
So we work with a lot of racing companies
that are doing compiled MATLAB
running on Batch at scale,
doing live trackside simulations
while they're in a race
running 200,000 simulated races,
in order to make real-time decisions by the track.
So it's a very versatile platform.
We can run anything you'd like on Linux:
Windows standard apps,
tens of thousands of cores,
hundreds of thousands of cores,
potentially millions of cores as well.
So any problem, at any scale.
The demo we're gonna do today is based on
this piece of code that you can see on the screen,
you can find it on GitHub.
It's called AZFINSIM.
So it's a financial simulation calc engine.
It's just a bit of Python,
just to give you a bit of code to play with.
So you can find that on GitHub along with the documentation
that allow you to reproduce everything
that we're gonna show you today.
Just a quick overview of the architecture
that we're gonna be using to do the demonstration.
So what we're gonna be doing is a build-deploy-run.
So we've got the calc engine,
we're gonna package that up,
into a Docker container.
We're gonna push that into Azure container registry.
We're then gonna stand up a pool on Azure Batch.
So a pool is basically a group of computers.
That can be any type of compute you like,
CPU, GPU, large memory, many-core,
whatever type of compute you need to solve the problem.
You could stand it up one node.
You can stand up as many nodes
as you like in a pool compute.
We're then gonna submit a job
into the pool that's gonna pull the Docker container,
insert that onto all the cores in the pool,
and we're then gonna execute a job
on every single node in that pool.
So as the computation starts,
we're gonna pull data
into the compute node from the Redis cache.
We're gonna run a real-time computation,
and then we're gonna push that back out into the cache.
And every core in the pool
is gonna execute a similar task
on a different piece of data,
on a different trade in particular.
All that's gonna be doing is collecting telemetry
as it's simulation's gonna be running.
So we're gonna be pushing all kinds
of statistics, CPU, Redis latencies,
whatever you like,
whatever you wanna collect.
We've got that embedded into the Python code
that's part of the application in the container,
gonna push that into the Azure Monitor platform,
or we're gonna gather up all this data
and statistics that we wanna know
about what's happening
in our batch pool in real time.
So I'm just gonna drop to my desktop now,
and we're gonna run the demo.
So to run the demo,
we're gonna be using this tool called BatchExplorer.
You can find that on GitHub.
Also need a bit of code,
which you can also find on the GitHub link
that I showed earlier.
We'll start off with a Dockerfile.
So the Dockerfile basically contains,
everything we need to deploy our code on the batch pool.
So we're gonna run an Ubuntu container,
in this case Ubuntu 18,
gonna install dependencies that we need,
create Python environment in order to run my calc engine,
and then I'm gonna copy the files.
So all those files that you see on the left-hand side,
the FINSIM files,
they're all gonna get copied into the Docker image.
We've only got a build script,
which we're gonna execute here.
That's gonna create an image,
We're gonna upload that to the container registry
using the credential that you can see here.
And we're then gonna push that out
to the container registry.
And we're going to test it locally,
on the node before we deploy it.
So in order to do that,
I'm just gonna start up a terminal.
It drops me where I need to be,
and we're just gonna execute that build.
So that's gonna kick off that build,
everything is automated end to end.
I could even put that in Azure Pipeline,
don't necessarily need to run that manually.
I'm gonna split my screen here.
While it's building and pushing,
I'm gonna start up the actual batch pool.
So to find what I want that pool to look like,
what type of compute I want to deploy in my Python code.
And I've also defined the same container name,
that we're building on the left-hand side here,
that I'm gonna pull into every node on the pool.
So as we've deployed that,
we can go back to the BatchExplorer UI.
You can see the pool should be created over here,
and it is; you can see FinSimPool001,
and it's growing from zero to 300 nodes.
We can go in and have a look at the configuration,
just make sure that's in line with the code
that we've deployed.
So we go and look into the virtual machine configuration,
we could see, yes, indeed.
So my container, exactly the one that I'm pushing up,
is the one that we're requesting,
so once it has been pushed up and deployed,
that'll come into every node in this batch pool.
So we're just gonna give that a few seconds,
and that pool will be online.
Alright, so the pool is now almost ready.
You can see there's a few nodes outstanding,
but it doesn't really matter.
We don't need to wait for them all to start the compute.
And what we're gonna do is just connect to one of the nodes
just so you can see what this looks like.
So, BatchExplorer generates some credentials
for us automatically.
We can just log right in.
There we go, and we're in.
So see the Docker image list,
and we can see our containers there,
exactly as we specified.
So we're ready to do some compute.
So what I'm gonna do is just bring up another terminal here.
We've got a job that we've got ready.
And what this is gonna do
is submit another piece of Python on the client side,
talk to the API.
It's gonna start at trade zero,
run through trade 6,000.
We've got 1200 tests,
one per call.
And we're gonna deploy that across the pool.
Then we kick that off.
You can see it's firing all those individual
tasks into the API.
They're all getting farmed out to the nodes
that you can see on the screen.
Once it inserts them, you can see everything goes green
when I do compute.
If we drop back down to the node we were on before,
we can run the top commands,
we can see
four Azure Batch tasks running,
CPUs getting busier,
and we're running some compute.
So everything's functioning as we want it.
So we're reading and writing from the Redis cache.
We can go and look at the job,
live streaming the information coming out of every task.
So we can pick one of these at random again,
since you can test number one.
Now we can see the output.
We can see we're doing the calc.
We're reading from Redis.
We're registering the latency to do the reads,
to get the trade, pick up the trade;
we're running about eight to nine seconds
to do the calculation for one trade,
and we're processing around five per CPU.
And this one's just finished in 45 seconds.
Go back, look at the job.
You can get a global view of what's happening.
We can see almost 1200 have succeeded.
We can go and look at the stats,
then we can see the response time.
So we can see they're all finished.
They're all gathered pretty evenly,
between 50 and 60 seconds,
so we can see that that's pretty much the result
we were looking for.
And we go back to the pool,
we can see the queue is drained.
There's no more work.
If I wanna reuse the pool,
I can just simply fire in more work.
So just fire in another 1200 tasks,
another 1200. And what's gonna happen
is that work's just gonna back up in the queue
just as it would
on a normal HPC cluster running a scheduler.
And then as soon as the nodes and the pool are free,
we start up the work again.
So, very easy;
whatever problem you're trying to solve,
you've got the Python example that we have on GitHub,
so you can insert your code,
your package, your container,
however you wanna do it.
And you can reproduce exactly
what we're showing on the screen here.
We're also collecting the telemetry
out of that job.
We can create a dashboard like you'd see on the screen here.
We can also pull real-time telemetry.
We recommend Grafana for that.
So you can stand up a Grafana node or a container.
Also recommend you have a look at Batch Shipyard.
So that's a Python-based implementation
of front end for Batch.
And that's got lots of automation
around deploying things like Grafana
that should make it really easy for you to get started.
Alright, that's all I have.
Thank you very much for your time.
Appreciate you watching.
If you have any questions about what you've seen,
please reach out to us through Azure.com,
or if you have any problems
with reproducing the demonstration,
please reach out to me through the GitHub
and I'll be happy to oblige.
(upbeat music)