Run your first job
In this tutorial, follow along to run a program over OpenMPI in a few lines of Python.
Set up
This tutorial runs on Camber infrastructure, and a corresponding notebook is in the demos
folder of your Jupyter hub.
The easiest way to run this code is to log into Camber and try it out:
From your Camber account, click Jupyter Hub to access your Jupyter environment.
In the left-hand menu, note the
demos
folder. It contains subfolders for each demo. For this tutorial, head intodemos > 10-get-started > 10-run-your-first-job
.
This folder has three files. Open mpi_hello_world.ipynb
and start running commands in the notebook.
- makefile
- mpi_hello_world.c
- mpi_hello_world.ipynb
If you prefer to just read, here’s the full notebook.
Run “Hello, world!” on MPI
This notebook demostrates how to run a simple MPI job on Camber.
- Use
make
to build a “Hello, world!” C program. - Run the program over MPI.
First, import camber
. This instantiates a set of tools to run different types of workloads on Camber Cloud.
import camber
The create_job
function creates a process on Camber infrastructure.
This function takes at a minimum a command
and engine_size
as arguments. To compile the C program in the cloud, pass command="make"
and engine_size="XXSMALL"
.
{{< callout type=“info” >}}
The engine_size
specifies the amount of computational power to allocate to the job. Each step up in engine size doubles the allocated compute capacity.
{{< /callout >}}
make = camber.mpi.create_job(
command="make",
engine_size="XXSMALL"
)
make.status
When the make job is finished, a binary named mpi_hello_world
is created in the same directory. This is a compiled C program that prints Hello world
from each process.
Run it with MPI with 4 cores and 4 MPI processes:
run = camber.mpi.create_job(
command="mpirun -np 4 mpi_hello_world",
engine_size="XXSMALL"
)
run.status
run.read_logs()
Congratulations! You’ve just run your first MPI job on Camber Cloud!