Skip to content

Commit beff98d

Browse files
committed
Added a script to generate the node lists for PBS systems to scripts/polaris
1 parent 9c0b5c9 commit beff98d

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

scripts/polaris/get_nodes.pl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/perl
2+
3+
#Get the nodelist for the head node and body nodes on a PBS system
4+
#Usage:
5+
#PATH/PerformanceAnalysis/scripts/polaris/get_nodes.pl HEAD > head_nodes.nodefile
6+
#PATH/PerformanceAnalysis/scripts/polaris/get_nodes.pl BODY > body_nodes.nodefile
7+
#For services: mpiexec .... --hostfile head_nodes.nodefile
8+
#For client/app mpiexec ..... --hostfile body_nodes.nodefile
9+
10+
$ARGC=scalar @ARGV;
11+
if($ARGC != 1 || ($ARGV[0] ne "HEAD" && $ARGV[0] ne "BODY") ){
12+
print "Usage <script.pl> <HEAD or BODY>\n";
13+
print "HEAD requests the script return the head node\n";
14+
print "BODY requests the script return the remaining nodes\n";
15+
exit 1;
16+
}
17+
18+
$nodelist=$ENV{PBS_NODEFILE};
19+
open(IN,$nodelist);
20+
@nodes=<IN>;
21+
close(IN);
22+
23+
if(scalar @nodes < 2){
24+
print "Need at least 2 nodes\n";
25+
exit(0);
26+
}
27+
28+
if($ARGV[0] eq "HEAD"){
29+
print $nodes[0];
30+
}else{
31+
for($i=1;$i<scalar @nodes;$i++){
32+
print "$nodes[$i]";
33+
}
34+
}

0 commit comments

Comments
 (0)