test2
5 years ago
3 changed files with 11 additions and 3 deletions
@ -1,13 +1,17 @@ |
|||||
#!/bin/bash |
#!/bin/bash |
||||
|
|
||||
|
# compile |
||||
mpicc -o /project/mpi_hello_world ../examples/mpi_hello_world.c |
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; |
while read -r line; |
||||
do |
do |
||||
sudo -u mpi scp /project/mpi_hello_world mpi@$line:/project/mpi_hello_world |
sudo -u mpi scp /project/mpi_hello_world mpi@$line:/project/mpi_hello_world |
||||
done < /project/hosts |
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 |
cd /project |
||||
|
|
||||
|
# run it! |
||||
sudo -u mpi mpirun -n 10 -f /project/hosts /project/mpi_hello_world 2>&1 | tee /tmp/output.log |
sudo -u mpi mpirun -n 10 -f /project/hosts /project/mpi_hello_world 2>&1 | tee /tmp/output.log |
||||
|
|
||||
|
@ -1,4 +1,4 @@ |
|||||
#!/bin/bash |
#!/bin/bash |
||||
|
|
||||
echo "cat /project/output.log file" |
echo "do more jobs" |
||||
#cat /tmp/output.log |
#cat /tmp/output.log |
||||
|
@ -1,5 +1,9 @@ |
|||||
#!/bin/bash |
#!/bin/bash |
||||
|
|
||||
|
# find ip |
||||
IP_ADDR=$(ip addr show | grep "inet " | grep "eth0" | awk '{print $2}') |
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 |
nmap -sP $IP_ADDR | grep ondemand_mpi_worker | awk -F "[()]" '{ for (i=2; i<NF; i+=2) print $i }' > /project/hosts |
||||
|
|
||||
|
Loading…
Reference in new issue