2012-05-29 19:21:44 +04:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
#
|
|
|
|
# Copyright (c) 2012 Los Alamos National Security, Inc.
|
|
|
|
# All rights reserved.
|
2015-11-08 22:34:06 +03:00
|
|
|
# Copyright (c) 2015 Intel, Inc. All rights reserved.
|
2012-05-29 19:21:44 +04:00
|
|
|
|
|
|
|
use strict;
|
2015-11-08 22:34:06 +03:00
|
|
|
use Getopt::Long;
|
2012-05-29 19:21:44 +04:00
|
|
|
|
|
|
|
# globals
|
2015-11-08 22:34:06 +03:00
|
|
|
my $num_nodes = 2;
|
2012-05-29 19:21:44 +04:00
|
|
|
my $my_arg;
|
2012-05-29 22:21:47 +04:00
|
|
|
my $reps = 1;
|
2015-11-08 00:13:36 +03:00
|
|
|
my $usedvm = 0;
|
2015-11-08 22:34:06 +03:00
|
|
|
my $usesrun = 0;
|
|
|
|
my $usempirun = 0;
|
2015-11-11 12:25:17 +03:00
|
|
|
my $useaprun = 0;
|
2015-11-12 00:29:04 +03:00
|
|
|
my $useaprun = 0;
|
|
|
|
my $myapp;
|
2015-11-08 22:34:06 +03:00
|
|
|
my $runall = 0;
|
2015-11-12 23:11:17 +03:00
|
|
|
my $rawoutput = 0;
|
2015-11-12 00:29:04 +03:00
|
|
|
my $myresults;
|
|
|
|
my @csvrow;
|
2012-05-29 19:21:44 +04:00
|
|
|
|
2012-06-01 06:35:15 +04:00
|
|
|
my @tests = qw(/bin/true ./orte_no_op ./mpi_no_op ./mpi_no_op);
|
2015-11-08 22:34:06 +03:00
|
|
|
my @options = ("", "", "", "-mca mpi_add_procs_cutoff 0 -mca pmix_base_async_modex 1");
|
2015-11-11 12:25:17 +03:00
|
|
|
my @starters = qw(mpirun orte-submit srun aprun orterun);
|
2015-11-08 22:34:06 +03:00
|
|
|
my @starteroptions = ("-npernode 1 --novm",
|
|
|
|
"--hnp file:dvm_uri -pernode",
|
|
|
|
"--distribution=cyclic",
|
2015-11-12 00:29:04 +03:00
|
|
|
"-N 1",
|
2015-11-08 22:34:06 +03:00
|
|
|
"-npernode 1 --novm");
|
|
|
|
|
|
|
|
# Set to true if the script should merely print the cmds
|
|
|
|
# it would run, but don't run them
|
|
|
|
my $SHOWME = 0;
|
|
|
|
# Set to true to suppress most informational messages.
|
|
|
|
my $QUIET = 0;
|
|
|
|
# Set to true if we just want to see the help message
|
|
|
|
my $HELP = 0;
|
|
|
|
|
|
|
|
GetOptions(
|
|
|
|
"help" => \$HELP,
|
|
|
|
"quiet" => \$QUIET,
|
|
|
|
"showme" => \$SHOWME,
|
|
|
|
"reps=s" => \$reps,
|
|
|
|
"dvm" => \$usedvm,
|
|
|
|
"srun" => \$usesrun,
|
2015-11-11 12:25:17 +03:00
|
|
|
"aprun" => \$useaprun,
|
2015-11-08 22:34:06 +03:00
|
|
|
"mpirun" => \$usempirun,
|
2015-11-12 00:29:04 +03:00
|
|
|
"myapp=s" => \$myapp,
|
2015-11-08 22:34:06 +03:00
|
|
|
"all" => \$runall,
|
2015-11-12 00:29:04 +03:00
|
|
|
"results=s" => \$myresults,
|
2015-11-12 23:11:17 +03:00
|
|
|
"rawout" => \$rawoutput,
|
2015-11-08 22:34:06 +03:00
|
|
|
) or die "unable to parse options, stopped";
|
2012-05-29 19:21:44 +04:00
|
|
|
|
2015-11-08 22:34:06 +03:00
|
|
|
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
|
2015-11-12 00:29:04 +03:00
|
|
|
--reps=s Number of times to run each test (for statistics)
|
2015-11-08 22:34:06 +03:00
|
|
|
--mpirun Use only mpirun (or its equivalent orterun)
|
|
|
|
--dvm Use only orte-dvm to execute the test
|
2015-11-11 12:25:17 +03:00
|
|
|
--srun Use only srun (if available) to execute the test
|
|
|
|
--arpun Use only aprun (if available) to execute the test
|
2015-11-12 00:29:04 +03:00
|
|
|
--myapp=s In addition to the standard tests, run this specific application (including any args)
|
2015-11-08 22:34:06 +03:00
|
|
|
--all Use all available start commands [default]
|
2015-11-12 00:29:04 +03:00
|
|
|
--results=file File where results are to stored in comma-separated value format
|
2015-11-12 23:11:17 +03:00
|
|
|
--rawout Provide raw timing output to the file
|
2015-11-08 22:34:06 +03:00
|
|
|
EOT
|
|
|
|
exit(0);
|
2015-11-08 00:13:36 +03:00
|
|
|
}
|
|
|
|
|
2012-05-29 19:21:44 +04:00
|
|
|
my $n = 1;
|
|
|
|
my $cmd;
|
2015-11-08 00:13:36 +03:00
|
|
|
my $starter;
|
2012-05-29 19:21:44 +04:00
|
|
|
my $test;
|
2012-05-29 21:41:38 +04:00
|
|
|
my $output;
|
2012-05-29 22:21:47 +04:00
|
|
|
my @lines;
|
|
|
|
my $line;
|
2012-05-29 21:41:38 +04:00
|
|
|
my @results;
|
2012-05-29 22:21:47 +04:00
|
|
|
my $res;
|
2012-05-30 01:33:06 +04:00
|
|
|
my $idx;
|
2012-06-01 06:35:15 +04:00
|
|
|
my $option;
|
2015-11-08 22:34:06 +03:00
|
|
|
my $havedvm = 0;
|
2015-11-08 00:13:36 +03:00
|
|
|
|
2015-11-08 22:34:06 +03:00
|
|
|
# see which starters are available
|
|
|
|
my @path = split(":", $ENV{PATH});
|
|
|
|
my $exists = 0;
|
|
|
|
$idx=0;
|
|
|
|
while ($idx <= $#starters) {
|
|
|
|
$starter = $starters[$idx];
|
|
|
|
$exists = 0;
|
|
|
|
foreach my $path (@path) {
|
|
|
|
if ( -x "$path/$starter") {
|
|
|
|
$exists = 1;
|
|
|
|
last;
|
|
|
|
}
|
2015-11-08 00:13:36 +03:00
|
|
|
}
|
2015-11-08 22:34:06 +03:00
|
|
|
unless ($exists) {
|
|
|
|
# remove this one from the list
|
|
|
|
splice @starters, $idx, 1;
|
|
|
|
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;
|
2015-11-11 12:25:17 +03:00
|
|
|
} elsif ($useaprun && $starter ne "aprun") {
|
|
|
|
# remove this one from the list
|
|
|
|
splice @starters, $idx, 1;
|
|
|
|
splice @starteroptions, $idx, 1;
|
|
|
|
# adjust the index
|
|
|
|
$idx = $idx - 1;
|
2015-11-08 22:34:06 +03:00
|
|
|
} 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
# if both mpirun and orterun are present, then
|
|
|
|
# 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;
|
2015-11-08 00:13:36 +03:00
|
|
|
}
|
|
|
|
|
2015-11-12 00:29:04 +03:00
|
|
|
# if they gave us an app, add it to the list of tests
|
|
|
|
if ($myapp) {
|
|
|
|
push @tests, $myapp;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($myresults) {
|
|
|
|
# open the results file
|
|
|
|
open FILE, ">$myresults" || die "file could not be opened";
|
|
|
|
}
|
|
|
|
|
2015-11-08 22:34:06 +03:00
|
|
|
# determine the number of nodes - doesn't
|
|
|
|
# matter which starter we use
|
|
|
|
$cmd = $starters[0] . " " . $starteroptions[0] . " hostname";
|
2015-11-12 00:29:04 +03:00
|
|
|
print "CMD: $cmd\n";
|
2015-11-08 22:34:06 +03:00
|
|
|
$output = `$cmd`;
|
2015-11-12 00:29:04 +03:00
|
|
|
print "$output\n";
|
2015-11-08 22:34:06 +03:00
|
|
|
@lines = split(/\n/, $output);
|
|
|
|
$num_nodes = $#lines + 1;
|
|
|
|
|
2015-11-12 00:29:04 +03:00
|
|
|
# collect the complete list of starters
|
|
|
|
my $mystarters;
|
|
|
|
$idx=1;
|
|
|
|
$mystarters = $starters[0];
|
|
|
|
while ($idx < $#starters) {
|
|
|
|
$mystarters = $mystarters . "," . $starters[$idx];
|
|
|
|
$idx = $idx + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
# get the local date and time
|
|
|
|
my ($sec,$min,$hour,$day,$month,$yr19,@rest) = localtime(time);
|
2015-11-08 22:34:06 +03:00
|
|
|
|
2015-11-12 00:29:04 +03:00
|
|
|
# start by printing out the resulting configuration
|
2015-11-08 22:34:06 +03:00
|
|
|
print "\n--------------------------------------------------\n";
|
2015-11-12 00:29:04 +03:00
|
|
|
print "\nTest configuration:\n";
|
|
|
|
print "\tDate:\t" . "$day-".++$month. "-".($yr19+1900) . " " . sprintf("%02d",$hour).":".sprintf("%02d",$min).":".sprintf("%02d",$sec) . "\n";;
|
|
|
|
print "\tNum nodes:\t" . $num_nodes . "\n";
|
|
|
|
print "\tStarters:\t" . $mystarters . "\n";
|
|
|
|
print "\n--------------------------------------------------\n";
|
|
|
|
|
|
|
|
# and tag the output file as well
|
|
|
|
if ($myresults) {
|
|
|
|
print FILE "Test configuration:\n";
|
|
|
|
print FILE "Date:\t" . "$day-".++$month. "-".($yr19+1900) . " " . sprintf("%02d",$hour).":".sprintf("%02d",$min).":".sprintf("%02d",$sec) . "\n";;
|
|
|
|
print FILE "Num nodes:\t" . $num_nodes . "\n";
|
|
|
|
print FILE "Starters:\t" . $mystarters . "\n";
|
|
|
|
}
|
2015-11-08 22:34:06 +03:00
|
|
|
|
|
|
|
my $index = 0;
|
2015-11-12 23:11:17 +03:00
|
|
|
|
|
|
|
sub runcmd()
|
|
|
|
{
|
|
|
|
for (1..$reps) {
|
|
|
|
$output = `$cmd`;
|
|
|
|
if ($myresults && $rawoutput) {
|
|
|
|
print FILE $n . " " . $output . "\n";
|
|
|
|
}
|
|
|
|
@lines = split(/\n/, $output);
|
|
|
|
foreach $line (@lines) {
|
|
|
|
if (0 <= index($line, "real") ||
|
|
|
|
0 <= index($line, "elapsed")) {
|
|
|
|
# we know that at least one item of interest is
|
|
|
|
# in this line, so let's look for it - start
|
|
|
|
# by getting rid of any leading whitespace
|
|
|
|
$line =~ s/^\s+//;
|
|
|
|
@results = split (/ +/,$line);
|
|
|
|
$idx = 0;
|
|
|
|
foreach $res (@results) {
|
|
|
|
# we are only interested in the real or elapsed time
|
|
|
|
my $strloc = index($res, "real");
|
|
|
|
if (0 <= $strloc) {
|
|
|
|
# some systems put the number in front of
|
|
|
|
# this word, and some append the word to
|
|
|
|
# the number - consider both cases
|
|
|
|
if (0 == $strloc) {
|
|
|
|
if (0 == $idx) {
|
|
|
|
# it must be in the next location
|
|
|
|
push @csvrow,$results[1];
|
|
|
|
} else {
|
|
|
|
# it must be in the prior location
|
|
|
|
push @csvrow,$results[$idx-1];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# take the portion of the string up to the tag
|
|
|
|
push @csvrow,substr($res, 0, $strloc);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$strloc = index($res, "elapsed");
|
|
|
|
if (0 <= $strloc) {
|
|
|
|
# some systems put the number in front of
|
|
|
|
# this word, and some append the word to
|
|
|
|
# the number - consider both cases
|
|
|
|
if (0 == $strloc) {
|
|
|
|
if (0 == $idx) {
|
|
|
|
# it must be in the next location
|
|
|
|
push @csvrow,$results[1];
|
|
|
|
} else {
|
|
|
|
# it must be in the prior location
|
|
|
|
push @csvrow,$results[$idx-1];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# take the portion of the string up to the tag
|
|
|
|
push @csvrow,substr($res, 0, $strloc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$idx = $idx + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# we have now completed all the reps, so log the results
|
|
|
|
if ($myresults) {
|
|
|
|
my $myout;
|
|
|
|
my $mycnt=0;
|
|
|
|
while ($mycnt <= $#csvrow) {
|
|
|
|
if (0 == $mycnt) {
|
|
|
|
$myout = $csvrow[$mycnt];
|
|
|
|
} else {
|
|
|
|
$myout = $myout . "," . $csvrow[$mycnt];
|
|
|
|
}
|
|
|
|
$mycnt = $mycnt + 1;
|
|
|
|
}
|
|
|
|
print FILE "$myout\n";
|
|
|
|
# clear the output
|
|
|
|
@csvrow = ();
|
|
|
|
}
|
|
|
|
print "\n";
|
|
|
|
}
|
|
|
|
|
2015-11-08 22:34:06 +03:00
|
|
|
foreach $starter (@starters) {
|
2015-11-12 23:11:17 +03:00
|
|
|
# if we are going to use the dvm, then we
|
|
|
|
if ($starter eq "orte-submit") {
|
|
|
|
# need to start it
|
|
|
|
if (-e "dvm_uri") {
|
|
|
|
system("rm -f dvm_uri");
|
|
|
|
}
|
|
|
|
$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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-12 00:29:04 +03:00
|
|
|
if ($myresults) {
|
|
|
|
print FILE "\n\n$starter\n\n";
|
|
|
|
}
|
2015-11-08 22:34:06 +03:00
|
|
|
my $testnum = 0;
|
|
|
|
foreach $test (@tests) {
|
|
|
|
$option = $options[$testnum];
|
|
|
|
if (-e $test) {
|
2015-11-12 00:29:04 +03:00
|
|
|
if ($myresults) {
|
|
|
|
print FILE "#nodes,$test\n";
|
|
|
|
}
|
2015-11-08 22:34:06 +03:00
|
|
|
if (!$SHOWME) {
|
|
|
|
# pre-position the executable
|
|
|
|
$cmd = $starter . $starteroptions[$index] . " $test 2>&1";
|
|
|
|
system($cmd);
|
|
|
|
}
|
|
|
|
$n = 1;
|
|
|
|
while ($n <= $num_nodes) {
|
2015-11-12 00:29:04 +03:00
|
|
|
push @csvrow,$n;
|
2015-11-11 12:25:17 +03:00
|
|
|
$cmd = "time " . $starter . " " . $starteroptions[$index] . " -n $n $option $test 2>&1";
|
2015-11-08 22:34:06 +03:00
|
|
|
print $cmd . "\n";
|
|
|
|
if (!$SHOWME) {
|
2015-11-12 23:11:17 +03:00
|
|
|
runcmd();
|
2012-05-29 22:21:47 +04:00
|
|
|
}
|
2015-11-08 22:34:06 +03:00
|
|
|
$n = 2 * $n;
|
2012-05-29 19:21:44 +04:00
|
|
|
}
|
2015-11-12 23:11:17 +03:00
|
|
|
if (0 != $num_nodes & $n) {
|
2015-11-08 22:34:06 +03:00
|
|
|
$cmd = "time " . $starter . " " . $starteroptions[$index] . " $option $test 2>&1";
|
|
|
|
print $cmd . "\n";
|
|
|
|
if (!$SHOWME) {
|
2015-11-12 23:11:17 +03:00
|
|
|
runcmd();
|
2012-05-29 22:21:47 +04:00
|
|
|
}
|
2012-05-29 19:21:44 +04:00
|
|
|
}
|
2015-11-08 22:34:06 +03:00
|
|
|
print "\n--------------------------------------------------\n";
|
|
|
|
} else {
|
|
|
|
print "Test " . $test . " was not found - test skipped\n";
|
|
|
|
print "\n--------------------------------------------------\n";
|
2012-05-29 19:21:44 +04:00
|
|
|
}
|
2015-11-08 22:34:06 +03:00
|
|
|
$testnum = $testnum + 1;
|
2012-05-29 19:21:44 +04:00
|
|
|
}
|
2015-11-12 23:11:17 +03:00
|
|
|
if ($havedvm) {
|
|
|
|
if (!$SHOWME) {
|
|
|
|
$cmd = "orte-submit --hnp file:dvm_uri --terminate";
|
|
|
|
system($cmd);
|
|
|
|
}
|
|
|
|
if (-e "dvm_uri") {
|
|
|
|
system("rm -f dvm_uri");
|
|
|
|
}
|
|
|
|
}
|
2015-11-08 22:34:06 +03:00
|
|
|
$index = $index + 1;
|
2012-05-29 19:21:44 +04:00
|
|
|
}
|
2015-11-08 00:13:36 +03:00
|
|
|
|
2015-11-12 23:11:17 +03:00
|
|
|
if ($myresults) {
|
|
|
|
close(FILE);
|
2015-11-08 00:13:36 +03:00
|
|
|
}
|
2015-11-12 23:11:17 +03:00
|
|
|
|