|
|
@ -11,3 +11,48 @@ Instances of Ubuntu Linux with [MPICH](https://www.mpich.org) -- portable implem |
|
|
|
|
|
|
|
|
|
|
|
[inspired by NLKNguyen](https://github.com/NLKNguyen/alpine-mpich) |
|
|
|
|
|
|
|
|
|
|
|
## Quickstart |
|
|
|
|
|
|
|
This is a quickstart guide of how you can typically use this *LabInstance to deploy MPI programs* |
|
|
|
|
|
|
|
- Working Directory |
|
|
|
|
|
|
|
> /project |
|
|
|
|
|
|
|
- Default user for MPI |
|
|
|
|
|
|
|
> mpi |
|
|
|
|
|
|
|
- The host file that contains addresses of connected workers can created with: |
|
|
|
|
|
|
|
> IP_ADDR=$(ip addr show | grep "inet " | grep "eth0" | awk '{print $2}') |
|
|
|
> 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 |
|
|
|
|
|
|
|
sudo -u mpi mpirun -n 10 -f /project/hosts /project/mpi_hello_world |
|
|
|
|
|
|
|
<div class="panel panel-info"> |
|
|
|
**Note** |
|
|
|
{: .panel-heading} |
|
|
|
<div class="panel-body"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```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 |
|
|
|
``` |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|