16 lines
692 B
Plaintext
16 lines
692 B
Plaintext
|
#!/bin/csh
|
||
|
if ( x$2 == "x" ) then
|
||
|
echo Usage: splitnodefile nodefile number_of_groups \[nodes_to_reserve_for_master\]
|
||
|
exit
|
||
|
endif
|
||
|
set nodefilename=$1
|
||
|
set nbgroup=$2
|
||
|
set nbskip=0
|
||
|
if ( x$3 != "x" ) then
|
||
|
set nbskip=$3
|
||
|
endif
|
||
|
set nbnode=`cat $nodefilename | wc -l`
|
||
|
cat $nodefilename | awk 'BEGIN {nbgroup='$nbgroup'; nbskip='$nbskip'; nbnode='$nbnode'; l=0} \
|
||
|
{if (l<nbskip) {print $0 > "subnodefile0.tmp" } else {idx=1+int(nbgroup*(l-nbskip)/(nbnode-nbskip)); file="subnodefile" idx ".tmp"; print $0 > file; np[idx]++} l++} \
|
||
|
END {print "set waitbetweenpoll=5" > "machine.rc"; for (j=1; j<=nbgroup; j++) {print "mpirun -np "np[j]" -machinefile '`pwd`'/subnodefile"j".tmp" > "machine.rc" }}'
|