atat-mirror/glue/jobctrl/splitnodefile.sgi

19 lines
610 B
Plaintext
Raw Normal View History

2023-08-31 20:30:18 +02:00
#!/bin/csh
if ( x$2 == "x" ) then
echo Usage: splitnodefile total_number_of_nodes number_of_groups \[nodes_to_reserve_for_master\]
exit
endif
set nbnode=$1
set nbgroup=$2
set nbskip=0
if ( x$3 != "x" ) then
set nbskip=$3
endif
awk 'BEGIN {nbgroup='$nbgroup'; nbskip='$nbskip'; nbnode='$nbnode';\
if (nbskip>0) {print "mpirun -np "nbskip" dplace -c 0-"(nbskip-1) > "masterprefix.tmp";} \
print "set waitbetweenpoll=5"; \
for (g=0; g<nbgroup; g++) {\
a=int(nbskip+g*(nbnode-nbskip)/nbgroup); \
b=int(nbskip+(g+1)*(nbnode-nbskip)/nbgroup-1); \
print "mpirun -np "(b-a+1)" dplace -c "a"-"b;}}' >! machine.rc