Extend the scaling test script to support multiple starters, including mpirun, orterun (if mpirun not present), orte-dvm, and srun. Auto-detect which are p
resent and allow the user to run all of them. Auto-detect the number of nodes in the allocation.
Этот коммит содержится в:
родитель
f2805fb0f9
Коммит
187fa9b131
@ -2,63 +2,61 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2012 Los Alamos National Security, Inc.
|
# Copyright (c) 2012 Los Alamos National Security, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
# Copyright (c) 2015 Intel, Inc. All rights reserved.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use Getopt::Long;
|
||||||
|
|
||||||
# globals
|
# globals
|
||||||
my $showme_arg = 0;
|
my $num_nodes = 2;
|
||||||
my $num_nodes = 0;
|
|
||||||
my $my_arg;
|
my $my_arg;
|
||||||
my $reps = 1;
|
my $reps = 1;
|
||||||
my $usedvm = 0;
|
my $usedvm = 0;
|
||||||
my $srun = 0;
|
my $usesrun = 0;
|
||||||
|
my $usempirun = 0;
|
||||||
|
my $runall = 0;
|
||||||
|
|
||||||
my @tests = qw(/bin/true ./orte_no_op ./mpi_no_op ./mpi_no_op);
|
my @tests = qw(/bin/true ./orte_no_op ./mpi_no_op ./mpi_no_op);
|
||||||
my @options = ("", "", "", "-mca mpi_preconnect_mpi 1");
|
my @options = ("", "", "", "-mca mpi_add_procs_cutoff 0 -mca pmix_base_async_modex 1");
|
||||||
|
my @starters = qw(mpirun orte-submit srun orterun);
|
||||||
|
my @starteroptions = ("-npernode 1 --novm",
|
||||||
|
"--hnp file:dvm_uri -pernode",
|
||||||
|
"--distribution=cyclic",
|
||||||
|
"-npernode 1 --novm");
|
||||||
|
|
||||||
# Cannot use the usual GetOpts library as the user might
|
# Set to true if the script should merely print the cmds
|
||||||
# be passing -options to us! So have to
|
# it would run, but don't run them
|
||||||
# parse the options ourselves to look for help and showme
|
my $SHOWME = 0;
|
||||||
my $i = 0;
|
# Set to true to suppress most informational messages.
|
||||||
foreach $my_arg (@ARGV) {
|
my $QUIET = 0;
|
||||||
if ($my_arg eq "-h" ||
|
# Set to true if we just want to see the help message
|
||||||
$my_arg eq "--h" ||
|
my $HELP = 0;
|
||||||
$my_arg eq "-help" ||
|
|
||||||
$my_arg eq "--help") {
|
|
||||||
print "Options:
|
|
||||||
--showme Show the actual commands without executing them
|
|
||||||
--nodes Number of nodes to run the test across
|
|
||||||
--reps Number of times to run each test (for statistics)
|
|
||||||
--dvm Use orte-dvm instead of mpirun
|
|
||||||
--srun Use srun instead of mpirun
|
|
||||||
--help | -h This help list\n";
|
|
||||||
exit;
|
|
||||||
} elsif ($my_arg eq "-showme" ||
|
|
||||||
$my_arg eq "--showme") {
|
|
||||||
$showme_arg = 1;
|
|
||||||
} elsif ($my_arg eq "-nodes" ||
|
|
||||||
$my_arg eq "--nodes") {
|
|
||||||
$num_nodes = @ARGV[$i+1];
|
|
||||||
} elsif ($my_arg eq "--reps" ||
|
|
||||||
$my_arg eq "-reps") {
|
|
||||||
$reps = @ARGV[$i+1];
|
|
||||||
} elsif ($my_arg eq "--dvm" ||
|
|
||||||
$my_arg eq "-dvm") {
|
|
||||||
$usedvm = 1;
|
|
||||||
} elsif ($my_arg eq "--srun" ||
|
|
||||||
$my_arg eq "-srun") {
|
|
||||||
$srun = 1;
|
|
||||||
} else {
|
|
||||||
print "Argument " . $my_arg . " is not recognized\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
# bozo test
|
GetOptions(
|
||||||
if (1 == $srun && 1 == $usedvm) {
|
"help" => \$HELP,
|
||||||
print "Cannot specify both srun and DVM\n";
|
"quiet" => \$QUIET,
|
||||||
exit(1);
|
"showme" => \$SHOWME,
|
||||||
|
"reps=s" => \$reps,
|
||||||
|
"dvm" => \$usedvm,
|
||||||
|
"srun" => \$usesrun,
|
||||||
|
"mpirun" => \$usempirun,
|
||||||
|
"all" => \$runall,
|
||||||
|
) or die "unable to parse options, stopped";
|
||||||
|
|
||||||
|
if ($HELP) {
|
||||||
|
print <<EOT;
|
||||||
|
$0 [options]
|
||||||
|
|
||||||
|
--help | -h This help message
|
||||||
|
--quiet | -q Only output critical messages to stdout
|
||||||
|
--showme Show the actual commands without executing them
|
||||||
|
--reps Number of times to run each test (for statistics)
|
||||||
|
--mpirun Use only mpirun (or its equivalent orterun)
|
||||||
|
--dvm Use only orte-dvm to execute the test
|
||||||
|
--srun Use only srun to execute the test
|
||||||
|
--all Use all available start commands [default]
|
||||||
|
EOT
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $n = 1;
|
my $n = 1;
|
||||||
@ -73,37 +71,126 @@ my $res;
|
|||||||
my $toggle;
|
my $toggle;
|
||||||
my $idx;
|
my $idx;
|
||||||
my $option;
|
my $option;
|
||||||
print "\n--------------------------------------------------\n";
|
my $havedvm = 0;
|
||||||
|
|
||||||
if (1 == $usedvm) {
|
# see which starters are available
|
||||||
$cmd = "orte-dvm --report-uri dvm_uri 2>&1 &";
|
my @path = split(":", $ENV{PATH});
|
||||||
print $cmd . "\n";
|
my $exists = 0;
|
||||||
if (0 == $showme_arg) {
|
$idx=0;
|
||||||
system($cmd);
|
while ($idx <= $#starters) {
|
||||||
|
$starter = $starters[$idx];
|
||||||
|
$exists = 0;
|
||||||
|
foreach my $path (@path) {
|
||||||
|
if ( -x "$path/$starter") {
|
||||||
|
$exists = 1;
|
||||||
|
last;
|
||||||
}
|
}
|
||||||
$starter = "orte-submit --hnp file:dvm_uri --map-by ppr:1:node";
|
}
|
||||||
} elsif (1 == $srun) {
|
unless ($exists) {
|
||||||
$starter = "srun --distribution=cyclic";
|
# remove this one from the list
|
||||||
} else {
|
splice @starters, $idx, 1;
|
||||||
$starter = "mpirun -npernode 1 --novm"
|
splice @starteroptions, $idx, 1;
|
||||||
|
# adjust the index
|
||||||
|
$idx = $idx - 1;
|
||||||
|
} elsif ($usedvm && $starter ne "orte-submit") {
|
||||||
|
# remove this one from the list
|
||||||
|
splice @starters, $idx, 1;
|
||||||
|
splice @starteroptions, $idx, 1;
|
||||||
|
# adjust the index
|
||||||
|
$idx = $idx - 1;
|
||||||
|
} elsif ($usesrun && $starter ne "srun") {
|
||||||
|
# remove this one from the list
|
||||||
|
splice @starters, $idx, 1;
|
||||||
|
splice @starteroptions, $idx, 1;
|
||||||
|
# adjust the index
|
||||||
|
$idx = $idx - 1;
|
||||||
|
} elsif ($usempirun && (($starter ne "mpirun") && ($starter ne "orterun"))) {
|
||||||
|
# remove this one from the list
|
||||||
|
splice @starters, $idx, 1;
|
||||||
|
splice @starteroptions, $idx, 1;
|
||||||
|
# adjust the index
|
||||||
|
$idx = $idx - 1;
|
||||||
|
}
|
||||||
|
$idx = $idx + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach $test (@tests) {
|
# if both mpirun and orterun are present, then
|
||||||
$option = shift(@options);
|
# we don't need to run both as they are just
|
||||||
|
# symlinks to each other
|
||||||
|
$exists = 0;
|
||||||
|
foreach my $path (@path) {
|
||||||
|
if ( -x "$path/mpirun") {
|
||||||
|
$idx=0;
|
||||||
|
foreach $starter (@starters) {
|
||||||
|
if ($starter eq "orterun") {
|
||||||
|
splice @starters, $idx, 1;
|
||||||
|
splice @starteroptions, $idx, 1;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
$idx = $idx + 1;
|
||||||
|
}
|
||||||
|
if ($exists) {
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# bozo check
|
||||||
|
if (scalar @starters == 0) {
|
||||||
|
print "No available starters\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
# if we are going to use the dvm, then we
|
||||||
|
# need to start it
|
||||||
|
if (-e "dvm_uri") {
|
||||||
|
system("rm -f dvm_uri");
|
||||||
|
}
|
||||||
|
foreach $starter (@starters) {
|
||||||
|
if ($starter eq "orte-submit") {
|
||||||
|
$cmd = "orte-dvm --report-uri dvm_uri 2>&1 &";
|
||||||
|
print $cmd . "\n";
|
||||||
|
if (!$SHOWME) {
|
||||||
|
system($cmd);
|
||||||
|
# wait for the rendezvous file to appear
|
||||||
|
while (! -e "dvm_uri") {
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
$havedvm = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# determine the number of nodes - doesn't
|
||||||
|
# matter which starter we use
|
||||||
|
$cmd = $starters[0] . " " . $starteroptions[0] . " hostname";
|
||||||
|
$output = `$cmd`;
|
||||||
|
@lines = split(/\n/, $output);
|
||||||
|
$num_nodes = $#lines + 1;
|
||||||
|
|
||||||
|
|
||||||
|
print "\n--------------------------------------------------\n";
|
||||||
|
|
||||||
|
my $index = 0;
|
||||||
|
foreach $starter (@starters) {
|
||||||
|
my $testnum = 0;
|
||||||
|
foreach $test (@tests) {
|
||||||
|
$option = $options[$testnum];
|
||||||
if (-e $test) {
|
if (-e $test) {
|
||||||
if (0 == $showme_arg) {
|
if (!$SHOWME) {
|
||||||
# pre-position the executable
|
# pre-position the executable
|
||||||
$cmd = $starter . " $test 2>&1";
|
$cmd = $starter . $starteroptions[$index] . " $test 2>&1";
|
||||||
system($cmd);
|
system($cmd);
|
||||||
}
|
}
|
||||||
$n = 1;
|
$n = 1;
|
||||||
while ($n <= $num_nodes) {
|
while ($n <= $num_nodes) {
|
||||||
$cmd = "time " . $starter . " -np $n $option $test 2>&1";
|
$cmd = "time " . $starter . " " . $starteroptions[$index] . " -np $n $option $test 2>&1";
|
||||||
print $cmd . "\n";
|
print $cmd . "\n";
|
||||||
if (0 == $showme_arg) {
|
if (!$SHOWME) {
|
||||||
for (1..$reps) {
|
for (1..$reps) {
|
||||||
$toggle = 1;
|
$toggle = 1;
|
||||||
$output = `$cmd`;
|
$output = `$cmd`;
|
||||||
|
print $output . "\n";
|
||||||
@lines = split(/\n/, $output);
|
@lines = split(/\n/, $output);
|
||||||
foreach $line (@lines) {
|
foreach $line (@lines) {
|
||||||
if (0 <= index($line, "user") ||
|
if (0 <= index($line, "user") ||
|
||||||
@ -133,10 +220,10 @@ foreach $test (@tests) {
|
|||||||
}
|
}
|
||||||
$n = 2 * $n;
|
$n = 2 * $n;
|
||||||
}
|
}
|
||||||
if ($n != (2 * $num_nodes)) {
|
if ($n < $num_nodes) {
|
||||||
$cmd = "time " . $starter . " $option $test 2>&1";
|
$cmd = "time " . $starter . " " . $starteroptions[$index] . " $option $test 2>&1";
|
||||||
print $cmd . "\n";
|
print $cmd . "\n";
|
||||||
if (0 == $showme_arg) {
|
if (!$SHOWME) {
|
||||||
for (1..$reps) {
|
for (1..$reps) {
|
||||||
$output = `$cmd`;
|
$output = `$cmd`;
|
||||||
$output =~ s/(.+)\n.*/$1/;
|
$output =~ s/(.+)\n.*/$1/;
|
||||||
@ -150,9 +237,17 @@ foreach $test (@tests) {
|
|||||||
print "Test " . $test . " was not found - test skipped\n";
|
print "Test " . $test . " was not found - test skipped\n";
|
||||||
print "\n--------------------------------------------------\n";
|
print "\n--------------------------------------------------\n";
|
||||||
}
|
}
|
||||||
|
$testnum = $testnum + 1;
|
||||||
|
}
|
||||||
|
$index = $index + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 == $usedvm && 0 == $showme_arg) {
|
if ($havedvm) {
|
||||||
|
if (!$SHOWME) {
|
||||||
$cmd = "orte-submit --hnp file:dvm_uri --terminate";
|
$cmd = "orte-submit --hnp file:dvm_uri --terminate";
|
||||||
system($cmd);
|
system($cmd);
|
||||||
|
}
|
||||||
|
if (-e "dvm_uri") {
|
||||||
|
system("rm -f dvm_uri");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user