...
Codeblock | ||||
---|---|---|---|---|
| ||||
#!/bin/bash echo "node: $PBS_NODENUM" echo "task: $PBS_TASKNUM" numnodes=$(wc -l $PBS_NODEFILE) echo "node number: $numnodes" index=$(expr $PBS_TASKNUM - 2) master_info=/gpfs/scratch/$PBS_JOBID/master.info echo "rank: $index" if [[ $index -eq 0 ]] ; then echo "running on master" port=$(shuf -i 2000-65000 -n 1) echo "" > $master_info echo "master=$HOSTNAME-ib" >> $master_info echo "port=$port" >> $master_info echo "wrote master info to $master_info" echo "starting master process" .... now you call/module load else echo "running on slave" echo "waiting for master for some seconds" while [ ! -f $master_info ] do sleep 1 # or less like 0.2 done echo "found info file $master_info" sleep 1 master=$(grep master $master_info | awk -F'=' '{print $2}') port=$(grep port $master_info | awk -F'=' '{print $2}') echo "found master at $master:port" ... now your call/module load f |
...