#!/bin/bash # compile DIRhosts=/home/ubuntu/mpitmp/hosts DIR=/home/ubuntu/mpitmp mkdir -p $DIR mpicc -o $DIR/mpi_hello_world ./mpi_hello_world.c # scp hello wrold to all clients. sudo -u mpi for auto scp connect. see /home/mpi/.ssh swarmlab-getworkers > $DIRhosts while read -r line; do scp $DIR/mpi_hello_world ubuntu@$line:$DIR/mpi_hello_world done < $DIRhosts # run it! mpirun -n 10 -f $DIRhosts $DIR/mpi_hello_world 2>&1 | tee /tmp/output.log