Browse Source

examples 1 ok

master
test2 3 years ago
parent
commit
8a7451534f
  1. 8
      swarmlab/run
  2. 2
      swarmlab/runafter
  3. 4
      swarmlab/runbefore

8
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

2
swarmlab/runafter

@ -1,4 +1,4 @@
#!/bin/bash
echo "cat /project/output.log file"
echo "do more jobs"
#cat /tmp/output.log

4
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<NF; i+=2) print $i }' > /project/hosts

Loading…
Cancel
Save