File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments