= mpi !
Apostolos rootApostolos@swarmlab.io
// Metadata:
:description: Intro and Install
:keywords: mpi
:data-uri:
:toc: right
:toc-title: Πίνακας περιεχομένων
:toclevels: 4
:source-highlighter: highlight
:icons: font
:sectnums: 

{empty} +


[[cheat-Docker]]
== Install mpi (Home PC)

- Install docker + 
http://docs.vlabs.uniwa.gr/Howtos/docker/install.adoc.html[^]

- Clone repo https://git.vlabs.uniwa.gr:3000/swarmlab/swarmlab-mpi + 
HowTo: See http://docs.vlabs.uniwa.gr/Howtos/git/use-git.adoc.html 

.lab
[NOTE]
====
In Uniwa Lab's everything is ready!
Goto  "create"
====

[[cheat-swarmlab-mpi]]
== Usage  (swarmlab-mpi)


- Open a console

- Create a directory

```
cd dir
swarmlab-mpi <tab><tab>

create       create project      (swarmlab-mpi create)
up           start swarmlab-mpi  (swarmlab-mpi up size=10)
scale        resize swarmlab-mpi (swarmlab-mpi scale size=30)
reload       rebuild image       (swarmlab-mpi reload size=15)
login        login swarmlab-mpi  (swarmlab-mpi login)
exec         execute command     (swarmlab-mpi exec [SHELL COMMAND])
down         stop swarmlab-mpi   (swarmlab-mpi down)
clean        clean project       (swarmlab-mpi clean)
list         show instances      (swarmlab-mpi swarmlab-mpi list)
help         show help           (swarmlab-mpi help)
```

[NOTE]
====
Using the tab key to automatically complete unambiguous commands and paths in Bash
====


[[cheat-swarmlab-create]]
== Create swarmlab project

```
mkdir myproject
cd myproject
swarmlab-mpi create
```
.Relevant files:
```
Project
├── Dockerfile          # Image specification
├── project             # Sample program source code
│   └── mpi_hello_world.c
├── ssh                 # keys for accessing
│   ├── id_rsa          # (could generate your own)
│   └── id_rsa.pub
├── docker-compose.yml  # Container orchestration 
```

[[cheat-swarmlab-up]]
== Spin up the swarmlab cluster

```
cd myproject
swarmlab-mpi up size=5
```

[[cheat-swarmlab-up1]]
== Login to the swarmlab cluster

```
cd myproject
swarmlab-mpi login
```

[[cheat-swarmlab-complile]]
==  Compile and Run the sample  program.

```
cd myproject
mpicc -o mpi_hello_world ./mpi_hello_world.c
mpirun ./mpi_hello_world
```

.New files
[NOTE]
====
copy or create files into the project directory. Compile and Run!
====



[[cheat-swarmlab-scale]]
== Scale cluster in real-time

As the cluster running, without having to close the session, open a different terminal and go back to the project directory.

```
cd myproject
swarmlab-mpi scale size=10
```

[[cheat-swarmlab-down]]
== shutdown swarmlab-mpi cluster


```
cd myproject
swarmlab-mpi down
```

:hardbreaks:

{empty} +
{empty} +
{empty} 

:!hardbreaks:

'''

.Reminder
[NOTE]
====
:hardbreaks:
Caminante, no hay camino, 
se hace camino al andar.

Wanderer, there is no path, 
the path is made by walking.

*Antonio Machado* Campos de Castilla
====
