2012-05-29 19:21:44 +04:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
#
|
|
|
|
# Copyright (c) 2012 Los Alamos National Security, Inc.
|
|
|
|
# All rights reserved.
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
# globals
|
|
|
|
my $showme_arg = 0;
|
|
|
|
my $num_nodes = 0;
|
|
|
|
my $my_arg;
|
2012-05-29 22:21:47 +04:00
|
|
|
my $reps = 1;
|
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);
|
|
|
|
my @options = ("", "", "", "-mca mpi_preconnect_mpi 1");
|
2012-05-29 19:21:44 +04:00
|
|
|
|
|
|
|
# Cannot use the usual GetOpts library as the user might
|
|
|
|
# be passing -options to us! So have to
|
|
|
|
# parse the options ourselves to look for help and showme
|
|
|
|
my $i = 0;
|
|
|
|
foreach $my_arg (@ARGV) {
|
|
|
|
if ($my_arg eq "-h" ||
|
|
|
|
$my_arg eq "--h" ||
|
|
|
|
$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
|
2012-05-29 22:21:47 +04:00
|
|
|
--reps Number of times to run each test (for statistics)
|
2012-05-29 19:21:44 +04:00
|
|
|
--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];
|
2012-05-29 22:21:47 +04:00
|
|
|
} elsif ($my_arg eq "--reps" ||
|
|
|
|
$my_arg eq "-reps") {
|
|
|
|
$reps = @ARGV[$i+1];
|
2012-05-29 19:21:44 +04:00
|
|
|
}
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
my $n = 1;
|
|
|
|
my $cmd;
|
|
|
|
|
|
|
|
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;
|
|
|
|
my $toggle;
|
2012-05-30 01:33:06 +04:00
|
|
|
my $idx;
|
2012-06-01 06:35:15 +04:00
|
|
|
my $option;
|
2012-05-29 21:41:38 +04:00
|
|
|
print "\n--------------------------------------------------\n";
|
2012-05-29 19:21:44 +04:00
|
|
|
foreach $test (@tests) {
|
2012-06-01 06:35:15 +04:00
|
|
|
$option = shift(@options);
|
2012-05-29 19:21:44 +04:00
|
|
|
if (-e $test) {
|
2012-05-29 21:41:38 +04:00
|
|
|
# pre-position the executable
|
|
|
|
$cmd = "mpirun -npernode 1 $test 2>&1";
|
|
|
|
system($cmd);
|
2012-05-29 19:21:44 +04:00
|
|
|
$n = 1;
|
|
|
|
while ($n <= $num_nodes) {
|
2012-06-01 06:35:15 +04:00
|
|
|
$cmd = "time mpirun -npernode 1 -max-vm-size $n $option $test 2>&1";
|
2012-05-29 19:21:44 +04:00
|
|
|
print $cmd . "\n";
|
|
|
|
if (0 == $showme_arg) {
|
2012-05-29 22:21:47 +04:00
|
|
|
for (1..$reps) {
|
|
|
|
$toggle = 1;
|
|
|
|
$output = `$cmd`;
|
|
|
|
@lines = split(/\n/, $output);
|
|
|
|
foreach $line (@lines) {
|
|
|
|
if (0 <= index($line, "user") ||
|
|
|
|
0 <= index($line, "sys") ||
|
|
|
|
0 <= index($line, "real") ||
|
|
|
|
0 <= index($line, "elapsed")) {
|
2012-05-30 01:33:06 +04:00
|
|
|
$idx = 0;
|
|
|
|
@results = split(/\s+/,$line, 4);
|
2012-05-29 22:21:47 +04:00
|
|
|
foreach $res (@results) {
|
2012-05-30 01:33:06 +04:00
|
|
|
if ($idx < 3) {
|
|
|
|
print $res;
|
|
|
|
if (0 == $toggle) {
|
|
|
|
print " ";
|
|
|
|
$toggle = 1;
|
|
|
|
} else {
|
|
|
|
print " ";
|
|
|
|
$toggle = 0;
|
|
|
|
}
|
2012-05-29 22:21:47 +04:00
|
|
|
}
|
2012-05-30 01:33:06 +04:00
|
|
|
$idx = $idx + 1;
|
2012-05-29 22:21:47 +04:00
|
|
|
}
|
|
|
|
print "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-05-30 01:33:06 +04:00
|
|
|
print "\n";
|
2012-05-29 19:21:44 +04:00
|
|
|
}
|
|
|
|
$n = 2 * $n;
|
|
|
|
}
|
|
|
|
if ($n != (2 * $num_nodes)) {
|
2012-06-01 06:35:15 +04:00
|
|
|
$cmd = "time mpirun -npernode 1 $option $test 2>&1";
|
2012-05-29 21:41:38 +04:00
|
|
|
print $cmd . "\n";
|
|
|
|
if (0 == $showme_arg) {
|
2012-05-29 22:21:47 +04:00
|
|
|
for (1..$reps) {
|
|
|
|
$output = `$cmd`;
|
|
|
|
$output =~ s/(.+)\n.*/$1/;
|
|
|
|
@results = split(/\s+/,$output);
|
|
|
|
print $results[0] . " " . $results[1] . " " . $results[2] . "\n";
|
|
|
|
}
|
2012-05-29 19:21:44 +04:00
|
|
|
}
|
|
|
|
}
|
2012-05-29 21:41:38 +04:00
|
|
|
print "\n--------------------------------------------------\n";
|
2012-05-29 19:21:44 +04:00
|
|
|
} else {
|
2012-05-29 22:21:47 +04:00
|
|
|
print "Test " . $test . " was not found - test skipped\n";
|
|
|
|
print "\n--------------------------------------------------\n";
|
2012-05-29 19:21:44 +04:00
|
|
|
}
|
|
|
|
}
|