From 8a7451534f15d7cb98095e8ed06b275711d22c73 Mon Sep 17 00:00:00 2001 From: test2 Date: Tue, 10 Mar 2020 19:59:53 +0200 Subject: [PATCH] examples 1 ok --- swarmlab/run | 8 ++++++-- swarmlab/runafter | 2 +- swarmlab/runbefore | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/swarmlab/run b/swarmlab/run index 8005651..5a2f69d 100644 --- a/swarmlab/run +++ b/swarmlab/run @@ -1,13 +1,17 @@ #!/bin/bash +# compile mpicc -o /project/mpi_hello_world ../examples/mpi_hello_world.c +# 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 -#sudo -u mpi scp /project/mpi_hello_world mpi@10.0.8.10:/project/mpi_hello_world -#sudo -u mpi scp /project/mpi_hello_world mpi@10.0.8.11:/project/mpi_hello_world + +# cd to work dir cd /project + +# run it! sudo -u mpi mpirun -n 10 -f /project/hosts /project/mpi_hello_world 2>&1 | tee /tmp/output.log diff --git a/swarmlab/runafter b/swarmlab/runafter index 24d71ec..f6af0fe 100644 --- a/swarmlab/runafter +++ b/swarmlab/runafter @@ -1,4 +1,4 @@ #!/bin/bash -echo "cat /project/output.log file" +echo "do more jobs" #cat /tmp/output.log diff --git a/swarmlab/runbefore b/swarmlab/runbefore index 69a3ca6..68e181e 100644 --- a/swarmlab/runbefore +++ b/swarmlab/runbefore @@ -1,5 +1,9 @@ #!/bin/bash +# find ip IP_ADDR=$(ip addr show | grep "inet " | grep "eth0" | awk '{print $2}') + + +# find all clients connected to network nmap -sP $IP_ADDR | grep ondemand_mpi_worker | awk -F "[()]" '{ for (i=2; i /project/hosts