Browse Source

examples 1 ok

master
test2 4 months ago
parent
commit
8a7451534f
3 changed files with 11 additions and 3 deletions
  1. +6
    -2
      swarmlab/run
  2. +1
    -1
      swarmlab/runafter
  3. +4
    -0
      swarmlab/runbefore

+ 6
- 2
swarmlab/run View File

@@ -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


+ 1
- 1
swarmlab/runafter View File

@@ -1,4 +1,4 @@
#!/bin/bash

echo "cat /project/output.log file"
echo "do more jobs"
#cat /tmp/output.log

+ 4
- 0
swarmlab/runbefore View File

@@ -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