You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.1 KiB

4 years ago
# mpi !
4 years ago
4 years ago
Instances of Ubuntu Linux with [MPICH](https://www.mpich.org) -- portable implementation of Message Passing Interface (MPI) standard. Designed for MPI program development and deployment.
4 years ago
4 years ago
## LabInstance mpi
![alt text](images/swarmlab-network.png "")
4 years ago
4 years ago
[inspired by NLKNguyen](https://github.com/NLKNguyen/alpine-mpich)
4 years ago
## Quickstart
4 years ago
This is a quickstart guide of howto use this *LabInstance to deploy MPI programs*
4 years ago
4 years ago
### HowTo use it
- On step "*1. Select Git Repo*" [see here](http://docs.swarmlab.io/SwarmLab-HowTos/HowTo-create-lab.adoc.html)
choose "*examples-mpi*"
- On step "*2. Select swarm service*" choose "*ondemand_mpi_master*"
- On step "*3. Save Lab Instance*" put the name you want
- Save it.
Your are ready to run your fresh *LabInstance* [see here](http://docs.swarmlab.io/SwarmLab-HowTos/HowTo-create-lab.adoc.html#_run_instance)
### Default Configuration
4 years ago
- Working Directory
> /project
- Default user for MPI
> mpi
4 years ago
- Buid-in Web Server
---
**INFO**
*Lab_Instance Name* = The name you give [here](http://docs.swarmlab.io/SwarmLab-HowTos/HowTo-create-lab.adoc.html#_step_3_save_lab_instance)
You can also find [here](http://docs.swarmlab.io/SwarmLab-HowTos/index.adoc.html#_main_lab_intance_interface)
Usage:
> touch /var/www/html/[name]/file
---
4 years ago
- The host file that contains addresses of connected workers can be created with:
4 years ago
> IP_ADDR=$(ip addr show | grep "inet " | grep "eth0" | awk '{print $2}')
4 years ago
>
4 years ago
> nmap -sP $IP_ADDR | grep ondemand_mpi_worker | awk -F "[()]" '{ for (i=2; i<NF; i+=2) print $i }' > /project/hosts
- Compile
> mpicc -o /project/mpi_hello_world examples/mpi_hello_world.c
- run the MPI hello world program
4 years ago
> sudo -u mpi mpirun -n 10 -f /project/hosts /project/mpi_hello_world
4 years ago
4 years ago
---
4 years ago
**NOTE:** copy hello world to all clients
4 years ago
```bash
# scp hello wrold to all clients. sudo -u mpi for auto scp connect. see /home/mpi/.ssh
while read -r line;
do
sudo -u mpi scp /project/mpi_hello_world mpi@$line:/project/mpi_hello_world
done < /project/hosts
```
4 years ago
---
4 years ago
4 years ago
---
**MORE INFO**
See swarmlab and examples directory
---